astromodels.core.thread_safe_unit_format module

class astromodels.core.thread_safe_unit_format.ThreadSafe(*args, **kwargs)[source]

Bases: Base

name = 'threadsafe'
classmethod parse(s)[source]

Convert a string to a unit object.

classmethod to_string(unit)[source]

Convert a unit to its string representation.

Implementation for ~astropy.units.UnitBase.to_string.

  • unit (|Unit|) – The unit to convert.

  • fraction ({False|True|’inline’|’multiline’}, optional) – Options are as follows:

    • False : display unit bases with negative powers as they are (e.g., km s-1);

    • ‘inline’ or True : use a single-line fraction (e.g., km / s);

    • ‘multiline’ : use a multiline fraction (available for the latex, console and unicode formats only; e.g., $\mathrm{\frac{km}{s}}$).


ValueError – If fraction is not recognized.