Skip to main content

An set of tools to Automate LTSpice simulations

Project description


PySpicer is a toolchain of python utilities design to interact with LTSpice Electronic Simulator.

What is contained in this repository

  • An utility that extracts from LTSpice output files data, and formats it for import in a spreadsheet,s uch like Excel or Calc.

  • A pure python class that serves to read raw files into a python class.

  • A python script that uses numpy and matplotlib to create an histogram and calculate the sigma deviations. This is useful for Monte-Carlo analysis.

  • This is a script to launch LTSpice Simulations. This is useful because:

    • Can overcome the limitation of only stepping 3 parameters
    • Different types of simulations .TRAN .AC .NOISE can be run in a single batch
    • The RAW Files are smaller and easier to treat
    • When used with the and, validattion of the circuit can be done automatically.
    • Different models can be simulation in a single batch. The principle of operation is the following :
      1. Add to the Spice circuit a .INC sim_settings.lib . In this include simulation directives are written by the script per each simulation call.
      2. Use the python script to update the simulation directives and call LTSpice to run the simulation in command line.
      3. When the simulation is complete, the simulation results are renamed according to user guidance.

    Note: It only works with Windows based installations.

How to Install

Using PiP Installer

pip install --upgrade PyLTSpice

Using GITHub

git clone

If using this method it would be good to add the path where you cloned the site to python path.

import sys
sys.path.append(<path to PyLTSpice>)

How to use

Include the following line on your scripts

from PyLTSpice.LTSpiceRaw_Reader import LTSpiceRawRead

from matplotlib import plot

LTR = LTSpiceRawRead("Draft1.raw")


IR1 = LTR.get_trace("I(R1)")
x = LTR.get_trace(0) # Zero is always the X axis
steps = LT.get_steps()
for step in range(len(steps)):
# print(steps[step])
plt.plot(x.get_wave(step), IR1.get_wave(step), label=steps[step])

plt.legend() # order a legend.


from PyLTSpice.LTSpiceBatch import *
LTC = LTCommander("testfile.asc")

python -m PyLTSpice.LTSteps <logfile or directory where last simulation was made>

python -m PyLTSpice.Histogram

To whom do I talk to?


  • Version 0.6 now has an option to make the histogram directly from values stored in the clipboard

  • Version 0.5 The now uses the struc.unpack function for a faster execution

  • Version 0.4 Added to the collection of tools

  • Version 0.3 A version of LTSteps that can be imported to use in a higher level script

  • Version 0.2 Adding and

  • Version 0.1 First commit to the bitbucket repository.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PyLTSpice, version 0.1.post5
Filename, size File type Python version Upload date Hashes
Filename, size PyLTSpice-0.1.post5-py3-none-any.whl (45.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size PyLTSpice-0.1.post5.tar.gz (23.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page