6. User FAQ

6.1. How to get help or report an issue ?

If you want to discuss or ask questions on PySpice, you can subscribe and post messages on the PySpice User mailing list.

There is actually three lists running on Google Groups (*):

User List
List for PySpice users
Announce List
List for announcements regarding PySpice releases and development
Devel List
List for developers of PySpice

If you encounter an issue, please fill an issue on the Issue Tracker.

(*) Despite Google Groups has many drawbacks, I don’t have actually enough resources to run GNU Mailman or Discourse on my own IT infrastructure.

6.2. How to typeset u_kΩ or u_μV in Python code ?

There is three solutions if you don’t have these Unicode characters available on your keyboard. The first one, is to use the ASCII alternative: u_kOhm or u_uV.. The second one, is to define macros on your favourite editor. The last one, is to customise your keyboard settings (on Linux look at https://www.x.org/wiki/XKB/).

6.3. Is unit API well tested ?

Unit API is an ongoing work. You must use it with caution since it can be buggy or incomplete.

6.4. Is ground node required ?

Yes, according to Ngspice manual, each circuit has to have a ground node (gnd or 0)!

6.5. How to deal with SPICE parameters that clash with Python keywords ?

For such cases, PySpice accepts keyword arguments with a trailing underscore, for example:

model = circuit.model('Diode', 'D', is_=1)
model.is_ = 1
model['is'] = 1

We can also use uppercase letters since SPICE is case insensitive.

6.6. How to pass raw SPICE command ?

If the API don’t yet implement a SPICE command, then you can pass raw SPICE commands using:

circuit.raw_spice  = '...'
circuit.raw_spice += '...'

and raw parameters using:

r1 = circuit.R('1', 1, 0, raw_spice='...')
r1.raw_spice  = '...'
r1.raw_spice += '...'

Warning

However the API must be aware of the nodes in order to retrieve data from the simulation output.

6.7. How to set the Ngspice library path ?

If the setting doesn’t match your environment, then you have to set manually the attribute PySpice.Spice.NgSpice.Shared.NgSpiceShared.LIBRARY_PATH. Note you have to place a brace pair just before the extension, for example “C:…ngspice{}.dll”. You can also fix the value of PySpice.Spice.NgSpice.Shared.NgSpiceShared.NGSPICE_PATH.

6.8. How to set the Ngspice path ?

If the setting doesn’t match your environment, then you have to set manually the attribute PySpice.Spice.Server.SpiceServer.SPICE_COMMAND. This value can be passed as argument as well, see API documentation.

6.9. How to set the simulator ?

You can set globally the default simulator using the attribute PySpice.Spice.Simulation.CircuitSimulator.DEFAULT_SIMULATOR.

Else you can set the simulator per simulation using the simulator option:

simulator = circuit.simulator(simulator='...')

Actually, theses simulators are available:

  • ngspice-subprocess
  • ngspice-shared
  • xyce-serial
  • xyce-parallel

6.10. Is Xyce 100% compatible with SPICE ?

No, you have to read the user guide and reference manual to learn what are the actual differences!

In particular, the device models provided by vendors could need to be adapted for Xyce.

Notice, you can add the suffix @xyce to a .lib or .mod file in order to have a special version for Xyce, for example BAV21.lib@xyce. The PySpice Library Manager will include this special version if it found one that correspond to the simulator used for the current simulation.

PySpice will try to incrementally provide a generic interface in the future.