chemistry_tools.units
Functions for handling SI units.
Data:
Mapping of SI measurements to their units. |
|
Square cenimetre |
|
Mapping of dimension names to symbols. |
|
Decimetre |
|
Square decimetre |
|
Kilogray |
|
Kilojoule |
|
Square metre |
|
A medium mathematical space, `` |
|
Micromole |
|
Molal (moles per kilogram) |
|
Nanomolar |
|
Nanomole |
|
Per 100 electronVolts. |
|
Per Molar per second. |
|
Micro mole per joule. |
Functions:
|
Analogous to |
|
Returns the LaTeX reperesentation of the unit of a quantity. |
|
Returns |
|
Returns the given value, followed by the given units, and separated by a medium mathematical space. |
|
Formats a scalar with unit as two strings. |
-
SI_base_registry= {'amount': UnitSubstance('mole', 'mol'), 'current': UnitCurrent('ampere', 'A'), 'length': UnitLength('meter', 'm'), 'luminous_intensity': UnitLuminousIntensity('candela', 'cd'), 'mass': UnitMass('kilogram', 'kg'), 'temperature': UnitTemperature('Kelvin', 'K'), 'time': UnitTime('second', 's')} Type:
dictMapping of SI measurements to their units.
-
allclose(a, b, rtol=1e-08, atol=None)[source] Analogous to
numpy.allclose().
-
as_latex(quant)[source] Returns the LaTeX reperesentation of the unit of a quantity.
Example:
>>> print(as_latex(1/quantities.kelvin)) \mathrm{\frac{1}{K}}
- Parameters
quant (
Quantity)- Return type
-
cm3= array(1.) * cm**3 Type:
QuantitySquare cenimetre
-
compare_equality(a, b)[source] Returns
Trueif two arguments are equal.Both arguments need to have the same dimensionality.
Examples:
>>> km, m = quantities.kilometre, quantities.metre >>> compare_equality(3*km, 3) False >>> compare_equality(3*km, 3000*m) True
-
dimension_codes= {'amount': 'N', 'current': 'I', 'length': 'L', 'mass': 'M', 'temperature': 'Θ', 'time': 'T'} Type:
dictMapping of dimension names to symbols.
-
dm= UnitQuantity('decimetre', 0.1 * m) Type:
UnitQuantityDecimetre
-
dm3= array(1.) * decimetre**3 Type:
QuantitySquare decimetre
-
format_si_units(value, *units)[source] Returns the given value, followed by the given units, and separated by a medium mathematical space.
New in version 0.4.0.
- Return type
-
format_string(value, precision='%.5g', tex=False)[source] Formats a scalar with unit as two strings.
Examples:
>>> print(' '.join(format_string(0.42*quantities.mol/decimetre**3))) 0.42 mol/decimetre**3 >>> print(' '.join(format_string(2/quantities.s, tex=True))) 2 \mathrm{\frac{1}{s}}
-
kilogray= UnitQuantity('kilogray', 1000.0 * Gy) Type:
UnitQuantityKilogray
-
kilojoule= UnitQuantity('kilojoule', 1000.0 * J) Type:
UnitQuantityKilojoule
-
m3= array(1.) * m**3 Type:
QuantitySquare metre
-
m_math_space= '\u205f' Type:
strA medium mathematical space, ``
` / ``\u205f.New in version 0.4.0.
-
micromole= UnitQuantity('micromole', 1e-06 * mol) Type:
UnitQuantityMicromole
-
molal= UnitQuantity('molal', 1.0 * mol/kg) Type:
UnitQuantityMolal (moles per kilogram)
-
nanomolar= UnitQuantity('nM', 1e-06 * mol/m**3) Type:
UnitQuantityNanomolar
-
nanomole= UnitQuantity('nanomole', 1e-09 * mol) Type:
UnitQuantityNanomole
-
per100eV= UnitQuantity('per_100_eV', 0.01 * 1/(N_A*eV)) Type:
UnitQuantityPer 100 electronVolts.
-
perMolar_perSecond= array(1.) * 1/(s*M) Type:
QuantityPer Molar per second.
-
umol_per_J= array(1.) * umol/J Type:
QuantityMicro mole per joule.