SLiCAPini.py

SLiCAP initialization module, imports external modules and defines settings.

Imported by the module SLiCAini.py

Help()

Opens the HTML documentation in the default browser.

class settings

A class for global variables.

The following globals are defined:

  1. path settings

    • installPath : Directory with SLiCAP modules files

    • userPath : Directory with SLiCAP libraries and examples

    • projectPath : Directory with SLiCAP project files

    • htmlPath : Directory with SLiCAP HTML output

    • circuitPath : Directory with SLiCAP project circuit files

    • libraryPath : Directory with SLiCAP user libraries

    • txtPath : Directory with text files for HTML output

    • csvPath : Directory with csv files for HTML tables

    • sphinxPath : Directory for sphinx output

    • mathmlPath : Directory for mathML output

    • imgPath : Directory with images for HTML output

    • defaultLib : Directory with SLiCAP basic library files

    • docPath : Directory with html documentation

    • ngspiceCMD : Command to start ngspice

    • kicadPath : KiCad install directory

    • inkscapePath : Inkscape install directory

      MSWindows : “~Spice64binngspice.exe”” Linux : “ngspice”

  2. active HTML pages and active HTMLfile prefix

    • htmlIndex : Active HTML index page

    • htmlPage : Active HTML page

    • htmlPrefix : Active HTML prefix

  3. HTML labels and page names

    • htmlLabels : Dict with HTML labels:

      • key = labelName : name of the label

      • value = pageName : page of the label

    • htmlEqLabels : Dict with HTML equation labels:

      • key = labelName : name of the label

      • value = pageName : page of the label

    • htmlPages : List with names of HTML pages

  4. Math settings

    • maxSolve:

      • True : use Maxima for solving equations

      • False : use Sympy for solving equations

    • stepFunction:

      • True: use Sympy.lambify for parameter stepping

      • False : substitute step parameters in matrix

    • Hz:

      • True: frequency in Hz and phase in degrees

      • False : frequency in radians/s and phase in radians

    • Laplace : Parameter used for Laplace variable

    • frequency : Parameter used for frequency variable

    • maxRecSubst : Maximum number of recursive substitutions

    • MaximaMatrixDim : Maximum matrix dimension for maxima.newdet()

    • MaximaTimeOut : Maximum calculation time for Maxima

    • assumePosMaxVars : Assume postive parameters in Maxima expressions

    • lambdifyTool : “numpy” or “mpmath”; latter one in case of overflow

  5. Display settings

    • disp : Number of digits for displaying floats on html pages

    • mathml:

  6. Plot settings

    • figureAxisHeight : Height of the axis in inches (72dpi), pole-zero and polar plots are square and have their height set to their width.

    • figureAxisWidth : Width of an axis in inches (72dpi)

    • defaultColors : List with matplotlib color names for param. stepping

    • gainColors : dict with color names for gain types:

      • key = gainType

      • value = matplotlib color name

    • defaultMarkers : list with matplotlib markers

    • tableFileType : file type for saving traces as tables

    • figureFileType : graphic file type for saving plots

    • legendLoc : default plot legend location

    • plotFontSize : default plot font size

  7. Jupyter notebook settings

    • notebook: True adapts HTML math return variables to markdown format required by Jupyter notebook

  8. Netlister settings:

    • ltspice : os command for batch netlist creation with LTspice

    • netlist : os command for batch netlist creation with gschem or lepton-eda

  9. Maxima command setting (only required for MSWindows)

    • maxima: command to start maxima under MSWindows

  10. Maxima execution method:

    • socket:

      • True : maxima runs in a socket (passes maxima messages)

      • False : maxima runs as a subprocess (ignores maxima messages)

    • HOST = 127.0.0.1 : Standard loopback interface address (localhost)

    • PORT = 53118 : Port to listen on (non-privileged ports are > 1023)

    • maximaHandler : Maxima client process handler

HOST

Standard loopback interface address (localhost)

Hz

(Bool)

  • True: frequency in Hz and phase in degrees

  • False : frequency in radians/s and phase in radians

Defaults to True

Laplace

Symbol (sympy.core.symbol.Symbol) used for the Laplace variable. Defaults to sp.Symbol(‘s’).

MaximaMatrixDim

Maximum size of sa square matrix to be passed to maxima.

MaximaTimeOut

Maximum time in seconds (int) for subprocess to run Maxima. Defaults to 60.

PORT

Port to listen on (non-privileged ports are > 1023)

assumePosMaxVars

Assume positive parameters in Maxima expressions. In many cases this prevents Maxima from asking questions about the sign of parameters.

circuitPath

Path (str) to circuit files, will be set by SLiCAP.initProject(); defaults to None.

csvPath

Path (str) to .csv files, will be set by SLiCAP.initProject(); defaults to None.

defaultColors

(tuple) with matplotlib color names (str) for traces in plots. Defaults to (‘r’,’b’,’g’,’c’,’m’,’y’,’k’)

defaultLib

Default library path of SLiCAP (str), defaults to None.

defaultMarkers

(list) with matplotlib names of markers used for traces in plots. Defaults to: [‘’].

disp

Number of digits ()*int* for displaying floats on html pages. Defaults to 4.

docPath

Path with HTML documentation (str), defaults to None.

dump()

Prints the global variables and their values.

figureAxisHeight

Height in inches (int, float) of an axis system in a figure. Defaults to 5.

figureAxisWidth

Width in inches (int, float) of an axis system in a figure. Defaults to 7.

figureFileType

File type (str) for saving plots. Defaults to ‘svg’.

frequency

Symbol (sympy.core.symbol.Symbol) used for frequency. Defaults to sp.Symbol(‘f’).

gainColors

(dict) with key-value pairs for the color of traces for different gain types:

  • key: gain type: (str)

  • value: matplotlib color name (str) for traces in plots.

Defaults to: {‘gain’: ‘b’, ‘asymptotic’: ‘r’, ‘loopgain’: ‘k’, ‘direct’: ‘g’, ‘servo’: ‘m’, ‘vi’: ‘c’}

htmlIndex

Name (str) of the active html index file. Wiil be set by SLiCAP.initProject(). Defaults to: None.

htmlLabels

(dict) with key-value pairs:

  • key: label name (str)

  • value” label object (SLiCAPhtml.label)

Defaults to: None.

htmlPage

Name (str) of the active html file. Wiil be set by SLiCAP.initProject(). Defaults to: None.

htmlPages

(list) with names of html pages generated in the project. Defaults to: None.

htmlPath

HTML path (str), will be set by SLiCAP.initProject(); defaults to None.

htmlPrefix

Name (str) of athe ctive html prefix (first part of the file name). Wiil be set by SLiCAP.initProject(). Defaults to: None.

imgPath

Path (str), to image files will be set by SLiCAP.initProject(); defaults to None.

inkscapePath

Inkscape install directory; defaults to ‘’.

installPath

Installation path of SLiCAP (str), defaults to None.

kicadPath

KiCad install directory; defaults to ‘’.

lambdifyTool

Tool to be used for sympy.lamddify, can be “numpy” for fast calculation in case of overflow warning choose “mpmath”

lastUpdate

Value (datetime.datetime) of the date and time of the last project update. This is set by SLiCAP.initProject().

latexPath

Path (str) for saving latex files, will be set by SLiCAP.initProject(); defaults to None.

legendLoc

Default legend position (str) in plots. Cab be: ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’, ‘upper center’, ‘lower center’, ‘center left’, ‘center right’, ‘center’ or ‘best’.

Defaults to ‘best’.

libraryPath

Path (str) to library files, will be set by SLiCAP.initProject(); defaults to None.

ltspice

Operating system command prefix for batch generation of a netlist from an LTspice circuit.

Defaults to SLiCAPconfig.LTSPICE

  • Windows: ‘C:/Program Files/LTC/LTspiceXVII/XVIIx64.exe -netlist ‘

  • Linux (Wine): ‘wine ~/.wine/drive_c/ProgramFiles/LTC/LTspiceXVII/XVIIx64.exe -netlist ‘

This variable is set during installation.

mathmlPath

Path (str) for saving mathml files, will be set by SLiCAP.initProject(); defaults to None.

maxRecSubst

Maximum number (int) of recursive substitutions in equations. Defaults to 10.

maxima

MSWindows command for starting Maxima.

This variable is set during installation.

maximaHandler

Maxima client process handler will be activated at start-up

netlist

gschem or lepton-schematic command for generating a netlist.

Defaults to SLiCAPconfig.NETLIST

For lepton-schematic use ‘lepton-netlist -g spice-noqsi’.

For gschem (deprecated) use: ‘gnetlist -q -g spice-noqsi’.

The netlister: gnet-spice-noqsi.scm must be stored in the gschem or lepton-geda directory with the other netlisters. Commonly used locations are:

  • Linux systems:

    • lepton-eda: /usr/share/lepton-eda/scheme/backend/

    • gschem: /usr/share/gEDA/scheme/

  • MS Windows systems:

    • gschem: ‘C:Program Files (x86)gEDAgEDAsharegEDAscheme’

ngspiceCMD

Command (str) to start ngspice’

notebook

(Bool)

  • True: Places html math output between double dollar signs for correct rendering of latex in Jupyter notebooks.

Defaults to False.

plotFontSize

Value (int) for the font size in plots in points. Defaults to 12.

projectPath

Project path (str), will be set by SLiCAP.initProject(); defaults to None.

socket

Setting for maxima operation method.

sphinxPath

Path (str) for saving sphinx files, will be set by SLiCAP.initProject(); defaults to None.

stepFunction

(Bool)

  • True: Transfer functions are calculated with symbolic step variables The step variable are substituted into these expressions.

  • False: Step variables are substituted directly into the matrix. This method faster for large circuits, or for stepped instructions with multiple step variables.

tableFileType

File type (str) for csv files. Defaults to ‘csv’.

txtPath

Path (str) to text files, will be set by SLiCAP.initProject(); defaults to None.

updatePaths(projectPath)

Updates the file locations according to the project path.

Parameters

projectPath (str) – Path to the active SLiCAP project.

userPath

User path of SLiCAP (str), defaults to None.