ensure_unit¶
-
gunagala.utils.ensure_unit(arg, unit)[source]¶ Ensures that the argument has the requested units, performing conversions as necessary.
Parameters: - arg : astropy.units.Quantity or compatible
Argument to be coerced into the requested units. Can be an
astropy.units.Quantityinstance or any numeric type or sequence that is compatible with theQuantityconstructor (e.g. anumpy.array,listoffloat, etc.).- unit : astropy.units.Unit
Requested units.
Returns: - arg : astropy.units.Quantity
argas anastropy.units.Quantitywith units ofunit.