Skip to content

Commit

Permalink
Alignment to spicelib 1.0.4
Browse files Browse the repository at this point in the history
Fixes on unittests
  • Loading branch information
nunobrum committed Mar 10, 2024
1 parent 9f3ec95 commit 4eaffb4
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 130 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ _Make sure to initialize the root logger before importing the library to be able
* Alternative contact : [nuno.brum@gmail.com](mailto:nuno.brum@gmail.com)

## History ##
* Version 5.3.1
* Fixes on the unittests after the spicelib update to 1.0.4

* Version 5.3
* Correction on the run_montecarlo.py and run_worst_case.py examples.
* Fixes on the spicelib (Version 1.0.3)
Expand Down
27 changes: 10 additions & 17 deletions examples/testfiles/AC - STEP_1.log
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\AC - STEP.asc
Start Time: Sun Mar 10 17:30:33 2024
solver = Normal
Maximum thread count: 16

.OP point found by inspection.
.step r1=1000
.step r1=10000

Date: Wed Aug 9 23:53:57 2023
Total elapsed time: 0.023 seconds.

.OP point found by inspection.
.step r1=1000
tnom = 27
temp = 27
method = trap
totiter = 0
traniter = 0
tranpoints = 0
accept = 0
rejected = 0
matrix size = 3
fillins = 0
solver = Normal
Avg thread counts: 16.0/0.0/0.0/16.0
Matrix Compiler1: 4 opcodes
Matrix Compiler2: 15 opcodes
method = modified trap
.step r1=10000
Total elapsed time: 0.004 seconds.

Binary file modified examples/testfiles/AC - STEP_1.raw
Binary file not shown.
26 changes: 8 additions & 18 deletions examples/testfiles/AC_1.log
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\AC.asc

.OP point found by inspection.

Date: Wed Aug 9 23:53:55 2023
Total elapsed time: 0.008 seconds.

Start Time: Sun Mar 10 17:30:30 2024
solver = Normal
Maximum thread count: 16
tnom = 27
temp = 27
method = trap
totiter = 0
traniter = 0
tranpoints = 0
accept = 0
rejected = 0
matrix size = 3
fillins = 0
solver = Normal
Avg thread counts: 16.0/0.0/0.0/16.0
Matrix Compiler1: 4 opcodes
Matrix Compiler2: 15 opcodes
method = modified trap
.OP point found by inspection.
Total elapsed time: 0.004 seconds.

Binary file modified examples/testfiles/AC_1.raw
Binary file not shown.
31 changes: 10 additions & 21 deletions examples/testfiles/Batch_Test_1.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\Batch_Test.asc

Start Time: Sun Mar 10 17:30:40 2024
solver = Normal
Maximum thread count: 16
tnom = 27
temp = 27
method = modified trap
Direct Newton iteration failed to find .op point. (Use ".option noopiter" to skip.)
Starting Gmin stepping
Gmin = 10
Expand Down Expand Up @@ -43,25 +49,8 @@ Gmin stepping succeeded in finding the operating point.
vout_rms: RMS(v(out))=1.41109 FROM 0 TO 0.001
vin_rms: RMS(v(in))=0.70622 FROM 0 TO 0.001
gain: vout_rms/vin_rms=1.99808
vout1m: v(out)=-0.0187858 at 0.001
period: time=1.48916e-10 at 1.48916e-10

vout1m: v(out)=-0.0187828 at 0.001
period: time=1.49937e-10 at 1.49937e-10

Date: Wed Aug 9 23:54:05 2023
Total elapsed time: 0.175 seconds.

tnom = 27
temp = 27
method = modified trap
totiter = 3129
traniter = 2100
tranpoints = 1051
accept = 1050
rejected = 1
matrix size = 20
fillins = 20
solver = Normal
Avg thread counts: 3.8/6.6/6.6/3.8
Matrix Compiler1: 1.50 KB object code size 0.6/0.3/[0.3]
Matrix Compiler2: 2.25 KB object code size 0.3/0.3/[0.2]
Total elapsed time: 0.052 seconds.

Binary file modified examples/testfiles/Batch_Test_1.raw
Binary file not shown.
45 changes: 31 additions & 14 deletions examples/testfiles/DC op point - STEP_1.log
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\DC op point - STEP.asc
Start Time: Sun Mar 10 17:30:44 2024
solver = Normal
Maximum thread count: 16



Direct Newton iteration for .op point succeeded.

Date: Wed Aug 9 23:54:09 2023
Total elapsed time: 0.115 seconds.























tnom = 27
temp = 27
method = trap
totiter = 3
traniter = 0
tranpoints = 0
accept = 0
rejected = 0
matrix size = 7
fillins = 0
solver = Normal
Avg thread counts: 16.0/0.0/16.0/16.0
Matrix Compiler1: 268 bytes object code size
Matrix Compiler2: 467 bytes object code size
method = modified trap
Total elapsed time: 0.011 seconds.

Binary file modified examples/testfiles/DC op point - STEP_1.raw
Binary file not shown.
24 changes: 7 additions & 17 deletions examples/testfiles/DC op point_1.log
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\DC op point.asc

Start Time: Sun Mar 10 17:30:42 2024
solver = Normal
Maximum thread count: 16
tnom = 27
temp = 27
method = modified trap
Direct Newton iteration for .op point succeeded.

Date: Wed Aug 9 23:54:07 2023
Total elapsed time: 0.002 seconds.

tnom = 27
temp = 27
method = trap
totiter = 3
traniter = 0
tranpoints = 0
accept = 0
rejected = 0
matrix size = 3
fillins = 0
solver = Normal
Avg thread counts: 16.0/0.0/16.0/16.0
Matrix Compiler1: 104 bytes object code size
Matrix Compiler2: 163 bytes object code size
Binary file modified examples/testfiles/DC op point_1.raw
Binary file not shown.
34 changes: 16 additions & 18 deletions examples/testfiles/TRAN - STEP_1.log
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\TRAN - STEP.asc
Start Time: Sun Mar 10 17:30:58 2024
solver = Normal
Maximum thread count: 16



.OP point found by inspection.
.step vin=1 r1=1000



.step vin=10 r1=1000



.step vin=1 r1=10000
tnom = 27
temp = 27
method = modified trap
.step vin=10 r1=10000


Expand Down Expand Up @@ -42,22 +57,5 @@ Measurement: t5
3 0.393469 0.005
4 3.93469 0.005


Date: Wed Aug 9 23:54:21 2023
Total elapsed time: 0.273 seconds.

tnom = 27
temp = 27
method = modified trap
totiter = 2162
traniter = 2162
tranpoints = 1082
accept = 1081
rejected = 1
matrix size = 3
fillins = 0
solver = Normal
Avg thread counts: 3.7/6.4/6.4/3.7
Matrix Compiler1: off [0.1]/0.1/0.1
Matrix Compiler2: 175 bytes object code size 0.1/0.1/[0.0]
Total elapsed time: 0.022 seconds.

Binary file modified examples/testfiles/TRAN - STEP_1.raw
Binary file not shown.
27 changes: 8 additions & 19 deletions examples/testfiles/TRAN_1.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
LTspice 24.0.9 for Windows
Circuit: * C:\sandbox\PyLTSpice\examples\testfiles\TRAN.asc

Start Time: Sun Mar 10 17:30:56 2024
solver = Normal
Maximum thread count: 16
tnom = 27
temp = 27
method = modified trap
.OP point found by inspection.

t1: v(out)=0.63174 at 0.001
Expand All @@ -8,22 +14,5 @@ t3: v(out)=0.950225 at 0.003
t4: v(out)=0.981665 at 0.004
t5: v(out)=0.993262 at 0.005


Date: Wed Aug 9 23:54:19 2023
Total elapsed time: 0.086 seconds.

tnom = 27
temp = 27
method = modified trap
totiter = 2162
traniter = 2162
tranpoints = 1082
accept = 1081
rejected = 1
matrix size = 3
fillins = 0
solver = Normal
Avg thread counts: 3.7/6.4/6.4/3.7
Matrix Compiler1: off [0.1]/0.1/0.1
Matrix Compiler2: 175 bytes object code size 0.1/0.1/[0.1]
Total elapsed time: 0.008 seconds.

Binary file modified examples/testfiles/TRAN_1.raw
Binary file not shown.
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [
build-backend = "setuptools.build_meta"
[project]
name = "PyLTSpice"
version = "5.2"
version = "5.2.1"
authors = [
{ name="Nuno Brum", email="me@nunobrum.com" },
]
Expand All @@ -15,7 +15,7 @@ readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.8"
dependencies = [
"spicelib>=1.0.3",
"spicelib>=1.0.4",
]
classifiers=[
"Programming Language :: Python :: 3",
Expand All @@ -33,3 +33,5 @@ namespaces = true # true by default
[project.urls]
"Homepage" = "https://github.com/nunobrum/PyLTSpice"
"Bug Tracker" = "https://github.com/nunobrum/PyLTSpice/issues"
"Repository" = "https://github.com/nunobrum/PyLTSpice.git"
"Author" = "https://www.nunobrum.com/"
6 changes: 6 additions & 0 deletions unittests/golden/test_components_output_1.asc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ WINDOW 0 -82 53 Left 2
WINDOW 3 -85 83 Left 2
SYMATTR InstName Vin
SYMATTR Value 1
SYMBOL res 272 224 R0
SYMATTR InstName R2
SYMATTR Value {res}
SYMBOL diode 432 224 R0
WINDOW 0 39 36 Left 2
SYMATTR InstName D1
TEXT 56 488 Left 2 !.dc Vin 1 10 9
TEXT 56 440 Left 2 !.param res=10k
TEXT 120 400 Left 2 !.step temp 0 100 50
Expand Down
2 changes: 1 addition & 1 deletion unittests/golden/test_instructions_output.asc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SYMATTR Value {res}
SYMBOL diode 432 224 R0
WINDOW 0 39 36 Left 2
SYMATTR InstName D1
TEXT 56 488 Left 2 .ac dec 10 1 100k
TEXT 56 488 Left 2 !.ac dec 10 1 100k
TEXT 56 440 Left 2 !.param res=10k
TEXT 120 400 Left 2 !.step temp 0 100 50
TEXT 408 400 Left 2 ;.step param res 1k 16k 5k
Expand Down
2 changes: 1 addition & 1 deletion unittests/golden/test_instructions_output_1.asc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SYMATTR Value {res}
SYMBOL diode 432 224 R0
WINDOW 0 39 36 Left 2
SYMATTR InstName D1
TEXT 56 488 Left 2 .ac dec 10 1 100k
TEXT 56 488 Left 2 !.ac dec 10 1 100k
TEXT 56 440 Left 2 !.param res=10k
TEXT 120 400 Left 2 !.step temp 0 100 50
TEXT 408 400 Left 2 ;.step param res 1k 16k 5k
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_asc_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_parameter_edit(self):
self.edt.save_netlist(test_dir + 'test_parameter_output.asc')
self.equalFiles(test_dir + 'test_parameter_output.asc', golden_dir + 'test_parameter_output.asc')
self.edt.set_parameter('TEMP', 0) # reset to 0
self.assertEqual(self.edt.get_parameter('TEMP'), '0.0', "Tested TEMP Parameter") # add assertion here
self.assertEqual(self.edt.get_parameter('TEMP'), '0', "Tested TEMP Parameter") # add assertion here

def test_instructions(self):
self.edt.add_instruction('.ac dec 10 1 100k')
Expand Down
4 changes: 3 additions & 1 deletion unittests/test_pyltspice.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ def processing_data(raw_file, log_file):
for measure in log.get_measure_names():
print(measure, '=', log.get_measure_value(measure))
self.assertEqual(log.get_measure_value('fcutac'), 8479370.0)
self.assertEqual(str(log.get_measure_value('vout1m')), '(6.02059dB,0°)')
vout1m = log.get_measure_value('vout1m')
self.assertEqual(vout1m.mag_db(), 6.02059)
self.assertAlmostEqual(vout1m.ph_rad(), 0, 5)
self.assertEqual(log.get_measure_value('vout1m').mag_db(), 6.02059)

@unittest.skipIf(skip_ltspice_tests, "Skip if not in windows environment")
Expand Down

0 comments on commit 4eaffb4

Please sign in to comment.