PySharp Units of Measure
Units of Measure in Python
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

def __init__ (self)
 
def primeUomCache (self)
 
def getUOM (self, unit)
 Get the unit of measure with this unique enumerated type. More...
 
def getOne (self)
 
def createScalarUOM (self, unitType, unit, name, symbol, description)
 Create a unit of measure that is not a power, product or quotient. More...
 
def createBaseSIUnit (self, unit)
 
def createSIUnit (self, unit)
 
def createCustomaryUnit (self, unit)
 
def createUSUnit (self, unit)
 
def createBRUnit (self, unit)
 
def createFinancialUnit (self, unit)
 
def createUOMForUnit (self, unit)
 
def getQuantity (self, constant)
 Get the quantity defined as a constant value. More...
 
def createPowerUOM (self, unitType, unit, name, symbol, description, base, exponent)
 Create a unit of measure with a base raised to an integral power. More...
 
def createUnclassifiedPowerUOM (self, base, exponent)
 Create an anonymous unit of measure with a base raised to an integral power. More...
 
def createProductUOM (self, unitType, unit, name, symbol, description, multiplier, multiplicand)
 Create a unit of measure that is the product of two other units of measure. More...
 
def createUnclassifiedProductUOM (self, multiplier, multiplicand)
 Create an anonymous unit of measure that is the product of two other units of measure. More...
 
def createUnclassifiedQuotientUOM (self, dividend, divisor)
 Create a unit of measure that is a UOM divided by another UOM. More...
 
def createQuotientUOM (self, unitType, unit, name, symbol, description, dividend, divisor)
 Create a unit of measure that is a UOM divided by another UOM. More...
 
def createUOM (self, unitType, unit, name, symbol, description)
 
def getSecond (self)
 
def getMinute (self)
 
def getHour (self)
 
def getDay (self)
 
def getRegisteredUOMs (self)
 Get all units currently cached by this measurement system. More...
 
def getUnitsOfMeasure (self, unitType)
 Get all the units of measure of the specified type. More...
 
def getUOMBySymbol (self, symbol)
 
def createPrefixedUOM (self, prefix, uom)
 Create a unit of measure linearly scaled by the Prefix against the target unit of measure. More...
 
def quantityFromPrefixedUnit (self, amount, prefix, unit)
 
def quantityFromUnit (self, amount, unit)
 
def quantityFromStringUnit (self, strAmount, unit)
 
def convertQuantityToUnit (self, quantity, unit)
 Convert this quantity to the target unit. More...
 
def convertQuantityToPrefixUnit (self, quantity, prefix, unit)
 Convert this quantity to the target unit with the specified prefix. More...
 
def quantityToPower (self, quantity, exponent)
 Raise this quantity to the specified power. More...
 

Static Public Member Functions

def instance ()
 
def 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()

def 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()

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

Convert this quantity to the target unit.

Parameters
quantityQuantity
unitUnit
Returns
Quantity

◆ createPowerUOM()

def 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()

def 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()

def 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()

def 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()

def 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()

def 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()

def 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()

def 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()

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

Get the quantity defined as a constant value.

Parameters
constantConstant
Returns
Quantity

◆ getRegisteredUOMs()

def uom.measurement_system.MeasurementSystem.getRegisteredUOMs (   self)

Get all units currently cached by this measurement system.

Returns
List of UnitOfMeasure

◆ getUnitsOfMeasure()

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

Get all the units of measure of the specified type.

Parameters
unitTypeUnitType
Returns
List of UnitOfMeasure

◆ getUOM()

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

Get the unit of measure with this unique enumerated type.

Parameters
unitUnit
Returns
UnitOfMeasure

◆ quantityToPower()

def 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: