neclib.core.normalization.astropy#
Aliases#
None |
- get_quantity(*value, unit=None)[source]#
Convert a value to astropy Quantity.
- Parameters:
value (Union[int, float, Array[Union[int, float]], Quantity]) – The value to be converted. If multiple values are given, they should have equivalent dimensions.
unit (Optional[Union[UnitBase, str]]) – The unit of the value. Should be given as a keyword argument.
- Returns:
The value converted to Quantity.
- Return type:
quantity
- Raises:
UnitConversionError – If the value has incompatible dimensions.
ValueError – If the values have different shapes.
Examples
>>> neclib.core.get_quantity(1, 2, 3, unit="m") <Quantity [1., 2., 3.] m> >>> neclib.core.get_quantity(np.array([1, 2, 3]), unit="m/s") <Quantity [1., 2., 3.] m / s>