Quantity#

class pypillometry.Quantity(value, unit)[source]#

Bases: object

A number or array together with a Unit.

Usually created by multiplying with a unit, e.g. 3 * u.min or (-200, 800) * u.ms. Tuples and lists are stored as numpy arrays. Iterating over or indexing an array quantity gives quantities.

Parameters:
  • value (float or array-like) – magnitude

  • unit (Unit or str) – unit of value

Methods

to

Return the quantity converted to unit.

Details

to(unit, fs=None)[source]#

Return the quantity converted to unit.

Parameters:
  • unit (Unit or str) – target unit; must have the same dimension

  • fs (float, optional) – sampling rate in Hz; needed to convert from or to samples

property dimension#

Dimension of the unit (“time”, “length” or “angle”).

property magnitude#

The value without unit.