Skip to content

Commit

Permalink
Removing dependencies. These are now solely on the spicelib dependency.
Browse files Browse the repository at this point in the history
Alignment with spicelib 0.8
  • Loading branch information
nunobrum committed Nov 3, 2023
1 parent 237440d commit 1e428a8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ _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.1
* Important Bugfix on the LTComplex class.
* Fixes and enhancing the analysis toolkit.
* Deprecating SpiceEditor.write_netlist in favour of save_netlist()

* Version 5.0
* Making this library dependent on spicelib while trying to maintain backward compatibility as much as possible.
PyLTspice will be kept alive and its update will be linked to the spicelib. The main difference is that using
Expand Down
6 changes: 3 additions & 3 deletions doc/modules/read_netlist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The rationale for this division is to allow to manipulate not only elements that
manipulate elements that exit inside of sub-circuits. In Example 2 there is small example where the value of a component
inside a subcircuit is changed.

When all the changes are made, the write_netlist(<filename>) needs to be called in order for the updates to be registered.
When all the changes are made, the save_netlist(<filename>) needs to be called in order for the updates to be registered.

Do not update the original file. It is always safer to keep the original file unchanged. This helps when debuging problems,
and also allows the script to revert to the initial condition by using the reset_netlist() method.
Expand All @@ -39,7 +39,7 @@ Example 1: Setting parameters inside a flat netlist.
".param run = 0"
)
net.write_netlist("Batch_Test_Modified.net") # writes the modified netlist to the indicated file
net.save_netlist("Batch_Test_Modified.net") # writes the modified netlist to the indicated file
Example 2: Updating components inside a subcircuit
Expand All @@ -52,7 +52,7 @@ Example 2: Updating components inside a subcircuit
net.set_component_value('R1', 1000) # Sets the value of R1 to 1k
net.set_component_value('XU1:Ra', '1k') # Sets the value of Ra inside of XU1 to 1k
net.write_netlist("Batch_Test_Modified.net")
net.save_netlist("Batch_Test_Modified.net")
See the class documentation for more details :

Expand Down
2 changes: 1 addition & 1 deletion examples/spice_editor_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
se.set_component_value('C1', 1.1E-6)
se.set_component_value('V1', 11)

se.write_netlist("./testfiles/Noise_updated.net")
se.save_netlist("./testfiles/Noise_updated.net")
se.run()
10 changes: 2 additions & 8 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.0"
version = "5.1"
authors = [
{ name="Nuno Brum", email="me@nunobrum.com" },
]
Expand All @@ -15,13 +15,7 @@ readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.8"
dependencies = [
"numpy",
"scipy",
"psutil",
"clipboard",
"matplotlib",
"keyboard",
"spicelib>=0.6",
"spicelib>=0.8",
]
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
10 changes: 5 additions & 5 deletions unittests/test_asc_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ def test_component_editing(self):
self.assertEqual(self.edt.get_component_value('R1'), '10k', "Tested R1 Value") # add assertion here
self.assertListEqual(self.edt.get_components(), ['Vin', 'R1', 'R2', 'D1'], "Tested get_components") # add assertion here
self.edt.set_component_value('R1', '33k')
self.edt.write_netlist(test_dir + 'test_components_output.asc')
self.edt.save_netlist(test_dir + 'test_components_output.asc')
self.equalFiles(test_dir + 'test_components_output.asc', golden_dir + 'test_components_output.asc')
self.assertEqual(self.edt.get_component_value('R1'), '33k', "Tested R1 Value") # add assertion here
self.edt.remove_component('R1')
self.edt.write_netlist(test_dir + 'test_components_output_1.asc')
self.edt.save_netlist(test_dir + 'test_components_output_1.asc')
self.equalFiles(test_dir + 'test_components_output_1.asc', golden_dir + 'test_components_output_1.asc')

def test_parameter_edit(self):
self.assertEqual(self.edt.get_parameter('TEMP'), '0', "Tested TEMP Parameter") # add assertion here
self.edt.set_parameter('TEMP', 25)
self.assertEqual(self.edt.get_parameter('TEMP'), '25', "Tested TEMP Parameter") # add assertion here
self.edt.write_netlist(test_dir + 'test_parameter_output.asc')
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
Expand All @@ -41,10 +41,10 @@ def test_instructions(self):
self.edt.add_instruction('.save I(R1)')
self.edt.add_instruction('.save I(R2)')
self.edt.add_instruction('.save I(D1)')
self.edt.write_netlist(test_dir + 'test_instructions_output.asc')
self.edt.save_netlist(test_dir + 'test_instructions_output.asc')
self.equalFiles(test_dir + 'test_instructions_output.asc', golden_dir + 'test_instructions_output.asc')
self.edt.remove_instruction('.save I(R1)')
self.edt.write_netlist(test_dir + 'test_instructions_output_1.asc')
self.edt.save_netlist(test_dir + 'test_instructions_output_1.asc')
self.equalFiles(test_dir + 'test_instructions_output_1.asc', golden_dir + 'test_instructions_output_1.asc')

def equalFiles(self, file1, file2):
Expand Down

0 comments on commit 1e428a8

Please sign in to comment.