scinumtools.units package

Submodules

scinumtools.units.base_units module

class scinumtools.units.base_units.Base(magnitude: float, dimensions: scinumtools.units.dimensions.Dimensions, units: str, expression: str)

Bases: object

dimensions: Dimensions
expression: str
magnitude: float
units: str
class scinumtools.units.base_units.BaseUnits(baseunits: str | list | dict | Dimensions | None = None)

Bases: object

baseunits: dict
dimensions: Dimensions
expression: str | list
magnitude: float
nobase: bool
nodim: bool
units: list
value()

Return base units as a plain dictionary

scinumtools.units.base_units.get_unit_base(unitid: str, exp: Fraction | None = None)

scinumtools.units.constant module

class scinumtools.units.constant.Constant(unit=None)

Bases: object

static list()

scinumtools.units.dimensions module

class scinumtools.units.dimensions.Dimensions(m: scinumtools.units.fraction.Fraction = <factory>, g: scinumtools.units.fraction.Fraction = <factory>, s: scinumtools.units.fraction.Fraction = <factory>, K: scinumtools.units.fraction.Fraction = <factory>, C: scinumtools.units.fraction.Fraction = <factory>, cd: scinumtools.units.fraction.Fraction = <factory>, mol: scinumtools.units.fraction.Fraction = <factory>, rad: scinumtools.units.fraction.Fraction = <factory>, nodim: bool = True)

Bases: object

C: Fraction
K: Fraction
cd: Fraction
static from_list(value: list)
g: Fraction
m: Fraction
mol: Fraction
nodim: bool = True
rad: Fraction
s: Fraction
value(dtype=<class 'list'>)

scinumtools.units.fraction module

class scinumtools.units.fraction.Fraction(num: int = 0, den: int = 1)

Bases: object

den: int
static from_fraction(value: Fraction)
static from_string(value: str)
static from_tuple(value: tuple)
num: int
rebase()
value(dtype=<class 'tuple'>)

scinumtools.units.magnitude module

class scinumtools.units.magnitude.Magnitude(value: float, abse: float | None = None, rele: float | None = None)

Bases: object

abse(abse=None)
error: int | float | Decimal | ndarray = None
static parse_string(value, error)
rele(rele=None)
value: int | float | Decimal | ndarray

scinumtools.units.nan module

class scinumtools.units.nan.NaN(unit=None)

Bases: object

scinumtools.units.quantity module

class scinumtools.units.quantity.Quantity(magnitude: int | float | Decimal | list | ndarray | Magnitude, baseunits: str | list | ndarray | Dimensions | dict | BaseUnits | None = None, abse: int | float | None = None, rele: int | float | None = None)

Bases: object

abse(error: int | float | None = None)
baseunits: BaseUnits
magnitude: Magnitude
rebase()
rele(error: int | float | None = None)
to(units: str | list | ndarray | Dimensions | dict | BaseUnits)
units()
value(expression=None, dtype=None)
scinumtools.units.quantity.abs(a, **kwargs)
scinumtools.units.quantity.absolute(a, **kwargs)
scinumtools.units.quantity.ceil(a, **kwargs)
scinumtools.units.quantity.floor(a, **kwargs)
scinumtools.units.quantity.implements(np_function)
scinumtools.units.quantity.iscomplexobj(a, **kwargs)
scinumtools.units.quantity.linspace(a, b, c, **kwargs)
scinumtools.units.quantity.logspace(a, b, c, **kwargs)
scinumtools.units.quantity.round(a, **kwargs)
scinumtools.units.quantity.sum(a, **kwargs)

scinumtools.units.settings module

scinumtools.units.systems module

class scinumtools.units.systems.SystemOfUnits(prefix)

Bases: object

scinumtools.units.unit module

class scinumtools.units.unit.Unit(unit=None)

Bases: object

static list()

scinumtools.units.unit_environment module

class scinumtools.units.unit_environment.UnitEnvironment(units)

Bases: object

close()
new_types: list
new_units: list
scinumtools.units.unit_environment.check_unique_symbols()

scinumtools.units.unit_list module

scinumtools.units.unit_solver module

class scinumtools.units.unit_solver.Atom(magnitude, baseunits)

Bases: object

baseunits: dict
magnitude: float
scinumtools.units.unit_solver.AtomParser(string=None)
scinumtools.units.unit_solver.UnitSolver(expression)

scinumtools.units.unit_types module

class scinumtools.units.unit_types.LogarithmicUnitType(baseunits1, baseunits2)

Bases: UnitType

add(unit1, unit2)
conversions: dict = {'AR_B': ('_convert_Ratio_B', 2, 1), 'AR_Np': ('_convert_Ratio_Np', 1, 1), 'A_BA': ('_convert_Ratio_B', 2, 1), 'A_BuA': ('_convert_Ratio_B', 2, 1000000.0), 'BA_A': ('_convert_B_Ratio', 2, 1), 'BA_BA': ('_convert_B_B', 0), 'BOhm_BOhm': ('_convert_B_B', 0), 'BOhm_Ohm': ('_convert_B_Ratio', 2, 1000.0), 'BSIL_BSIL': ('_convert_B_B', 0), 'BSIL_W': ('_convert_B_Ratio', 1, 1e-09), 'BSPL_BSPL': ('_convert_B_B', 0), 'BSPL_Pa': ('_convert_B_Ratio', 2, 0.02), 'BSWL_BSWL': ('_convert_B_B', 0), 'BSWL_W': ('_convert_B_Ratio', 1, 1e-09), 'BV_BV': ('_convert_B_B', 0), 'BV_BuV': ('_convert_B_B', 12), 'BV_V': ('_convert_B_Ratio', 2, 1000.0), 'BW_BW': ('_convert_B_B', 0), 'BW_Bm': ('_convert_B_B', 3), 'BW_BmW': ('_convert_B_B', 3), 'BW_W': ('_convert_B_Ratio', 1, 1000.0), 'B_AR': ('_convert_B_Ratio', 2, 1), 'B_PR': ('_convert_B_Ratio', 1, 1), 'BmW_BW': ('_convert_B_B', -3), 'BmW_Bm': ('_convert_B_B', 0), 'BmW_BmW': ('_convert_B_B', 0), 'BmW_W': ('_convert_B_Ratio', 1, 1), 'Bm_BW': ('_convert_B_B', -3), 'Bm_Bm': ('_convert_B_B', 0), 'Bm_BmW': ('_convert_B_B', 0), 'Bm_W': ('_convert_B_Ratio', 1, 1), 'BuA_A': ('_convert_B_Ratio', 2, 1e-06), 'BuA_BuA': ('_convert_B_B', 0), 'BuV_BV': ('_convert_B_B', -12), 'BuV_BuV': ('_convert_B_B', 0), 'BuV_V': ('_convert_B_Ratio', 2, 0.001), 'Np_AR': ('_convert_Np_Ratio', 1, 1), 'Np_PR': ('_convert_Np_Ratio', 0.5, 1), 'Ohm_BOhm': ('_convert_Ratio_B', 2, 0.001), 'PR_B': ('_convert_Ratio_B', 1, 1), 'PR_Np': ('_convert_Ratio_Np', 0.5, 1), 'Pa_BSPL': ('_convert_Ratio_B', 2, 50), 'V_BV': ('_convert_Ratio_B', 2, 0.001), 'V_BuV': ('_convert_Ratio_B', 2, 1000.0), 'W_BSIL': ('_convert_Ratio_B', 1, 1000000000.0), 'W_BSWL': ('_convert_Ratio_B', 1, 1000000000.0), 'W_BW': ('_convert_Ratio_B', 1, 0.001), 'W_Bm': ('_convert_Ratio_B', 1, 1), 'W_BmW': ('_convert_Ratio_B', 1, 1)}
process: list = ['Np', 'B', 'Bm', 'BmW', 'BW', 'BV', 'BuV', 'BA', 'BuA', 'BOhm', 'BSPL', 'BSIL', 'BSWL']
sub(unit1, unit2)
class scinumtools.units.unit_types.StandardUnitType(baseunits1, baseunits2)

Bases: UnitType

class scinumtools.units.unit_types.TemperatureUnitType(baseunits1, baseunits2)

Bases: UnitType

process = ['Cel', 'degF']
class scinumtools.units.unit_types.UnitType(baseunits1, baseunits2)

Bases: object

add(unit1, unit2)
convert(magnitude1)
sub(unit1, unit2)

Module contents