-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Warning: this information is for v1.0, which may or may not be released yet!
Noether is a units package for Python, allowing you to manipulate units of measurement with uncertainties. It has an extensive unit catalogue, including all CODATA constants, and is constantly kept up-to-date.
For this wiki, we will assume you have done the following:
pip install noether
python -im noetherwhich, as you will see, will do from noether import *.
You can use Noether's units much like a calculator:
>>> meter(10) * foot(2) * cm(40)
2.4384 m**3 # volume
>>> furlong / fortnight
0.00017 m / sNote how the comments display what dimension the unit is in.
Noether has a wide variety of scientific constants available, including those directly imported from CODATA:
>>> G
Newtonian constant of gravitation # gravity, 6.6743e-11 ± 1.5e-15 m**3 / kg / s**2
>>> k_e * e(1) * e(-1) / au ** 2
-1.0309e-50 N # forceYou can access a measurement's dimension with .dim:
>>> atm.dim
pressure # mass / length / time**2
>>> assert von_Klitzing_constant.dim == resistanceYou can deal with units like Celsius and Fahrenheit both as absolute (celsius(30)) and relative (celsius * 30) measures. Take care not to confuse the two!
>>> fahrenheit(-40) / celsius(-40)
1.0000000000000002 # dimensionless
>>> celsius * 17 + fahrenheit * 18
27 K # temperatureBy default, Noether shows all units in SI. However, you can use the @ symbol to convert a unit:
>>> mph(30)
13.4112 m / s # speed
>>> c @ mph
670616629.384 mph # speedYou can use & to chain display units:
>>> meter(2) @ foot & inch
6.0 ft + 6.740157480314957 in # length
>>> year / 4 @ human_time # = year & day & hour ...
91.0 d + 7.0 hr + 30.0 min # timeIf you want to more permanently work in a unit set, display.register() and display.unregister() are useful:
>>> display.register(foot & inch, stone & pound)
>>> kilogram
kilogram # mass, 2.2046226218487757 lbTODO
TODO
TODO
Documentation is currently for version 1.0.