finesse.utilities.units module

Convenience objects and functions for unit manipulation.

class finesse.utilities.units.SI(*values)[source]

Bases: Enum

Enum defining common SI unit constant names. Look-up the corresponding values with the finesse.utilities.SI_MAP dictionary.

Examples

To get the constant for SI.MILLI simply look-up:

>>> SI_MAP[SI.MILLI]
1e-3
ATTO = 2
CENTI = 8
DECI = 9
FEMTO = 3
GIGA = 13
KILO = 11
MEGA = 12
MICRO = 6
MILLI = 7
NANO = 5
NONE = 10
PETA = 15
PICO = 4
TERA = 14
YOCTO = 0
ZEPTO = 1
finesse.utilities.units.get_SI_value(name)[source]

Get an SI value by name.

Valid names correspond to the values() of the finesse.utilities.SI_LABEL dict.

Parameters

namestr

Label name of the SI value (e.g. “m” for milli, “G” for giga).

Returns

valuefloat

Value corresponding to the SI name.