PyQSPICE: A Python scripting interface for QSPICE

For those of us who are Python users, I would like to highlight a new tool called PyQSPICE. It works with QSPICE’s command-line interface to load QSPICE simulation results into memory for plotting in Python.

This is an open-source project hosted on GitHub. It is not supported by the QSPICE team.

GitHub - Qorvo/PyQSPICE: Python Interface for QSPICE

9 Likes

Hi Jeff.

For me this is very interesting information. Maybe I can get EAGLE to show an output window for QSpice instead of a PCB.

Thank you very much. Tom

Hi Jeff

My colleague told me that there is another :thinking: “PyQSPICE”.
GitHub - nunobrum/PyQSPICE: Python Library to operate with QSpice and read simulation output files
The author is the same person who wrote “PyLTspice”.
Is this the same one you mentioned?

1 Like

They are two different projects. There’s more discussion on the one I mentioned here:

I’m glad there is enough interest in the concept to drive two different developments!

2 Likes

Hi,

I’ve got an offline DM Q&A regarding this Python module and here’s summary which may help someone who gets the same questions.

Q:: Any good documentation?
A:: Sorry…not yet.

  • QuickStart has quick comments before lines.
  • The main module has an explanation in front of each method.

Q:: How to tweak a parameter, run a sim and repeat/loop?
A:: This example is running 2 sims from one next list by changing the netlist “.cir” file with Python regular expression “re” module.


Q:: Why “SJIS” encoding, in the Python module?
A:: See this discussion. The QSPICE uses “Latin-1 Supplement” and many file-encoding judgement routines (checked a couple of standalone encoding detection programs) think it “Shift JIS”, with a probability view point. Just to avoid Python error message, I use the “SJIS” encoding and I know I’m dealing with a file of “Latin-1 Supplement”.

masashi

PyQSPICE is very good and I have used it already.
How do I print the dc operating points if I am using PyQSPICE?? I do not see that function in the PyQSPICE class and was hoping if you could please help with that? It will be a good starting point to see dc operating points of all nodes (and currents)
before the PSRR circuit is simulated (or any other AC sim is triggered)

2 Likes

I run a quick trial and I see PyQSPICE can support your “.OP” needs.

I’m on the road and please wait for me next week :slight_smile:
I’ll delete this post when I update PyQSPICE for the “.OP”, by replacing my post with the detail how to handle “.OP” on PyQSPICE.


I believe I made an over commitment, it’s the Thanks-Giving week here in USA…Within Nov, I’ll try to get it updated for “.OP”.

1 Like

thank you masashi! I look forward to your uprate on how to use .op within PyQSPICE and getting a text file with outputs printed for the operating point (just like what one can see in the terminal).

Please check updated ver.2023.11.29 PyQSPICE.

  • It supports .OP result reading. To make this happens, PyQSPICE now reads “.cir” netlist and extract nodes and elements. Not all elements implemented (logic gates, AD/DA converters), voltage nodes completely sandwiched by those elements will be ignored…for now.
  • Plot setting lines are consolidated into a method and now we can make our main code clean.
    Only the code of “tests/50_OP” is clean for plotting, will update older “tests” examples step-by-step.
  • The example “tests/50_OP” is showing simple results but it is reading more info from the “.OP” run. Please try “print(df)” to see all the info this new version PyQSPICE reading.