stravalib.unithelper.Quantity#
- class stravalib.unithelper.Quantity(value: str, units: Optional[Union[str, UnitsContainer, Unit]] = None)[source]#
- class stravalib.unithelper.Quantity(value: Sequence, units: Optional[Union[str, UnitsContainer, Unit]] = None)
- class stravalib.unithelper.Quantity(value: PlainQuantity[Magnitude], units: Optional[Union[str, UnitsContainer, Unit]] = None)
- class stravalib.unithelper.Quantity(value: Magnitude, units: Optional[Union[str, UnitsContainer, Unit]] = None)
Extension of pint.Quantity for temporary backward compatibility with the legacy units package.
- __init__()#
Methods
__init__()check(dimension)Return true if the quantity's dimension matches passed dimension.
clip([min, max, out])compare(*args, **kwargs)compatible_units(*contexts)compute(**kwargs)Compute the Dask array wrapped by pint.PlainQuantity.
dot(b)Dot product of two arrays.
fill(value)format_babel([spec])from_list(quant_list[, units])Transforms a list of Quantities into an numpy.array quantity.
from_sequence(seq[, units])Transforms a sequence of Quantities into an numpy.array quantity.
from_tuple(tup)is_compatible_with(other, *contexts, ...)check if the other object is compatible
ito([other])Inplace rescale to different units.
ito_base_units()Return PlainQuantity rescaled to plain units.
ito_reduced_units()Return PlainQuantity scaled in place to reduced units, i.e. one unit per dimension.
ito_root_units()Return PlainQuantity rescaled to root units.
m_as(units)PlainQuantity's magnitude expressed in particular units.
persist(**kwargs)Persist the Dask Array wrapped by pint.PlainQuantity.
plus_minus(error[, relative])prod([axis, dtype, out, keepdims, initial, ...])Return the product of quantity elements over a given axis
put(indices, values[, mode])searchsorted(v[, side, sorter])to([other])Return PlainQuantity rescaled to different units.
to_base_units()Return PlainQuantity rescaled to plain units.
to_compact([unit])"Return PlainQuantity rescaled to compact, human-readable units.
to_preferred(preferred_units)Return Quantity converted to a unit composed of the preferred units.
to_reduced_units()Return PlainQuantity scaled in place to reduced units, i.e. one unit per dimension.
to_root_units()Return PlainQuantity rescaled to root units.
to_timedelta()to_tuple()tolist()visualize(**kwargs)Produce a visual representation of the Dask graph.
Attributes
TUnitsContainerdefault_formatDefault formatting string.
dimensionalityreturns: Dimensionality of the PlainQuantity, e.g.
dimensionlessflatforce_ndarrayforce_ndarray_likeimagmPlainQuantity's magnitude.
magnitudePlainQuantity's magnitude.
ndimnumrealshapeuPlainQuantity's units.
unitunitlessunitsPlainQuantity's units.