to_lal_unit#
- gwpy.utils.lal.to_lal_unit( ) tuple[Unit, float | complex][source]#
Convert the input unit into a
lal.Unitand a scaling factor.- Parameters:
- Returns:
- Raises:
ValueErrorIf LAL doesn’t understand the base units for the input.
Notes
Astropy supports ‘scaled’ units of the form
<N> <u>ere<N>is afloatand<u>the baseastropy.units.Unit, e.g.'123 m', e.g:>>> from astropy.units import Quantity >>> x = Quantity(4, '123m') >>> print(x) 4.0 123 m >>> print(x.decompose()) 492.0 m
LAL doesn’t support scaled units in this way, so this function simply returns the scaling factor of the unit so that it may be applied manually to any associated data.
Examples
>>> print(to_lal_unit('m**2 / kg ** 4')) (m^2 kg^-4, 1.0) >>> print(to_lal_unit('123 m')) (m, 123.0)