chempy.printing package¶
Submodules¶
chempy.printing.js module¶
-
class
chempy.printing.js.
JSPrinter
(settings=None)[source]¶ Bases:
chempy.printing.web.CSSPrinter
Prints javascript-enabled HTML representaions
Methods
doprint
chempy.printing.numbers module¶
-
chempy.printing.numbers.
number_to_scientific_html
(number, uncertainty=None, unit=None, fmt=None)[source]¶ Formats a number as HTML (optionally with unit/uncertainty)
- Parameters
- numberfloat (w or w/o unit)
- uncertaintysame as number
- unitunit
- fmtint or callable
Examples
>>> number_to_scientific_html(3.14) == '3.14' True >>> number_to_scientific_html(3.14159265e-7) '3.1416⋅10<sup>-7</sup>' >>> number_to_scientific_html(1e13) '10<sup>13</sup>' >>> import quantities as pq >>> number_to_scientific_html(2**0.5 * pq.m / pq.s) '1.4142 m/s'
-
chempy.printing.numbers.
number_to_scientific_latex
(number, uncertainty=None, unit=None, fmt=None)[source]¶ Formats a number as LaTeX (optionally with unit/uncertainty)
- Parameters
- numberfloat (w or w/o unit)
- uncertaintysame as number
- unitunit
- fmtint or callable
Examples
>>> number_to_scientific_latex(3.14) == '3.14' True >>> number_to_scientific_latex(3.14159265e-7) '3.1416\\cdot 10^{-7}' >>> import quantities as pq >>> number_to_scientific_latex(2**0.5 * pq.m / pq.s) '1.4142\\,\\mathrm{\\frac{m}{s}}' >>> number_to_scientific_latex(1.23456, .789, fmt=2) '1.23(79)'
-
chempy.printing.numbers.
number_to_scientific_unicode
(number, uncertainty=None, unit=None, fmt=None)[source]¶ Formats a number as unicode (optionally with unit/uncertainty)
- Parameters
- numberfloat (w or w/o unit)
- uncertaintysame as number
- unitunit
- fmtint or callable
Examples
>>> number_to_scientific_unicode(3.14) == u'3.14' True >>> number_to_scientific_unicode(3.14159265e-7) == u'3.1416·10⁻⁷' True >>> import quantities as pq >>> number_to_scientific_unicode(2**0.5 * pq.m / pq.s) '1.4142 m/s'
chempy.printing.pretty module¶
-
class
chempy.printing.pretty.
UnicodePrinter
(settings=None)[source]¶ Bases:
chempy.printing.string.StrPrinter
- Attributes
- printmethod_attr
Methods
doprint
chempy.printing.printer module¶
chempy.printing.string module¶
-
class
chempy.printing.string.
StrPrinter
(settings=None)[source]¶ Bases:
chempy.printing.printer.Printer
- Attributes
- printmethod_attr
Methods
doprint
chempy.printing.table module¶
chempy.printing.tables module¶
-
class
chempy.printing.tables.
BimolecularTable
(idx_rxn_pairs, substances, colors=None, missing=None, missing_color='eee8aa')[source]¶ Bases:
chempy.printing.tables._RxnTable
Table of bimolecular reactions
- Parameters
- idx_rxn_pairsiterable of (int, Reaction) pairs
- substancesdict
Mapping substance key to Substance instance.
- sinks_sources_disjointtuple, None or True
Colors sinks & sources. When
True
sinks_sources_disjoint()
is called.
- Returns
- string: html representation
- list: reactions not considered
Methods
from_ReactionSystem
-
class
chempy.printing.tables.
UnimolecularTable
(idx_rxn_pairs, substances, colors=None, missing=None, missing_color='eee8aa')[source]¶ Bases:
chempy.printing.tables._RxnTable
Table of unimolecular reactions in a ReactionSystem
- Parameters
- rsysReactionSystem
- sinks_sources_disjointtuple, None or True
Colors sinks & sources. When
True
sinks_sources_disjoint()
is called.- html_cell_labelReaction formatting callback
The function takes an integer, a Reaction instance and a dict of Substances as parameters and return a string.
- Returns
- string: html representation
- list: reactions not considered
Methods
from_ReactionSystem
chempy.printing.tex module¶
-
class
chempy.printing.tex.
LatexPrinter
(settings=None)[source]¶ Bases:
chempy.printing.string.StrPrinter
- Attributes
- printmethod_attr
Methods
doprint
chempy.printing.web module¶
-
class
chempy.printing.web.
CSSPrinter
(settings=None)[source]¶ Bases:
chempy.printing.web.HTMLPrinter
Methods
doprint
-
class
chempy.printing.web.
HTMLPrinter
(settings=None)[source]¶ Bases:
chempy.printing.string.StrPrinter
Methods
doprint
-
printmethod_attr
= '_html'¶
-