RegisteredUnit

The registered_unit module contains the class RegisteredUnit which implements generic unit behaviour.

The UnitRegister class handles the creation of RegisteredUnit instances.

class RegisteredUnit(register, scale)

A RegisteredUnit is associated with a Scale and a UnitRegister.

Multiplication and division of units is delegated to the scale and will be checked during execution.

The ‘floor’ division operator supports retention of information about the signature of ‘dimensionless’ quantities (ratios of the same kind of quantity).

conversion_to(B)

Return the conversion function from this unit to unit B

The conversion function takes a value argument x and returns the converted value on B

is_dimensionless

True when the associated kind of quantity is dimensionless in the current context

is_ratio_of(other_koq)

True when the kind of quantity of self is a dimensionless ratio and the signature of the kind of quantity of other_koq match the numerator in the signature of the kind of quantity of self.

is_simplified

True when the elements in the denominator of the associated kind of quantity are all zero

kind_of_quantity

The kind of quantity

register

The associated unit register

scale

The scale