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 aScale
and aUnitRegister
.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
- property 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 ofother_koq
match the numerator in the signature of the kind of quantity ofself
.
- property is_simplified
True when the elements in the denominator of the associated kind of quantity are all zero
- property kind_of_quantity
The kind of quantity
- property register
The associated unit register
- property scale
The scale