Home | Trees | Indices | Help |
|
---|
|
Physical quantities with units.
This module provides a data type that represents a physical quantity together with its unit. It is possible to add and subtract these quantities if the units are compatible, and a quantity can be converted to another compatible unit. Multiplication, subtraction, and raising to integer powers is allowed without restriction, and the result will have the correct unit. A quantity can be raised to a non-integer power only if the result can be represented by integer powers of the base units.
The values of physical constants are taken from the 1986 recommended values from CODATA. Other conversion factors (e.g. for British units) come from various sources. I can't guarantee for the correctness of all entries in the unit table, so use this at your own risk.
|
|||
PhysicalQuantity Physical quantity with units |
|||
PhysicalUnit Physical unit |
|
|||
_addPrefixed(unit) | |||
_addUnit(name, unit) | |||
_convertValue(value, src_unit, target_unit) | |||
_findUnit(unit) | |||
_round(x) | |||
bool
|
isPhysicalQuantity(x) Returns True if x is a PhysicalQuantity
|
||
bool
|
isPhysicalUnit(x) Returns True if x is a PhysicalUnit
|
|
|||
_base_names = ['m', 'kg', 's', 'A', 'K', 'mol', 'cd', 'rad', 'sr']
|
|||
_base_units = [('m', <PhysicalUnit m>), ('g', <PhysicalUnit g>), (...
|
|||
_prefixes = [('Y', 9.9999999999999998e+23), ('Z', 1e+21), ('E', ...
|
|||
_unit_table = {'alm': <PhysicalUnit alm>, 'aohm': <PhysicalUnit ao...
|
|
|
|
|
|
|
|
|
|
_base_names
|
_base_units
|
_prefixes
|
_unit_table
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0alpha3 on Fri Oct 6 14:45:40 2006 | http://epydoc.sourceforge.net |