SLiCAPrst.py

Created on Sat Jun 10 17:14:37 2023

@author: anton

RSTcreateCSVtable(name, headerList, linesList, position=0, unitpos=None, label='')

Creates and returns an RST table snippet that can be included in a ReStructuredText document.

A label can be given as reference. The name is displayed as caption.

Parameters
  • name (str) – Table caption

  • headerList (list with strings) – List with column headers.

  • linesList (list) – List with lists of table data for each table row

  • unitpos (int, str) – Position of column with units (will be typesetted with mathrm)

  • label (str) – Table reference label

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

coeffsTransfer2RST(transferCoeffs, label='', append2caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReStuctrutedText 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.

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document.

Return type

str

dcvarContribs2RST(resultObject, label='', append2caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReStructuredText 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 ‘Source 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 ‘’

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

elementData2RST(circuitObject, label='', append2caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReStructuredText 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 ‘’

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

eqn2RST(LHS, RHS, units='', position=0, label='')

Returns an RST 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 (str) – Reference label

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document.

Return type

str

eqn2RSTinline(LHS, RHS, units='')

Returns an RST snippet for inline subsitution of an equation in a ReStructuredText 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

RST snippet for inline substitution in a ReStructuredText document.

Return type

str

expr2RST(expr, units='')

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

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

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

Returns

RST snippet for inline substitution in a ReStructuredText document.

Return type

str

makeSpaces(n)

Creates and returns a string with <n> spaces.

Parameters

n (int) – Number of spaces

Returns

String with <n> spaces

Return type

str

matrices2RST(Iv, M, Dv, position=0, label='')

Returns an RST 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.

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document.

Return type

str

netlist2RST(netlistFile, lineRange=None, firstNumber=None, position=0)

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

Parameters
  • netlistFile – Name of the netlist file that resides in the ini.circuitPath 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

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

noiseContribs2RST(resultObject, label='', append2caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReStructuredText 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 ‘’

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

numRoots2RST(roots, Hz, pz)

Returns a list of lists with row data for the creation of an RST table with numeric poles or zeros.

Parameters
  • roots (List with (complex) numbers) – List with numeric roots

  • Hz (Bool) – True if frequencies must be displayed in Hz, False for rad/s.

  • pz (str) – Identifier prefix: ‘p’ ofr poles ‘z’ for zeros.

Returns

List of lists with data of poles or zeros

Return type

List of lists

parDefs2RST(circuitObject, label='', append2caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReSturucturedText 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 (str) – Reference to this table, defaults to ‘’

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

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReSturucturedText document

Return type

str

params2RST(circuitObject, label='', append2caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReStructuredText 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 (str) – Reference to this table, defaults to ‘’

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

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

pz2RST(resultObject, label='', append2caption='', position=0)

Creates and return an RST table with poles, zeros, or poles and zeros that can be included in a ReStructuredText 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 ‘’

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document

Return type

str

save2RSTinline(vardict)

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

<ini.sphinxPath>SLiCAPdata/RSTsubstitutions.rst

Parameters

vardict (dict) – Dictionary with inline RST subsitutions

Returns

None

Return type

NoneType

saveRST(RST, fileName)

Saves an RST snippet for inclusion in a ReStructuredText document in:

<ini.latexPath>SLiCAdata/<fileName>.rst

Parameters
  • RST (str) – RST snippet.

  • fileName (str) – File name

Returns

None

Return type

NoneType

slicap2RST(scriptFile, firstLine=None, lineRange=None)

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

Parameters
  • scriptFile (str) – Name of the script file that resides in the ini.projectPath 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

RST snippet to be included in a ReStructuredText document

Return type

str

specs2RST(specs, specType='', label='', caption='', position=0)

Creates and returns an RST table snippet from a list with specItem objects. This table snippet can be included in a ReStructuredText document.

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

  • specType – Type of specification.

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

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

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document.

Return type

str

stepArray2rst(stepVars, stepArray, label='', caption='', position=0)

Creates and returns an RST table snippet that can be included in a ReStructuredText 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

  • position (int) – Number of spaces indention from the left margin, defaults to 0

Returns

RST snippet to be included in a ReStructuredText document.

Return type

str

symRoots2RST(roots, Hz, pz)

Returns a list of lists with row data for the creation of an RST table with symbolic poles or zeros.

Parameters
  • roots (List with sympy expressions) – List with symbolic roots

  • Hz (Bool) – True if frequencies must be displayed in Hz, False for rad/s.

  • pz (str) – Identifier prefix: ‘p’ ofr poles ‘z’ for zeros.

Returns

List of lists with data of poles or zeros

Return type

List of lists