PyLTSpice - LTSpice Automation Tools with python (Current Version 1.0)
Install directly from command line
pip install PyLTSpice
PyLTSpice is hosted in PyPi
and in github.org
Donations serve to support costs with website hosting and with financing the development of other tools. The excess will be sent to non profit and community organisations.
Traces are accessible by the method "get_trace(trace_ref)" where trace_ref is either the name of the net on the LTSPice Simulation. Normally trace references are stored with the format V(<node_name>) for voltages or I(device_reference) for currents. For example V(n001) or I(R1) or Ib(Q1).
For checking steps in simulations, the method get_steps() should be used. In case there are no steps in the simulation, the class will return a single element list.
NOTE: This module tries to import the numpy if exists on the system. If it finds numpy all data is later provided as an array. If not it will use a standard list of floats.
Below there is an example of the class usage.
LT = LTSpice_RawRead.LTSpiceRawRead("Draft1.raw")
IR1 = LT.get_trace("I(R1)")
x = LT.get_trace(0) # Zero is always the X axis
steps = LT.get_steps()
for step in range(len(steps)):
plt.plot(x.get_wave(step), IR1.get_wave(step), label=steps[step])
plt.legend() # order a legend.