This module allows to process data generated by LTSpice during simulation. There are three types of files that are handled by this module.
log files - Files with the extension ‘.log’ that are automatically generated during simulation, and that are normally accessible with the shortcut Ctrl+L after a simulation is ran.Log files are interesting for two reasons.
1. If .STEP primitives are used, the log file contain the correspondence between the step run and the step value configuration.
2. If .MEAS primitives are used in the schematic, the log file contains the measurements made on the output data.
LTSteps.py can be used to retrieve both step and measurement information from log files.
txt files - Files exported from the Plot File -> Export data as text menu. This file is an text file where data is saved in the text format. The reason to use PyLTSpice instead of another popular lib as pandas, is because the data format when .STEPS are used in the simulation is not not very practical. The PyLTSpice LTSteps.py can be used to reformat the text, so that the run parameter is added to the data as an additional column instead of a table divider. Please Check LTSpiceExport class for more information.
mout files - Files generated by the Plot File -> Execute .MEAS Script menu. This command allows the user to run predefined .MEAS commands which create a .mout file. A .mout file has the measurement information stored in the following format:Measurement: Vout_rms step RMS(V(OUT)) FROM TO 1 1.41109 0 0.001 2 1.40729 0 0.001 Measurement: Vin_rms step RMS(V(IN)) FROM TO 1 0.706221 0 0.001 2 0.704738 0 0.001 Measurement: gain step Vout_rms/Vin_rms 1 1.99809 2 1.99689
The LTSteps.py can be used directly from a command line by invoking python with the -m option as exemplified below.
$ python -m PyLTSpice.LTSteps <path_to_filename>
If <path_to_filename> is a log file, it will create a file with the same name, but with extension .tout that is a tab separated value (tsv) file, which contains the .STEP and .MEAS information collected.
If <path_to_filename> is a txt exported file, it will create a file with the same name, but with extension .tsv a tab separated value (tsv) file, which contains data reformatted with the step number as one of the columns. Please consult the reformat_LTSpice_export() function for more information.
If <path_to_filename> is a mout file, it will create a file with the same name, but with extension .tmout that is a tab separated value (tsv) file, which contains the .MEAS information collected, but adding the STEP run information as one of the columns.
If <path_to_filename> argument is ommited, the script will automatically search for the newest .log/.txt/.mout file and use it.