SLiCAP.py

Main module for running SLiCAP from a console or from within a Python IDE.

When working with Jupyter notebooks the main imort module is SLiCAPnotebook.py. It will import SLiCAP.py and some extra modules for displaying LaTeX, SVG and RST in the Jupyter notebooks.

Help()

Opens the SLiCAP HTML documentation in the default browser.

Example:

>>> import SLiCAP as sl
>>> # Display the SLiCAP HTML help in your default browser:
>>> sl.Help()
initProject(name, notebook=False, report_dirs=True, author=None)

Initializes a SLiCAP project.

  • Copies the directory structure from the templates subdirectory to the project directory in cases it has not yet been created.

  • Creates index.html in the html directory with the project name in the title bar

  • Compiles the system libraries

  • Creates or updates ‘SLiCAPconfigure.py’ in the project directory

Parameters:
  • name (str) – Name of the project: appears on the main html index page.

  • notebook (Bool) – True if SLiCAP runs from a Jupyter notebook, defaults to False

  • create_dirs (Bool) – True will create but not overwrite the SLiCAP directory structure. Defaults to True

  • author (str, NoneType) – Project author, written to the ‘SLiCAP.ini’ [project] section. None (default) keeps the existing value.

Returns:

None

Return type:

NoneType

Example:

>>> import SLiCAP as sl 
>>> # At the first run it will create a 'SLiCAP.ini' file in the SLiCAP 
>>> # home folder:  '~/SLiCAP/'. 
>>> # To this end it searches for installed applications. 
>>> # Under MSwindows this may take a while.
>>> sl.initProject('my first SLiCAP project')
>>> # At the first run this will create a 'SLiCAP.ini' file in the SLiCAP 
>>> # project folder:  './'. Once created it will only reset some values.
>>> # This function also resets the netlist parser and (re)creates the 
>>> # system library objects.
>>> sl.ini.dump() 
>>> # Prints the SLiCAP global settings obtained from both ini files.
startSchematic(config=None, file=None)

Launch the SLiCAP schematic capture GUI as a separate process.

The GUI runs independently — this call returns immediately and does not block the Python session or Jupyter notebook.

The editor always opens in schematic-only mode (no Instruction/Log panels); analysis is driven from the Python session.

Parameters:
  • config (str or None) –

    Capture mode. Sets the symbol library and restricts which schematic type may be created or opened:

    • None (default): both SLiCAP and NGspice schematics allowed; the symbol set is chosen per schematic.

    • 'basic': SLiCAP only, basic symbol library (Symbols.svg only). Intended for external callers that embed the editor and want only the standard set. “New NGspice Schematic” is disabled.

    • 'slicap': SLiCAP only, full symbol library (all SVG files in the system symbols directory). “New NGspice Schematic” is disabled.

    • 'ngspice': NGspice only, NGspice symbol library. “New SLiCAP Schematic” is disabled.

    In a restricted mode File → Open also lists only files of the permitted type.

  • file (str or None) – Path to a schematic file to open at startup (.slicap_sch for SLiCAP, .spice_sch for NGspice). The schematic type is inferred automatically from the extension. A canvas is shown only when a file is given; otherwise the editor opens empty and the user creates or opens a schematic from the File menu (in the config mode).

Example:

>>> import SLiCAP as sl
>>> sl.initProject("My Design")
>>> sl.startSchematic()                                  # empty; user picks type via File menu
>>> sl.startSchematic(config='slicap')                   # SLiCAP mode, full library
>>> sl.startSchematic(config='ngspice')                  # NGspice mode
>>> sl.startSchematic(config='basic')                    # SLiCAP mode, basic symbols
>>> sl.startSchematic(file='sch/mydesign.slicap_sch')    # open SLiCAP file
>>> sl.startSchematic(file='sch/mydesign.spice_sch')     # open NGspice file