PySharp Units of Measure
Units of Measure in Python
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
uom.measurement_system.MeasurementSystem Class Reference

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
 

Detailed Description

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:

Member Function Documentation

◆ convertQuantityToPrefixUnit()

uom.measurement_system.MeasurementSystem.convertQuantityToPrefixUnit ( self,
quantity,
prefix,
unit )

Convert this quantity to the target unit with the specified prefix.

Parameters
quantityQuantity
prefixPrefix
unitUnit
Returns
Quantity

◆ convertQuantityToUnit()

uom.measurement_system.MeasurementSystem.convertQuantityToUnit ( self,
quantity,
unit )

Convert this quantity to the target unit.

Parameters
quantityQuantity
unitUnit
Returns
Quantity

◆ createPowerUOM()

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.

Parameters
unitTypeUnitType
unitUnit
nameName of unit of measure
symbolSymbol (must be unique)
descriptionDescription of unit of measure
baseUnitOfMeasure
exponentExponent
Returns
UnitOfMeasure

◆ createPrefixedUOM()

uom.measurement_system.MeasurementSystem.createPrefixedUOM ( self,
prefix,
uom )

Create a unit of measure linearly scaled by the Prefix against the target unit of measure.

Parameters
prefixPrefix Scaling prefix with the scaling factor, e.g. 1000
uomabscissa UnitOfMeasure
Returns
UnitOfMeasure

◆ createProductUOM()

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.

Parameters
unitTypeUnitType
unitUnit
nameName of unit of measure
symbolSymbol (must be unique)
descriptionDescription of unit of measure
multiplierUnitOfMeasure multiplier
multiplicandUnitOfMeasure multiplicand
Returns
UnitOfMeasure

◆ createQuotientUOM()

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.

Parameters
unitTypeUnitType
unitUnit
nameName of unit of measure
symbolSymbol (must be unique)
descriptionDescription of unit of measure
dividendUnitOfMeasure
divisorUnitOfMeasure
Returns
UnitOfMeasure

◆ createScalarUOM()

uom.measurement_system.MeasurementSystem.createScalarUOM ( self,
unitType,
unit,
name,
symbol,
description )

Create a unit of measure that is not a power, product or quotient.

Parameters
unitTypeUnitType
unitUnit
nameName of unit of measure
symbolSymbol (must be unique)
descriptionDescription of unit of measure
Returns
UnitOfMeasure

◆ createUnclassifiedPowerUOM()

uom.measurement_system.MeasurementSystem.createUnclassifiedPowerUOM ( self,
base,
exponent )

Create an anonymous unit of measure with a base raised to an integral power.

Parameters
baseUnitOfMeasure
exponentExponent
Returns
UnitOfMeasure

◆ createUnclassifiedProductUOM()

uom.measurement_system.MeasurementSystem.createUnclassifiedProductUOM ( self,
multiplier,
multiplicand )

Create an anonymous unit of measure that is the product of two other units of measure.

Parameters
multiplierUnitOfMeasure multiplier
multiplicandUnitOfMeasure multiplicand
Returns
UnitOfMeasure

◆ createUnclassifiedQuotientUOM()

uom.measurement_system.MeasurementSystem.createUnclassifiedQuotientUOM ( self,
dividend,
divisor )

Create a unit of measure that is a UOM divided by another UOM.

Parameters
dividendUnitOfMeasure
divisorUnitOfMeasure
Returns
UnitOfMeasure

◆ getQuantity()

uom.measurement_system.MeasurementSystem.getQuantity ( self,
constant )

Get the quantity defined as a constant value.

Parameters
constantConstant
Returns
Quantity

◆ getRegisteredUOMs()

uom.measurement_system.MeasurementSystem.getRegisteredUOMs ( self)

Get all units currently cached by this measurement system.

Returns
List of UnitOfMeasure

◆ getUnitsOfMeasure()

uom.measurement_system.MeasurementSystem.getUnitsOfMeasure ( self,
unitType )

Get all the units of measure of the specified type.

Parameters
unitTypeUnitType
Returns
List of UnitOfMeasure

◆ getUOM()

uom.measurement_system.MeasurementSystem.getUOM ( self,
unit )

Get the unit of measure with this unique enumerated type.

Parameters
unitUnit
Returns
UnitOfMeasure

◆ quantityToPower()

uom.measurement_system.MeasurementSystem.quantityToPower ( self,
quantity,
exponent )

Raise this quantity to the specified power.

Parameters
quantityQuantity
exponentExponent
Returns
new Quantity

The documentation for this class was generated from the following file: