pygsti.report.html

Routines for converting python objects to HTML.

Parallel rountines as latex.py has for latex conversion.

Module Contents

Functions

table(custom_headings, col_headings_formatted, rows, spec)

Create an HTML table

cell(data, label, spec)

Format the cell of an HTML table

list(l, specs)

Convert a list to html.

vector(v, specs)

Convert a 1D numpy array to html.

matrix(m, specs)

Convert a 2D numpy array to html.

value(el, specs[, mathmode])

Convert a floating point or complex value to html.

escaped(txt, specs)

Escape txt so it is html safe.

pygsti.report.html.table(custom_headings, col_headings_formatted, rows, spec)

Create an HTML table

Parameters

custom_headingsNone, dict

optional dictionary of custom table headings

col_headings_formattedlist

formatted column headings

rowslist of lists of cell-strings

Data in the table, pre-formatted

specdict

options for the formatter

Returns

dict : contains keys ‘html’ and ‘js’, which correspond to a html and js strings representing the table

pygsti.report.html.cell(data, label, spec)

Format the cell of an HTML table

Parameters

datastring

string representation of cell content

labelstring

optional cell label, used for tooltips

specdict

options for the formatters

Returns

string

pygsti.report.html.list(l, specs)

Convert a list to html.

Parameters

llist

list to convert into HTML. sub-items pre formatted

specsdictionary

Dictionary of user-specified and default parameters to formatting

Returns

string

html string for l.

pygsti.report.html.vector(v, specs)

Convert a 1D numpy array to html.

Parameters

vnumpy array

1D array to convert into HTML.

specsdictionary

Dictionary of user-specified and default parameters to formatting

Returns

string

html string for v.

pygsti.report.html.matrix(m, specs)

Convert a 2D numpy array to html.

Parameters

mnumpy array

2D array to convert into HTML.

specsdictionary

Dictionary of user-specified and default parameters to formatting

Returns

string

html string for m.

pygsti.report.html.value(el, specs, mathmode=False)

Convert a floating point or complex value to html.

Parameters

elfloat or complex

Value to convert into HTML.

specsdictionary

Dictionary of user-specified and default parameters to formatting

mathmodebool, optional

Whether this routine should generate HTML for use within a math-rendered HTML element (rather than a normal plain-HTML one). So when set to True output is essentially the same as latex format.

Returns

string

html string for el.

pygsti.report.html.escaped(txt, specs)

Escape txt so it is html safe.

Parameters

txtstring

value to escape

specsdictionary

Dictionary of user-specified and default parameters to formatting

Returns

string