radis.phys.units_astropy moduleΒΆ
- convert_and_strip_units(quantity, output_unit=None, digit=10)[source]ΒΆ
Strips units and return the numerical value.
- Parameters:
- Other Parameters:
round (int) β round to that number of digit after conversion. Default
10
. Set toNone
to disable.- Returns:
The numerical value extracted from
quantity
- Return type:
int or float or None or ndarray
Examples
>>> convert_and_strip_units(4.5 * u.um, u.nm) <<< 4500.0
>>> convert_and_strip_units(200000 * (u.m)**-1, 1/u.cm) <<< 2000.0
- Raises:
TypeError β Raised when
quantity
is a astropy.units quantity andoutput_unit
isNone
.