tools for dealing with measured quantities: uncertainty propagation and unit conversion
tools for dealing with physical quantities: uncertainty propagation and unit conversion
MetroloPy is a pure python package and requires Python 3.5 or later and the SciPy stack (NumPy, SciPy and Pandas). It looks best in a Jupyter Notebook.
Install MetroloPy with
pip install metrolopy or
conda install -c conda-forge metrolopy.
Physical quantities can then be represented in Python as
gummy objects with an uncertainty and (or) a unit:
>>> import metrolopy as uc >>> a = uc.gummy(1.2345,u=0.0234,unit='cm') >>> a 1.234(23) cm >>> b = uc.gummy(3.034,u=0.174,unit='mm') >>> f = uc.gummy(uc.UniformDist(center=0.9345,half_width=0.096),unit='N') >>> p = f/(a*b) >>> p 2.50(21) N/cm2 >>> p.unit = 'kPa' >>> p.uunit = '%' >>> p 25.0 kPa ± 8.5%
MetroloPy can do much more including Monte-Carlo uncertainty propagation, generating uncertainty budget tables, and curve fitting. It can also handle expanded uncertainties, degrees of freedom, correlated quantities, and complex valued quantities. See:
- a tutorial (or download the tutorial as Jupyter notebook)
- the documentation
- the issues page on GitHub
- a list of the units built into MetroloPy
- a list of the physical constants built into MetroloPy
new in version 0.6.0
A constant library has been added with physical constants that can be accessed by name or alias with the
search_constantsfunction with no argument gives a listing of all built-in constants. Each constant definition includes any correlations with other constants.
Quantityclass has been added to represent a general numerical value multiplied by a unit and the
unitfunction has been added to retrieve
Unitinstances from the unit library by name or alias.
Unitinstances can now be multiplied and divided by other
Unitinstances to produce composite units, can be multiplied and divided by numbers to produce
Quantityinstances or multiply or divide
gummyclass is now a subclass of
nummyvalue rather than a subclass of
QuantityArrayclass has been introduced to represent an array of values all with the same unit. Multiplying a
Unitinstance by a list, tuple, or numpy array produces a
immyclass has been introduced as an
ummyvalued counterpart of the
jummyclass for representing complex values with uncertainties.
jummyvalues can now be displayed in a polar representation in addition to a cartesian representation.
jummy.r and .phi properties have been added to access the magnitude and argument of the values as a complement to the .real and .imag properties.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size metrolopy-0.6.1-py3-none-any.whl (188.5 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size metrolopy-0.6.1.tar.gz (157.1 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for metrolopy-0.6.1-py3-none-any.whl