Logo

A performant, verbose and generic physical unit system.

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qunits.Quantity  (  value unit = None  )[source]

The base class for quantities with units.

Parameters:
valuearray_like | Quantity

The value of the quantity.

unitUnit | None

The unit of the quantity.

Properties:
TQuantity

The transpose of the quantity.

ctypes_ctypes[int]

The ctypes of the quantity if the value is an array.

datamemoryview

A memoryview of the data of the quantity if the value is an array.

dtypenumpy.dtype[numpy.float64]

The data type of the quantity.

flagsnumpy._core.multiarray.flagsobj

The flags of the quantity, if the value is an array.

itemsizeint

The size in bytes of each element in the quantity.

mfloat | numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]

The magnitude of the quantity, i.e., the value without the current unit.

magnitudefloat | numpy.ndarray[tuple[Any, ...], numpy.dtype[numpy.float64]]

The magnitude of the quantity, i.e., the value without the current unit.

nbytesint

The total number of bytes consumed by the elements of the quantity.

ndimint

The number of array dimensions of the quantity.

shapetuple[int, ...]

The array shape of the quantity.

sizeint

The number of elements in the quantity.

stridestuple[int, ...]

The strides of the quantity.

unitUnit | None

The unit of the quantity.

valuearray_like | Quantity

The value of the quantity.