diff --git a/PyLTSpice/LTSteps.py b/PyLTSpice/LTSteps.py index 75a22c2..2b3498d 100644 --- a/PyLTSpice/LTSteps.py +++ b/PyLTSpice/LTSteps.py @@ -153,6 +153,6 @@ def valid_extension(filename): data.export_data(fname_out) data.export_data(fname_out) - # input("Press Enter to Continue") -main() \ No newline at end of file +if __name__ == "__main__": + main() diff --git a/PyLTSpice/sim/spice_editor.py b/PyLTSpice/sim/spice_editor.py index 106332a..26221c7 100644 --- a/PyLTSpice/sim/spice_editor.py +++ b/PyLTSpice/sim/spice_editor.py @@ -980,9 +980,9 @@ def reset_netlist(self) -> None: finished = self._add_lines(lines) if not finished: raise SyntaxError("Netlist with missing .END or .ENDS statements") - else: - for remainig_lines in lines: - print("Ignoring %s" % remainig_lines) + # else: + # for _ in lines: # Consuming the rest of the file. + # pass # print("Ignoring %s" % _) else: self.logger.error("Netlist file not found") diff --git a/tests/Batch_Test_1.log b/tests/Batch_Test_1.log index f696ea8..d4dbd04 100644 --- a/tests/Batch_Test_1.log +++ b/tests/Batch_Test_1.log @@ -1,8 +1,5 @@ Circuit: * C:\sandbox\PySpice\tests\Batch_Test.asc -No AC stimulus found: - Set the value of a current or voltage source to "AC 1." - to make it behave as a signal generator for AC analysis. Direct Newton iteration failed to find .op point. (Use ".option noopiter" to skip.) Starting Gmin stepping Gmin = 10 @@ -14,54 +11,38 @@ Gmin = 0.000142725 Gmin = 1.5325e-05 Gmin = 1.6455e-06 Gmin = 1.76685e-07 -vernier = 0.5 -vernier = 0.25 -Gmin = 6.41063e-08 -vernier = 0.125 -vernier = 0.0625 -vernier = 0.0833333 -Gmin = 6.04858e-08 -vernier = 0.111111 -Gmin = 4.7254e-08 -vernier = 0.148148 -vernier = 0.197531 -Gmin = 3.13284e-08 -vernier = 0.263374 -vernier = 0.351165 -Gmin = 1.6399e-08 -vernier = 0.46822 -Gmin = 6.0282e-09 -vernier = 0.624294 -vernier = 0.832392 -Gmin = 1.18541e-09 -vernier = 1 -Gmin = 1.36264e-10 -Gmin = 1.46313e-11 -Gmin = 1.57102e-12 -Gmin = 1.68687e-13 +Gmin = 1.89714e-08 +Gmin = 2.03704e-09 +Gmin = 2.18725e-10 +Gmin = 2.34854e-11 +Gmin = 2.52173e-12 +Gmin = 2.70769e-13 Gmin = 0 Gmin stepping succeeded in finding the operating point. -Multiply defined .measure result: gain +vout_rms: RMS(v(out))=1.06048 FROM 0 TO 0.001 +vin_rms: RMS(v(in))=0.707048 FROM 0 TO 0.001 +gain: vout_rms/vin_rms=1.49987 +vout1m: v(out)=-0.0013187 at 0.001 +period: time=9.87226e-09 at 9.87226e-09 - Each .measure statement needs a unique result name. -Date: Sun Apr 30 20:47:19 2023 -Total elapsed time: 0.079 seconds. +Date: Fri May 26 16:11:46 2023 +Total elapsed time: 0.151 seconds. tnom = 27 temp = 27 -method = trap -totiter = 1029 -traniter = 0 -tranpoints = 0 -accept = 0 -rejected = 0 -matrix size = 20 -fillins = 17 +method = modified trap +totiter = 2460 +traniter = 2092 +tranpoints = 1047 +accept = 1046 +rejected = 1 +matrix size = 11 +fillins = 2 solver = Normal -Avg thread counts: 2.4/0.0/4.4/1.6 -Matrix Compiler1: 82 opcodes -Matrix Compiler2: off [0.2]/0.4/0.7 +Avg thread counts: 1.3/1.6/1.6/1.3 +Matrix Compiler1: 566 bytes object code size 0.4/0.4/[0.2] +Matrix Compiler2: 1.10 KB object code size 0.3/0.5/[0.2] diff --git a/tests/batch_test4.py b/tests/batch_test4.py index b26469b..b8904fb 100644 --- a/tests/batch_test4.py +++ b/tests/batch_test4.py @@ -1,4 +1,7 @@ +# coding=utf-8 +import sys +sys.path.insert(0, '..') # This is to allow the import from the PyLTSpice folder from PyLTSpice import SimRunner, SpiceEditor from PyLTSpice.sim.process_callback import ProcessCallback # Importing the ProcessCallback class type @@ -10,7 +13,7 @@ class CallbackProc(ProcessCallback): def callback(raw_file, log_file): print("Handling the simulation data of ""%s"", log file ""%s""" % (raw_file, log_file)) # Doing some processing here - return "Parsed Result of ""%s""" % raw_file, ", log file ""%s""" % log_file + return "Parsed Result of ""%s""" % raw_file + ", log file ""%s""" % log_file if __name__ == "__main__": @@ -40,8 +43,8 @@ def callback(raw_file, log_file): run_netlist_file = "{}_{}_{}.net".format(netlist.netlist_file.stem, opamp, supply_voltage) runner.run(netlist, run_filename=run_netlist_file, callback=CallbackProc) - for results in runner: - print(results) + for result in runner: + print(result) # Prints the result of the callback function netlist.reset_netlist() netlist.add_instructions( # Adding additional instructions