QuantityPoint

Labs

class QuantityPoint

Description

A concrete quantity point value.

Format specification is :[float spec][:[p|f|B][b]], where

  • p adds the nearest engineering SI prefix (e.g. excluding centi) if the unit is prefixable.

  • f adds the nearest full SI prefix (e.g. including centi) if the unit is prefixable.

  • B adds the nearest binary IEC prefix if the unit is prefixable, this should typically be used with bit related quantities. Note the uppercase letter that matches casing on binary prefixes.

  • b prints the quantity value in its base units.

Note that as a space optimization, the origin is stored as a numerical value with the same units as the displacement.

Inheritance:

Members defined in QuantityPoint (14 members)

absolute_base_repr

R

The numerical value of this quantity point in base units relative to natural origin.

absolute_displacement

R

Get the free quantity relative to the natural origin of the quantity.

base_repr

R

The numerical value of this quantity in base units.

displacement

R

Get the free quantity relative to the origin of this point.

numerical

RW

The numerical value of this quantity.

point_origin

R

The origin of this point.

unit

R

The measurement units of this quantity.

zero_repr

R

The numerical value of zero offset in units of this point.

__init__

Construct a strong quantity with numerical value and a unit.

__repr__

__str__

displacement_from

Get a displacement relative to another origin.

to

Convert this to different measurement unit.

try_to

Convert this to different measurement unit.

Attributes

property absolute_base_repr: float

The numerical value of this quantity point in base units relative to natural origin.

property absolute_displacement: syside.experimental.units.Quantity

Get the free quantity relative to the natural origin of the quantity.

property base_repr: float

The numerical value of this quantity in base units.

property displacement: syside.experimental.units.QuantityDelta

Get the free quantity relative to the origin of this point.

property numerical: float

The numerical value of this quantity.

property point_origin: syside.experimental.units.PointOrigin

The origin of this point.

Note that this will return point origin in the point units as actual reference is not stored as an optimization.

property unit: syside.experimental.units.Unit

The measurement units of this quantity.

property zero_repr: float

The numerical value of zero offset in units of this point.

Methods

__init__(arg0: float, arg1: syside.experimental.units.Unit, /) → None

Construct a strong quantity with numerical value and a unit.

__init__(arg: syside.experimental.units.Unit, /) → None

Construct a unit quantity, i.e. numerical() == 1.

__init__(arg: syside.experimental.units.Quantity, /) → None

Explicitly convert an absolute quantity to a point relative to the natural origin.

__init__(arg0: syside.experimental.units.QuantityDelta, arg1: syside.experimental.units.PointOrigin, /) → None

Construct a point with a displacement relative to some origin.

Raises ValueError if origin is an incompatible quantity with the displacement.

__repr__() → str
__str__() → str
displacement_from(arg: syside.experimental.units.PointOrigin, /) → syside.experimental.units.QuantityDelta

Get a displacement relative to another origin.

Raises ValueError if origin quantity is incompatible with this point.

to(arg: syside.experimental.units.Unit, /) → syside.experimental.units.QuantityPoint

Convert this to different measurement unit.

Raises ValueError if self.unit is not convertible to unit.

try_to(arg: syside.experimental.units.Unit, /) → syside.experimental.units.QuantityPoint | None

Convert this to different measurement unit.

Returns None if self.unit is not convertible to unit.