Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
jLM.DisplayUtils Namespace Reference

Functions

 _htmlExponent (x)
 texUnits (s)
 unicodeUnits (s)
 numToStr (val, unit=None, scale=1, n=3, smallest_exp=0)
 toHex (c)
 colorWheel (h)
 texfmt (xx, n=3, tex_escape=False, smallest_exp=3)
 sanitizeTex (st)
 writeTable (columnNames, rows)
 getReactionString (rct, prd, rate)

Detailed Description

Auxiliary helper functions for presentation

Function Documentation

◆ _htmlExponent()

jLM.DisplayUtils._htmlExponent ( x)
protected
Here is the caller graph for this function:

◆ colorWheel()

jLM.DisplayUtils.colorWheel ( h)
RGB triple at a particular hue

Args:
    h (float):
        Hue in range (0,1)

Returns:
    (int,int,int):
        RGB triple

◆ getReactionString()

jLM.DisplayUtils.getReactionString ( rct,
prd,
rate )

◆ numToStr()

jLM.DisplayUtils.numToStr ( val,
unit = None,
scale = 1,
n = 3,
smallest_exp = 0 )
Pretty print a number

Units can be specified in the format, e.g. "m^{2}*s^{-1}".
In this format, it can be converted between TeX and unicode 
representations.

Args:
    val (float):
        Value
    unit (str):
        Unit
    scale (float):
        Factor to scale value
    n (int):
        Precision
    smallest_exp (int):
        Smallest absolute value of exponent to write in scientific notation

Returns:
    str: 
        Formatted number
Here is the call graph for this function:

◆ sanitizeTex()

jLM.DisplayUtils.sanitizeTex ( st)
 Replace control characters with escaped versions

Args:
    st (str): 
        Input string

Returns:
    str: 
        Escaped version of `st`

◆ texfmt()

jLM.DisplayUtils.texfmt ( xx,
n = 3,
tex_escape = False,
smallest_exp = 3 )
Format a float in LaTeXified scientific notation.

Args:
    xx (float):
        Number

Keyword Args:
    n (int):
        Precision
    tex_escape (bool):  
        If true, wrap result in inline math.
    smallest_exp (int): 
        Smallest absolute value of exponent to print in 
        scientific notation.

Returns:
    str: 
        Formatted number

◆ texUnits()

jLM.DisplayUtils.texUnits ( s)
Reformat ascii number as TeX

Args:
    s (str):
        Formatted number. See :py:func:`~jLM.DisplayUtils.numToStr`

Returns:
    str:
        TeX math mode representation.

◆ toHex()

jLM.DisplayUtils.toHex ( c)
RGB triple to hex string

Args.
    c (float,float,float): 
        RGB tuple of values 0 <= c <= 1

Returns:
    str:
        HTML RGB hex code.

◆ unicodeUnits()

jLM.DisplayUtils.unicodeUnits ( s)
Reformat ascii number as unicode

Args:
    s (str):
        Formatted number. See :py:func:`~jLM.DisplayUtils.numToStr`

Returns:
    str:
        Unicode formatted number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeTable()

jLM.DisplayUtils.writeTable ( columnNames,
rows )