hexrd.valunits module
Module for associating units with scalar quantities
This module has been modified from its original form by removing the call to the “units” executable and restricting the units to only those used by the heXRD package.
- hexrd.valunits.toFloat(val, unitName)[source]
Return the raw value of the object
INPUTS
- val
(float|valWUnit) object with value
- unitName
(str) name of unit
This function returns the raw value of the object, ignoring the unit, if it is numeric or converts it to the requested units and returns the magnitude if it is a valWUnit instance.
For example:
>>> print(toFloat(1.1, 'radians')) 1.1 >>> v = valWUnit('vee', 'angle', 1.1, 'radians') >>> print(toFloat(v, 'degrees')) 63.02535746439056
- class hexrd.valunits.valWUnit(name, unitType, value, unit)[source]
Bases:
object
Value with units