stravalib.unithelper.Quantity#
- class stravalib.unithelper.Quantity(value: MagnitudeT, units: UnitLike | None = None)[source]#
- class stravalib.unithelper.Quantity(value: str, units: UnitLike | None = None)
- class stravalib.unithelper.Quantity(value: Sequence[ScalarT], units: UnitLike | None = None)
- class stravalib.unithelper.Quantity(value: PlainQuantity[Any], units: UnitLike | None = 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_preferred
([preferred_units])Return Quantity converted to a unit composed of the preferred 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
T
UnitsContainer
default_format
Default formatting string.
dimensionality
returns: Dimensionality of the PlainQuantity, e.g.
{length: 1, time: -1}
:rtype: dict.dimensionless
flat
force_ndarray
force_ndarray_like
imag
m
PlainQuantity's magnitude.
magnitude
PlainQuantity's magnitude.
ndim
num
real
shape
u
PlainQuantity's units.
unit
unitless
units
PlainQuantity's units.