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
    • 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
    • latexPath : Directory with csv files for HTML tables
    • mathmlPath : Directory for mathML output
    • imgPath : Directory with images for HTML output
    • defaultLib : Directory with SLiCAP basic library files
    • docPath : Directory with html documentation
  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
    • simplify : True: simplify transfer functions
    • normalize: True: normalize transfer functions: lowest order coefficient of the Laplace variable will be normalized to unity.
    • factor: True: Try to factor the numerator and denominator of expressions.
    • MaximaMatrixDim : Maximum dimension of a square matrix to be passed to Maxima
  5. Display settings
    • disp : Number of digits for displaying floats on html pages
    • mathml:
      • True : math in mathml in html pages
      • False : math in latex in html pages and MathJaX cloud
    • language: language for error messages
  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
    • axisXscale : default x-axis scale type
    • axisYscale : default y-axis scale type
    • 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
Hz = None

(Bool)

  • True: frequency in Hz and phase in degrees
  • False : frequency in radians/s and phase in radians

Defaults to True

Laplace = None

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

MaximaMatrixDim = None

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

MaximaTimeOut = None

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

axisXscale = None

Default x axis type (str) for plots. Can be ‘lin’ or ‘log’. Defaults to ‘lin’.

axisYscale = None

Default y axis type (str) for plots. Can be ‘lin’ or ‘log’. Defaults to ‘lin’.

circuitPath = None

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

csvPath = None

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

defaultColors = None

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

defaultLib = None

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

defaultMarkers = None

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

disp = None

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

docPath = None

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

dump()

Prints the global variables and their values.

factor = None

(Bool) setting for factorization of rational functions.

  • True : factorization
  • False : no factorization
figureAxisHeight = None

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

figureAxisWidth = None

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

figureFileType = None

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

frequency = None

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

gainColors = None

(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 = None

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

htmlLabels = None

(dict) with key-value pairs:

  • key: label name (str)
  • value” label object (SLiCAPhtml.label)

Defaults to: None.

htmlPage = None

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

htmlPages = None

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

htmlPath = None

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

htmlPrefix = None

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

imgPath = None

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

installPath = None

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

lastUpdate = None

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

latexPath = None

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

legendLoc = None

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 = None

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

ltspice = None

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 prefix will be followed by the name of the schematic file.

mathml = None

(Bool) setting for rendering math in html pages.

  • True : math in mathml in html pages
  • False : math in latex in html pages and MathJaX cloud
mathmlPath = None

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

maxRecSubst = None

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

maxSolve = None

(Bool)

  • True: use Maxima CAS for solving matrix equations
  • False : use Sympy for solving matrix equations
maxima = None

MSWindows command for starting Maxima.

Defaults to SLiCAPconfig.MAXIMA

netlist = None

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’
normalize = None

(Bool) setting for normalization of rational functions.

  • True : normalization
  • False : no normalization
notebook = None

(Bool)

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

Defaults to False.

plotFontSize = None

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

projectPath = None

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

simplify = None

(Bool) setting for simplification of expressions.

  • True : simplification
  • False : no simplification
stepFunction = None

(Bool)

  • True: use Sympy.lambify for parameter stepping
  • False : substitute step parameters in matrix
tableFileType = None

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

txtPath = None

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.