SLiCAPlatex.py

SLiCAP functions for generating snippets that can be stored as LaTeX files and included in other LaTeX files.

IMPORTANT: In future versions of SLiCAP, these functions will be replaced with a latex formatter.

coeffsTransfer2TEX(transferCoeffs, label='', append2caption='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document.

The table comprises the normalized coefficients of the numerator and the denominator as listed in transferCoeffs.

The normalization factor (Gain) is added to the caption.

A label can be given as reference.

Parameters:
  • transferCoeffs (list) –

    List with:

    1. gain

    2. list with numerator coefficients

    3. list with denominator coefficients

    Can be obtained with coeffsTransfer()

  • label (str) – Reference lable for this table

  • append2caption (str) – String that will be appended to the caption.

Returns:

RST snippet to be included in a ReStructuredText document.

Return type:

str

dcvarContribs2TEX(resultObject, append2caption='', label='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document.

The table comprises the values of the dcvar sources and their contributions to the detector-referred dc variance and the source-referred dc variance. The latter only if a signal source has been specified.

The caption reads ‘DC variance contributions ‘<append2caption>.

A label can be given as reference.

Parameters:
  • resultObject (SLiCAP.SLiCAPprotos.allResults) – SLiCAP execution result object.

  • label (str) – Reference to this table, defaults to ‘’

  • append2caption (str) – Test string that will be appended to the caption, Defaults to ‘’

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

elementData2TEX(circuitObject, label='', append2caption='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document. The table comprises the data of all elements of the expanded nelist of <circuitObject>.

The caption reads ‘Expanded netlist of: <circuitObject.title>. <append2caption>.

A label can be given as reference.

Parameters:
  • circuitObject (SLiCAP.SLiCAPprotos.circuit) – SLiCAP circuit object.

  • label (str) – Reference to this table, defaults to ‘’

  • append2caption (str) – Test string that will be appended to the caption, Defaults to ‘’

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

eqn2TEX(LHS, RHS, units='', label='', multiline=0)

Returns a LaTeX snippet of a displayed equation with dimension and reference label.

Parameters:
  • RHS (str, sympy.Expression, or sympy.Symbol) – Right hand side of the equation.

  • LHS (str, sympy.Expression, or sympy.Symbol) – Left hand side of the equation.

  • units (str) – Dimension

  • label (int) – Reference label

  • multiline – Number of sub-expressions per line, defaults to 0 (single-line equation)

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

eqn2TEXinline(LHS, RHS, units='')

Returns a LaTeX snippet for inline subsitution of an equation in a LaTeX document.

Parameters:
  • LHS (sympy.Expression, str) – Left hand side of the equation.

  • RHS (sympy.Expression, str) – Right hand side of the equation.

  • units (str) – units or dimension, defaults to ‘’

Returns:

LaTeX snippet for inline substitution

Return type:

str

expr2TEX(expr, units='')

Returns a LaTeX snippet for inline subsitution of an expression in a LaTeX document.

Parameters:
  • expr (sympy.Expression) – sympy expression for inline substitution.

  • units (str) – units or dimension, defaults to ‘’

Returns:

LaTeX snippet for inline substitution

Return type:

str

matrices2TEX(Iv, M, Dv, label='')

Returns a LaTeX snippet of the matrix equation Iv = M.Dv,

A label can be given for reference.

Parameters:
  • Iv (sympy.Matrix) – (n x 1) matrix with independent variables.

  • M (sympy.Matrix) – (n x n) matrix.

  • Dv (sympy.Matrix) – (n x 1) matrix with dependent variables.

Returns:

LaTeX snippet of the matrix equation.

Return type:

str

netlist2TEX(netlistFile, lineRange=None, firstNumber=None)

Converts a SLiCAP netlist into a LaTeX string that can be included in a LaTeX document and returns this string.

Parameters:
  • netlistFile – Name of the netlist file that resides in the ini.cir_path directory

  • lineRange (str) – Range of lines to be displayed; e.g. ‘1-7,10,12’. Defaults to None (display all lines)

  • firstNumber (int, float, str) – Number of the first line to be displayed

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

noiseContribs2TEX(resultObject, label='', append2caption='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document.

The table comprises the values of the noise sources and their contributions to the detector-referred noise and the source-referred noise. The latter only if a signal source has been specified.

The caption reads ‘Noise contributions. ‘<append2caption>.

A label can be given as reference.

Parameters:
  • resultObject (SLiCAP.SLiCAPprotos.allResults) – SLiCAP execution result object.

  • label (str) – Reference to this table, defaults to ‘’

  • append2caption (str) – Test string that will be appended to the caption, Defaults to ‘’

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

parDefs2TEX(circuitObject, label='', append2caption='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document. The table comprises the parameter definitions of <circuitObject>.

The caption reads ‘Parameter defnitions in: : <circuitObject.title>. <append2caption>.

A label can be given as reference.

Parameters:
  • circuitObject (SLiCAP.SLiCAPprotos.circuit) – SLiCAP circuit object.

  • label – Reference to this table, defaults to ‘’

  • append2caption (str) – Test string that will be appended to the caption, Defaults to ‘’

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

params2TEX(circuitObject, label='', append2caption='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document. The table comprises a column with names of undefined parameters of <circuitObject>.

The caption reads ‘Undefined parameters in: : <circuitObject.title>. <append2caption>.

A label can be given as reference.

Parameters:
  • circuitObject (SLiCAP.SLiCAPprotos.circuit) – SLiCAP circuit object.

  • label – Reference to this table, defaults to ‘’

  • append2caption (str) – Test string that will be appended to the caption, Defaults to ‘’

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

pz2TEX(resultObject, label='', append2caption='')

Creates and return a LaTeX table with poles, zeros, or poles and zeros that can be included in a LaTeX document. If the data type is ‘pz’ the zero- frequency value of the gain will be displayed in the caption of the table.

The caption reads as follows:

  • data type = ‘poles’: ‘Poles of: <resultObject.gainType>. <append2caption>’

  • data type = ‘zeros’: ‘Zeros of: <resultObject.gainType>. <append2caption>’

  • data type = ‘pz’: ‘Poles and zeros of: <resultObject.gainType>; DC value = <resultObject,DCvalue>. <append2caption>.’

A label can be given as reference.

Parameters:
  • label (str) – Reference to this table, defaults to ‘’

  • append2caption (str) – Test string that will be appended to the caption, Defaults to ‘’

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

save2TEXinline(vardict)

Saves the key-value pairs of ‘vardict’ in the CSV file:

<_TEXPATH>SLiCAPdata/TEXsubstitutions.tex

Parameters:

vardict (dict) – Dictionary with inline LaTeX subsitutions

Returns:

None

Return type:

NoneType

saveTEX(TEX, fileName)

Saves a LaTeX snippet for inclusion in a LaTeX file into:

<_TEXPATH>SLiCAdata/<fileName>.tex :param TEX: LaTeX snippet. :type TEX: str

Parameters:

fileName (str) – File name

Returns:

None

Return type:

NoneType

slicap2TEX(scriptFile, firstNumber=None, firstLine=None, lineRange=None)

Converts a SLiCAP script file into a LaTeX string that can be included in a LaTeX document and returns this string.

Parameters:
  • scriptFile (str) – Name of the script file that resides in the ini.project_path directory

  • lineRange (str) – Range of lines to be displayed; e.g. ‘1-7,10,12’. Defaults to None (display all lines)

  • firstNumber (int, float, str) – Number of the first line to be displayed

Returns:

LaTeX snippet to be included in a LaTeX document

Return type:

str

specs2TEX(specs, specType, label='', caption='')

Creates and returns a LaTeX table with specifications that can be included in a LaTeX document.

If a list with specification types is provided, it creates tables for specified types only. By default, tables for all types will be created.

Parameters:
  • specs (list) – List with spec items.

  • specType (str) – Type of specification.

  • label (str) – Reference to this table, defaults to ‘’.

  • caption (str) – Caption of the table, defaults to ‘’.

Returns:

LaTeX snippet to be included in a LaTeX document.

Return type:

str

stepArray2TEX(stepVars, stepArray, label='', caption='')

Creates and returns a LaTeX table snippet that can be included in a LaTeX document.

The table shows the step variables and their values as defined for array-type stepping of instructions.

Parameters:
  • stepVars (List) – List with step variables for array type stepping (SLiCAPinstruction.instruction.stepVars)

  • stepArray (list) – List of lists: (SLiCAPinstruction.instruction.stepArray)

  • label (str) – Reference lable for this table

  • caption (str) – Table caption

Returns:

TEX: LaTeX table snippet.

Return type:

str