|
PySharp Units of Measure
Units of Measure in Python
|
A MeasurementSystem is a collection of units of measure that have a linear relationship to each other: y = ax + b where x is the unit to be converted, y is the converted unit, a is the scaling factor and b is the offset. More...
Public Member Functions | |
| __init__ (self) | |
| primeUomCache (self) | |
| getUOM (self, unit) | |
| Get the unit of measure with this unique enumerated type. | |
| getOne (self) | |
| createScalarUOM (self, unitType, unit, name, symbol, description) | |
| Create a unit of measure that is not a power, product or quotient. | |
| createBaseSIUnit (self, unit) | |
| createSIUnit (self, unit) | |
| createCustomaryUnit (self, unit) | |
| createUSUnit (self, unit) | |
| createBRUnit (self, unit) | |
| createFinancialUnit (self, unit) | |
| createUOMForUnit (self, unit) | |
| getQuantity (self, constant) | |
| Get the quantity defined as a constant value. | |
| createPowerUOM (self, unitType, unit, name, symbol, description, base, exponent) | |
| Create a unit of measure with a base raised to an integral power. | |
| createUnclassifiedPowerUOM (self, base, exponent) | |
| Create an anonymous unit of measure with a base raised to an integral power. | |
| createProductUOM (self, unitType, unit, name, symbol, description, multiplier, multiplicand) | |
| Create a unit of measure that is the product of two other units of measure. | |
| createUnclassifiedProductUOM (self, multiplier, multiplicand) | |
| Create an anonymous unit of measure that is the product of two other units of measure. | |
| createUnclassifiedQuotientUOM (self, dividend, divisor) | |
| Create a unit of measure that is a UOM divided by another UOM. | |
| createQuotientUOM (self, unitType, unit, name, symbol, description, dividend, divisor) | |
| Create a unit of measure that is a UOM divided by another UOM. | |
| createUOM (self, unitType, unit, name, symbol, description) | |
| getSecond (self) | |
| getMinute (self) | |
| getHour (self) | |
| getDay (self) | |
| getRegisteredUOMs (self) | |
| Get all units currently cached by this measurement system. | |
| getUnitsOfMeasure (self, unitType) | |
| Get all the units of measure of the specified type. | |
| getUOMBySymbol (self, symbol) | |
| createPrefixedUOM (self, prefix, uom) | |
Create a unit of measure linearly scaled by the Prefix against the target unit of measure. | |
| quantityFromPrefixedUnit (self, amount, prefix, unit) | |
| quantityFromUnit (self, amount, unit) | |
| quantityFromStringUnit (self, strAmount, unit) | |
| convertQuantityToUnit (self, quantity, unit) | |
| Convert this quantity to the target unit. | |
| convertQuantityToPrefixUnit (self, quantity, prefix, unit) | |
| Convert this quantity to the target unit with the specified prefix. | |
| quantityToPower (self, quantity, exponent) | |
| Raise this quantity to the specified power. | |
Static Public Member Functions | |
| instance () | |
| getUOMKey (uom) | |
Static Public Attributes | |
| unifiedSystem = None | |
A MeasurementSystem is a collection of units of measure that have a linear relationship to each other: y = ax + b where x is the unit to be converted, y is the converted unit, a is the scaling factor and b is the offset.
See
The MeasurementSystem class creates:
| uom.measurement_system.MeasurementSystem.convertQuantityToPrefixUnit | ( | self, | |
| quantity, | |||
| prefix, | |||
| unit ) |
| uom.measurement_system.MeasurementSystem.convertQuantityToUnit | ( | self, | |
| quantity, | |||
| unit ) |
| uom.measurement_system.MeasurementSystem.createPowerUOM | ( | self, | |
| unitType, | |||
| unit, | |||
| name, | |||
| symbol, | |||
| description, | |||
| base, | |||
| exponent ) |
Create a unit of measure with a base raised to an integral power.
| unitType | UnitType |
| unit | Unit |
| name | Name of unit of measure |
| symbol | Symbol (must be unique) |
| description | Description of unit of measure |
| base | UnitOfMeasure |
| exponent | Exponent |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createPrefixedUOM | ( | self, | |
| prefix, | |||
| uom ) |
Create a unit of measure linearly scaled by the Prefix against the target unit of measure.
| prefix | Prefix Scaling prefix with the scaling factor, e.g. 1000 |
| uom | abscissa UnitOfMeasure |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createProductUOM | ( | self, | |
| unitType, | |||
| unit, | |||
| name, | |||
| symbol, | |||
| description, | |||
| multiplier, | |||
| multiplicand ) |
Create a unit of measure that is the product of two other units of measure.
| unitType | UnitType |
| unit | Unit |
| name | Name of unit of measure |
| symbol | Symbol (must be unique) |
| description | Description of unit of measure |
| multiplier | UnitOfMeasure multiplier |
| multiplicand | UnitOfMeasure multiplicand |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createQuotientUOM | ( | self, | |
| unitType, | |||
| unit, | |||
| name, | |||
| symbol, | |||
| description, | |||
| dividend, | |||
| divisor ) |
Create a unit of measure that is a UOM divided by another UOM.
| unitType | UnitType |
| unit | Unit |
| name | Name of unit of measure |
| symbol | Symbol (must be unique) |
| description | Description of unit of measure |
| dividend | UnitOfMeasure |
| divisor | UnitOfMeasure |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createScalarUOM | ( | self, | |
| unitType, | |||
| unit, | |||
| name, | |||
| symbol, | |||
| description ) |
Create a unit of measure that is not a power, product or quotient.
| unitType | UnitType |
| unit | Unit |
| name | Name of unit of measure |
| symbol | Symbol (must be unique) |
| description | Description of unit of measure |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createUnclassifiedPowerUOM | ( | self, | |
| base, | |||
| exponent ) |
Create an anonymous unit of measure with a base raised to an integral power.
| base | UnitOfMeasure |
| exponent | Exponent |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createUnclassifiedProductUOM | ( | self, | |
| multiplier, | |||
| multiplicand ) |
Create an anonymous unit of measure that is the product of two other units of measure.
| multiplier | UnitOfMeasure multiplier |
| multiplicand | UnitOfMeasure multiplicand |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.createUnclassifiedQuotientUOM | ( | self, | |
| dividend, | |||
| divisor ) |
Create a unit of measure that is a UOM divided by another UOM.
| dividend | UnitOfMeasure |
| divisor | UnitOfMeasure |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.getQuantity | ( | self, | |
| constant ) |
| uom.measurement_system.MeasurementSystem.getRegisteredUOMs | ( | self | ) |
Get all units currently cached by this measurement system.
UnitOfMeasure | uom.measurement_system.MeasurementSystem.getUnitsOfMeasure | ( | self, | |
| unitType ) |
Get all the units of measure of the specified type.
| unitType | UnitType |
UnitOfMeasure | uom.measurement_system.MeasurementSystem.getUOM | ( | self, | |
| unit ) |
| uom.measurement_system.MeasurementSystem.quantityToPower | ( | self, | |
| quantity, | |||
| exponent ) |
Raise this quantity to the specified power.
| quantity | Quantity |
| exponent | Exponent |