.. include:: /project-links.txt .. include:: /abbreviation.txt .. getthecode:: raw-spice.py :language: python3 :hidden: :notebook: ========================================= Pass Raw Spice Definitions to a Netlist ========================================= .. code-block:: py3 #Fixme: to be documented, improved This example shows how to pass raw spice definitions to a netlist. .. code-block:: py3 import PySpice.Logging.Logging as Logging logger = Logging.setup_logging() from PySpice.Spice.Netlist import Circuit from PySpice.Unit import * Let define a circuit. .. code-block:: py3 circuit = Circuit('Test') Pass raw Spice definitions to a circuit, aka netlist, content is inserted at the beginning of the netlist. .. code-block:: py3 circuit.raw_spice = ''' Vinput in 0 10V R1 in out 9kOhm ''' Pass element parameters as raw Spice, content is concatenated with `R2 out 0` .. code-block:: py3 circuit.R(2, 'out', 0, raw_spice='1k') print(circuit) .. code-block:: none .title Test Vinput in 0 10V R1 in out 9kOhm R2 out 0 1k