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:
dict
Mapping 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}}
- Return type
-
cm3
= array(1.) * cm**3 Type:
Quantity
Square cenimetre
-
compare_equality
(a, b)[source] Returns
True
if 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:
dict
Mapping of dimension names to symbols.
-
dm
= UnitQuantity('decimetre', 0.1 * m) Type:
UnitQuantity
Decimetre
-
dm3
= array(1.) * decimetre**3 Type:
Quantity
Square 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:
UnitQuantity
Kilogray
-
kilojoule
= UnitQuantity('kilojoule', 1000.0 * J) Type:
UnitQuantity
Kilojoule
-
m3
= array(1.) * m**3 Type:
Quantity
Square metre
-
m_math_space
= '\u205f' Type:
str
A medium mathematical space, ``
` / ``\u205f
.New in version 0.4.0.
-
micromole
= UnitQuantity('micromole', 1e-06 * mol) Type:
UnitQuantity
Micromole
-
molal
= UnitQuantity('molal', 1.0 * mol/kg) Type:
UnitQuantity
Molal (moles per kilogram)
-
nanomolar
= UnitQuantity('nM', 1e-06 * mol/m**3) Type:
UnitQuantity
Nanomolar
-
nanomole
= UnitQuantity('nanomole', 1e-09 * mol) Type:
UnitQuantity
Nanomole
-
per100eV
= UnitQuantity('per_100_eV', 0.01 * 1/(N_A*eV)) Type:
UnitQuantity
Per 100 electronVolts.
-
perMolar_perSecond
= array(1.) * 1/(s*M) Type:
Quantity
Per Molar per second.
-
umol_per_J
= array(1.) * umol/J Type:
Quantity
Micro mole per joule.