unit#
- named_arrays.unit(a, unit_dimensionless=None, squeeze=True)#
Isolate the physical units associated with the given object.
If the array has no physical units, this function returns
None.- Parameters:
a (Any) – object to isolate the units of
unit_dimensionless (None | float | UnitBase) – The unit to use for dimensionless objects.
squeeze (bool) – If the result is an instance of
named_arrays.AbstractVectorArray, and all the components are the same, simplify the result into a singleastropy.units.Unitinstance.
- Return type:
None | UnitBase | AbstractArray
See also
unit_normalized()version of this function that by default returns
astropy.units.dimensionless_unscaledinstead ofNoneif there is no unit associated with the given object.