wholeboard.ngspice¶
Find and run ngspice, the circuit simulator, and read its results.
ngspice is used in one of three ways, whichever is found first: - the ngspice program (installed by install.sh / Homebrew / the official Windows build), - the ngspice shared library that KiCad bundles for its own simulator (run in a child process through ngspice_shared.py, so a crash cannot take WholeBoard down), - the ngspice inside the Docker image when kicad-cli itself is a Docker wrapper.
Netlists carry their own .control block that runs the analyses and writes ASCII raw files, so every engine is driven the same way: run the netlist in its folder, then read the files.
find(cfg=None)
¶
{"kind": "exe" | "lib" | "docker", "path": ...} or None.
run(netlist, engine, timeout=120, cancel=None)
¶
Run a netlist (with its own .control block) in its folder. Returns ngspice's output.
errors_in(output)
¶
Lines of ngspice output that report real problems.
read_raw(path)
¶
Read an ASCII raw file: {"plot": name, "vars": [names], "data": {name: [values]}}.
AC results keep complex values as (re, im) tuples.