Home | Trees | Indices | Help |
|
---|
|
A python module to parse VOUnit strings and compute conversion factors.
We believe this implements the full VOUnit specification.
To use this, you must have the gavo utils package installed. For details, see http://soft.g-vo.org. The changes required to make this work without gavo.utils are minute, though. If you want that, talk to the authors.
Unit tests for this are at
http://svn.ari.uni-heidelberg.de/svn/gavo/python/trunk/tests/unitconvtest.py
Classes | |
IncompatibleUnits | |
BadUnit | |
UnitNode a terminal node containing a unit, possibly with a prefix |
|
FunctionApplication A function applied to a term. |
|
QuotedUnitNode a quoted ("defined unknown") unit. |
|
Factor A UnitNode with a power. |
|
Term A Node containing two factors and an operator. |
|
Expression The root node of an expression tree. |
|
getUnitGrammar the grammar to parse VOUnits. |
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
PLANCK_H = 6.62607004e-34
|
|
LIGHT_C = 299792458.0
|
|
units =
|
|
PLAIN_UNITS =
|
|
EXCEPTIONAL_CONVERSIONS =
|
|
NON_PREFIXABLE =
|
|
prefixes =
|
|
PREFIXES =
|
|
AMBIGUOUS_STRINGS =
|
|
__package__ =
|
Function Details |
returns a reasonable decorative but python-readable representation of aFloat. Floats looking good as simple decimals (modulus between 0.01 and 1000) are returned without exponent. |
a parse action evaluating the whole match as a python expression. Obviously, this should only be applied to carefully screened nonterminals. |
returns a sorted tuple of (si, power) for a result of getSI(). These should be more suitable for dimensional analysis. |
returns the factor needed to get from quantities given in unitStr1 to unitStr2. Both must be given in VOUnits form. This function may raise a BadUnit if one of the strings are malformed, or an IncompatibleUnit exception if the units don't have the same SI base. If the function is successful, unitStr1 = result*unitStr2 |
returns a dict of conversion factors between newColumns and oldColumns. Both arguments are iterables of columns. For every column in newColumn, the function sees if the units of newColumn and oldColumn match. If they don't, compute a conversion factor to be multiplied to oldColumns values to make them newColumns values and add it to the result dict. The function raises a DataError if a column in newColumns has no match in oldColumns. |
Variables Details |
units
|
PLAIN_UNITS
|
EXCEPTIONAL_CONVERSIONS
|
NON_PREFIXABLE
|
prefixes
|
PREFIXES
|
AMBIGUOUS_STRINGS
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu May 2 07:29:09 2019 | http://epydoc.sourceforge.net |