SLiCAPhtml.py — SLiCAP 3.5.7 documentation

# SLiCAPhtml.py

SLiCAP module with functions for creating a basic HTML report.

coeffsTransfer2html(transferCoeffs, label='', labelText='')

  Displays the gain factor and the coefficients of the numerator and the denominator of a transfer function on the active html page.

  Parameters:

    - transferCoeffs (list) – Result of coeffsTransfer() function

    - label (str) – ID of the label assigned to these tables; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

csv2html(fileName, label='', separator=',', caption='')

  Displays the contents of a csv file as a table on the active HTML page. The file must be located in the ini.csv_path folder.

  Parameters:

    - fileName (str) – Name of the csv file file

    - label (str) – ID of the label assigned to this table.

    - separator (str) – Field separator for this csv file; defaults to ‘,’.

    - caption (str) – Caption for this table.

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

dcVar2html(instObj, label='', labelText='')

  Displays the reults of a dc variance analysis on the active html page.

  Not implemented with parameter stepping.

  Parameters:

    - instObj (SLiCAP.protos.allResults) – Results of an instruction with data type ‘dcvar’.

    - label (str) – ID of the label assigned to these tables; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

elementData2html(circuitObject, label='', caption='')

  Displays a table with element data on the active html page:

  - refDes

  - nodes

  - referenced elements

  - element parameters with symbolic and numeric values

  Parameters:

    - circuitObject (SLiCAPprotos.circuit) – SLiCAP circuit object of which the element data will be displayed on the HTML page.

    - label (str) – Label that will be assigned to this table.

    - caption (str) – Caption that will be placed with this table.

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

eqn2html(arg1, arg2, units='', label='', labelText='')

  Displays an equation on the active HTML page’.

  Parameters:

    - arg1 (str, sympy.Symbol, sympy.Expr) – left hand side of the equation

    - arg2 (str, sympy.Symbol, sympy.Expr) – right hand side of the equation

    - label (str) – ID of the label assigned to this equation; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

expr2html(expr, units='')

  Inline display of an expression optional with units.

  Parameters:

    - expr (sympy.Expr) – Expression

    - units (str) – Units for this expression, defaults to ‘’.

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

fig2html(figureObject, width, label='', caption='')

  Copies the image file to the ‘img.’ subdirectory of the ‘html/’ directory set by HTMLPATH in SLiCAPini.py and creates a link to this file on the active html page.

  Parameters:

    - figureObject (SLiCAPplots.figure) – SLiCAP figure object generated with a plot function.

    - width (int) – Width of the figure in pixels

    - label (str) – ID of the label assigned to these tables; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

file2html(fileName)

  Writes the contents of a file to the active html page. The file must be located in the ini.txt_path.

  Parameters:

    fileName (str) – Name of the file

  Returns:

    html code that will be inserted in the HTML file

  Return type:

    str

head2html(headText, label='')

  Places a level 2 header on the active HTML page.

  Parameters:

    - headText (str) – header text

    - label (str) – ID of a labelt to be assigned to this header.

  Returns:

    HTML string of this header

  Return type:

    str

head3html(headText, label='')

  Places a level 3 header on the active HTML page.

  Parameters:

    - headText (str) – header text

    - label (str) – ID of a labelt to be assigned to this header.

  Returns:

    HTML string of this header

  Return type:

    str

href(label, fileName='')

  Returns the html code for a jump to a label ‘labelName’. This label can be on any page. If referring backwards ‘fileName’ can be detected automatically. When referring forward ‘fileName’ must be the name of the file that will be created later. Run a project 2 times without closing it after the first run, automaitcally detects all labels.

  Parameters:

    - label (str) – ID of the label.

    - fileName (str) – Name of the HTML page for inserting the link.

  Returns:

    HTML code that will be inserted

  Return type:

    str

htmlElValue(cir, elName, param='value', numeric=False)

  Returns code for inline display of value of element ‘elName’ from instruction ‘instr’.

  Parameters:

    - instr (SLiCAPinstruction.instruction) – Instruction that holds the parameter definition

    - elName (string) – Element identifier

    - param (string) – Element parameter name

    - numeric –

      - True: full recursive substitution of circuit parameters.

      - False: value or expression of the parameter given with the element.

      Defaults to False

  Returns:

    HTML code for the element value

  Return type:

    string

htmlLink(address, text)

  Returns the html code for placing a link on an html page with text2html().

  Parameters:

    address (str) – link address

  Returns:

    HTML code

  Return type:

    str

htmlPage(pageTitle, index=False, label='')

  Creates an HTML page with the title in the title bar.

  If index==True the page will be used as new index page, else a link to this page will be placed on the current index page.

  :param pageTitle:Title of the page. :type param: str

  Parameters:

    - index (Bool) – True or False

    - label (str) – ID of a label to be assigned to this page.

  Returns:

    None

  Return type:

    NoneType

htmlParValue(cir, parName)

  Returns code for inline display of parameter ‘parName’ from instruction ‘instr’. :param cir: Circuit object that holds the parameter definition :type instr: SLiCAPprotos.circuit

  Parameters:

    parName (string) – Name of the parameter

  Returns:

    HTML code for the parameter value

  Return type:

    string

img2html(fileName, width, label='', caption='')

  Places an image from file ‘fileName’ on the active html page.

  Copies the image file to the ‘img.’ subdirectory of the ‘html/’ directory and creates a link to this file on the active html page.

  Parameters:

    - fileName (str) – Name of the image file, must be located in the ini.img_path folder.

    - width (int) – With of the image in pixels

    - label (str) – ID of the label to be assigned to this image, defaults to ‘’.

    - caption (str) – Caption for this image; defaults to ‘’.

  Returns:

    file path for this image.

  Return type:

    str

lib2html(fileName, label='', lib='user')

  Places the contents of the library file ‘fileName’ on the active HTML page.

  The library is assumed to be located in the user library path.

  Parameters:

    - fileName (str) – Name of the library file

    - label (str) – Label ID for this object.

    - lib (str) – Library path, can either be “user”, or “system”.

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

links2html()

  Returns the HTML code for placing links to all labeled HTML objects.

  Links will be grouped as follows:

  1. Links to headings

  2. Links to circuit data and imported tables

  3. Links to figures

  4. Links to equations

  5. Links to analysis results (from noise2html, pz2html, etc.)

  Returns:

    html: HTML string that will be placed on the page.

  Return type:

    str

matrices2html(results, label='', labelText='')

  Displays the MNA equation on the active HTML page.

  Parameters:

    - instrObj (SLiCAPprotos.allResults) – Results of instruction with data type matrix.

    - label (str) – ID of the label assigned to this equation; defaults to ‘’.

    - labelText (str) – Label text displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

monomial_coeffs2html(coeff_dict, label='', labelText='')

netlist2html(fileName, label='', labelText='')

  Places the netlist of the circuit file ‘fileName’ on the active HTML page. The file must be located in the ini.cir_path folder.

  Parameters:

    - fileName (str) – Name of the netlist file

    - label (str) – Label ID for this object.

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

noise2html(instObj, label='', labelText='')

  Displays the reults of a noise analysis on the active html page.

  Not implemented with parameter stepping.

  Parameters:

    - instObj (SLiCAP.protos.allResults) – Results of an instruction with data type ‘noise’.

    - label (str) – ID of the label assigned to these tables; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

params2html(circuitObject, label='', caption='')

  Displays a table with circuit parameters, their definitions and numeric values on the actibe htmal page.

  Parameters:

    - circuitObject (SLiCAPprotos.circuit) – SLiCAP circuit object of which the element data will be displayed on the HTML page.

    - label (str) – Label that will be assigned to this table.

    - caption (str) – Caption that will be placed with this table.

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

printHTMLinfo()

  Prints current HTML pages and labels to stdout

  Returns:

    None

  Return type:

    NoneType

pz2html(instObj, label='', labelText='')

  Displays the DC transfer, and tables with poles and zeros on the active HTML page.

  Not implemented with parameter stepping.

  Parameters:

    - instObj (SLiCAP.protos.allResults) – Results of an instruction with data type ‘poles’, ‘zeros’ or ‘pz’.

    - label (str) – ID of the label assigned to these tables; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

stepArray2html(stepVars, stepArray, label='', labelText='')

  Displays the step array on the active HTML page.

  Parameters:

    - stepVars – List with step variables

    - stepArray (list) – List with lists for step data

    - label (str) – ID of the label assigned to these tables; defaults to ‘’.

    - labelText (str) – Label text to be displayed by links2html(); defaults to ‘’

  Returns:

    HTML string that will be placed on the page.

  Return type:

    str

text2html(txt)

  Places txt on the active HTML page.

  Parameters:

    txt (str) – Text to be placed on the HTML page

  Returns:

    HTML string placed on the page: “<p>” + txt + “</p>n””

  Return type:

    str