pyunitwizard.check#
- pyunitwizard.check(quantity_or_unit, dimensionality=None, value_type=None, shape=None, unit=None, dtype_name=None)[source]#
Check if a quantity or unit has the specified dimensionality, value_type, shape, unit or data type.
- Parameters:
quantity_or_unit (Any) – A quantity or unit object. If any other object is passed False will be returned.
dimensionality (dict) – A dictionary specifying the dimensionality of the quantity or unit.
value_type (Any) – The type of the quantity. Can be int, float, np.ndarray.
shape (tuple of int) – For non scalar quantities. A tuple with the shape of the array.
unit (str) – Name of the unit.
dtype_name (str) – For non scalar quantities. The dtype of the array (i.e float64).
- Returns:
True if the quantity or unit has the specified parameters.
- Return type:
bool