diff --git a/.DS_Store b/.DS_Store
index 6bb4f15..4a15d2a 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/README.md b/README.md
index 6550998..edfc02e 100644
--- a/README.md
+++ b/README.md
@@ -33,8 +33,10 @@ MetroloPy can do much more including Monte-Carlo uncertainty propagation, genera
* [a tutorial](https://nrc-cnrc.github.io/MetroloPy/_build/html/_static/tutorial.html) (or download the tutorial as Jupyter notebook)
* [the documentation](https://nrc-cnrc.github.io/MetroloPy/)
* [the issues page on GitHub](https://github.com/nrc-cnrc/Metrolopy/issues)
+* [a list of the units built into MetroloPy](https://nrc-cnrc.github.io/MetroloPy/_static/units.html)
+* [a list of the physical constants built into MetroloPy](https://nrc-cnrc.github.io/MetroloPy/_static/constants.html)
-## New in version 0.6.0
+## 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 `constant` function. The `search_constants` function
diff --git a/dist/metrolopy-0.5.7-py3-none-any.whl b/dist/metrolopy-0.5.7-py3-none-any.whl
deleted file mode 100644
index c2d704b..0000000
Binary files a/dist/metrolopy-0.5.7-py3-none-any.whl and /dev/null differ
diff --git a/dist/metrolopy-0.5.7.tar.gz b/dist/metrolopy-0.5.7.tar.gz
deleted file mode 100644
index 3bd5a4f..0000000
Binary files a/dist/metrolopy-0.5.7.tar.gz and /dev/null differ
diff --git a/dist/metrolopy-0.6.0-py3-none-any.whl b/dist/metrolopy-0.6.0-py3-none-any.whl
new file mode 100644
index 0000000..411d6ad
Binary files /dev/null and b/dist/metrolopy-0.6.0-py3-none-any.whl differ
diff --git a/dist/metrolopy-0.6.0.tar.gz b/dist/metrolopy-0.6.0.tar.gz
new file mode 100644
index 0000000..770f154
Binary files /dev/null and b/dist/metrolopy-0.6.0.tar.gz differ
diff --git a/docs/.DS_Store b/docs/.DS_Store
index c2d8f23..10d89e6 100644
Binary files a/docs/.DS_Store and b/docs/.DS_Store differ
diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle
index 55cdfbb..752212a 100644
Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ
diff --git a/docs/_build/doctrees/hand_made_doc.doctree b/docs/_build/doctrees/hand_made_doc.doctree
index bd63c89..be4d1a7 100644
Binary files a/docs/_build/doctrees/hand_made_doc.doctree and b/docs/_build/doctrees/hand_made_doc.doctree differ
diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree
index f221fc5..b821286 100644
Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ
diff --git a/docs/_build/doctrees/metrolopy.doctree b/docs/_build/doctrees/metrolopy.doctree
index 68eb0ca..091b86d 100644
Binary files a/docs/_build/doctrees/metrolopy.doctree and b/docs/_build/doctrees/metrolopy.doctree differ
diff --git a/docs/_build/html/_sources/hand_made_doc.rst.txt b/docs/_build/html/_sources/hand_made_doc.rst.txt
index fa19c6a..171491b 100644
--- a/docs/_build/html/_sources/hand_made_doc.rst.txt
+++ b/docs/_build/html/_sources/hand_made_doc.rst.txt
@@ -4,7 +4,11 @@ MetroloPy
=========
Most of the functionality in the MetroloPy package lies in the
-gummy_ object.
+gummy_ object which combines the functionality of the Unit_ and ``Quantity``
+classes for dealing with units, the ummy_ class for first order propagation
+of uncertainty, and the Distribution_ class for Monte Carlo propagation of
+uncertianty. The ``immy`` and jummy_ classes support calculations with
+complex numbers.
.. _gummy:
@@ -1194,8 +1198,11 @@ class Distribution and sub-classes
The ``Distribution`` class is the abstract base class for objects which
represent the the probability distributions that the gummy Monte-Carlo
samples are drawn from. Instances of these ``Distributions`` can used as
-the *x* parameter when creating gummys. The
-distributions below are built into the gummy package and custom
+the *x* parameter when creating gummys or can be used independantly as
+mathematical operations between ``Distributions`` produce ``Convolutions``.
+See the auto-generated documentation for the ``Distribution`` methods and
+properties.
+The distributions below are built into the gummy package and custom
distributions can also be defined by the user.
.. _arcsindist:
@@ -1547,8 +1554,11 @@ metrolopy.\ **trunc(x)**: x rounded towards zero
class Unit
==========
-The gummy class uses ``Unit`` instances to represent physical units. A
-number of units are loaded with the gummy package. See the
+The gummy class uses ``Unit`` instances to represent physical units or units
+cns be multiplied or divided by other ``Unit`` instances to create composite
+units or multiply or divider numerical values to create ``Quantity`` instances.
+See the auto-generated documentation for the deatils of the ``Quantity`` class.
+A number of units are loaded with the gummy package. See the
search_units_ function to get a list of all
available units. Custom units can also be defined by creating instances
of the ``Unit`` class or a sub-class. Though you
@@ -1560,7 +1570,6 @@ can be accessed using string names. E.g. we can define:
>>> Unit('weird meter','wm',conversion=Conversion('m',0.9144),add_symbol=True)
>>> gummy(3.3,unit='wm')
3.3 wm
-
class metrolopy.\ **Unit(name, symbol, conversion=None,
short_name=None, add_symbol=False,
@@ -1788,7 +1797,8 @@ class
metrolopy.\ **jummy(real=None,imag=None,r=None,phi=None,cov=None,unit=one**
A jummy object represents a complex valued quantity with gummy real and
-imaginary components.
+imaginary components. See the ``immy`` class in the autogenerated docs for
+a class with ``ummy`` real and imaginary components.
jummy parameters
----------------
diff --git a/docs/_build/html/_sources/index.rst.txt b/docs/_build/html/_sources/index.rst.txt
index 9d47735..f3ad0aa 100644
--- a/docs/_build/html/_sources/index.rst.txt
+++ b/docs/_build/html/_sources/index.rst.txt
@@ -1,148 +1,151 @@
-.. metrolopy documentation master file, created by
- sphinx-quickstart on Fri Feb 22 16:15:02 2019.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-.. toctree::
- :maxdepth: 2
- :caption: Contents:
-
-===================
-MetroloPy, the docs
-===================
-
-tools for dealing with physical quantities: uncertainty propagation and unit
-conversion
-
-
-getting started
-===============
-
-MetroloPy is a pure python package and requires Python 3 and the
-`SciPy `_ stack (NumPy, SciPy, Pandas, and IPython).
-It looks best in a `Jupyter notebook `_.
-
+.. metrolopy documentation master file, created by
+ sphinx-quickstart on Fri Feb 22 16:15:02 2019.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+===================
+MetroloPy, the docs
+===================
+
+tools for dealing with physical quantities: uncertainty propagation and unit
+conversion
+
+
+getting started
+===============
+
+MetroloPy is a pure python package and requires Python 3 and the
+`SciPy `_ stack (NumPy, SciPy, Pandas, and IPython).
+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:
-
-.. _gummy: hand_made_doc.html#class-gummy
-
-.. raw:: html
-
-
-
-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`_.
-
-.. _Monte-Carlo uncertainty propagation: _static/tutorial.html#Monte-Carlo-uncertainty-propagation
-
-.. _uncertainty budget tables: _static/tutorial.html#an-uncertainty-budget
-
-.. _curve fitting: _static/tutorial.html#curve-fitting
-
-.. _expanded uncertainties: _static/tutorial.html#expanded-uncertainty
-
-.. _degrees of freedom: _static/tutorial.html#degrees-of-freedom-and-uncertainty-types
-
-.. _correlated quantities: _static/tutorial.html#creating-correlated-gummys
-
-.. _complex valued quantities: hand_made_doc.html#jummy
-
-further reading
-===============
-
-* `a tutorial <_static/tutorial.html>`_ (or :download:`download the tutorial as a Jupyter notebook `)
-* :ref:`the API documentation ` (see the auto-generated docs below for an alternative set of documentation)
-* `a list of the measurement units built into MetroloPy <_static/units.html>`_
-* :ref:`package development and to do `
-* `the issues page on GitHub `_
-* `the source code on GitHub `_
-
-
-the auto-generated docs (indices and tables)
-============================================
-
-These pages were automatically generated from the doc strings in the source
-code. They are slightly more comprehensive but perhaps slightly more confusing
-than the handmade API docs referenced in the further reading section above.
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
-
-Where did the name for the gummy class come from?
-=================================================
-
-The name comes from the
-`JGCM/ISO Guide to the Expression of Uncertainty in Measurement `_
-which is also known as the GUM. The GUM is the international standard used by
-metrology institutes and calibration labs for expressing and propagating
-measurement uncertainty. The gummy object implements many of the
-recommendations outlined in the GUM.
-
-Other references of note are the
-`draft 9th edition of the SI Brochure `_
-which contains the definitions of the SI units, and
-`NIST Special Publication 1038 `_
-where many of the US customary units are defined. Some physical constants
-used for unit definitions are from the
-`2014 CODATA recommended values `_
-and the
-`IAU 2009 system of astronomical constants `_.
-
-
-version history
-===============
-
-* Version 0.5.0, built 26 March 2019, is the first public release.
-* Version 0.5.1, built 2 April 2019, fixed a major bug that generated negative
- uncertainties in some cases and fixed some other minor bugs. Improved support
- for fraction.Fraction and mpmath.mpf values.
-* Version 0.5.2, built 5 April 2019, fixed a major bug that propagated
- uncertainty incorrectly if a gummy was created with an uncertainty set with
- an integer data type. Fixed several other minor bugs.
-* Version 0.5.3, built 10 April 2019, minor bug fixes.
+``conda install -c conda-forge metrolopy``.
+
+Physical quantities can then be represented in Python as `gummy`_ objects
+with an uncertainty and (or) a unit:
+
+.. _gummy: hand_made_doc.html#class-gummy
+
+.. raw:: html
+
+
+
+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`_.
+
+.. _Monte-Carlo uncertainty propagation: _static/tutorial.html#Monte-Carlo-uncertainty-propagation
+
+.. _uncertainty budget tables: _static/tutorial.html#an-uncertainty-budget
+
+.. _curve fitting: _static/tutorial.html#curve-fitting
+
+.. _expanded uncertainties: _static/tutorial.html#expanded-uncertainty
+
+.. _degrees of freedom: _static/tutorial.html#degrees-of-freedom-and-uncertainty-types
+
+.. _correlated quantities: _static/tutorial.html#creating-correlated-gummys
+
+.. _complex valued quantities: hand_made_doc.html#jummy
+
+further reading
+===============
+
+* `a tutorial <_static/tutorial.html>`_ (or :download:`download the tutorial as a Jupyter notebook `)
+* :ref:`the API documentation ` (see the auto-generated docs below for an alternative set of documentation)
+* `a list of the measurement units built into MetroloPy <_static/units.html>`_
+* `a list of the physical constants built into MetroloPy <_static/constants.html>`_
+* :ref:`package development and to do `
+* `the issues page on GitHub `_
+* `the source code on GitHub `_
+
+
+the auto-generated docs (indices and tables)
+============================================
+
+These pages were automatically generated from the doc strings in the source
+code. They are slightly more comprehensive but perhaps slightly more confusing
+than the handmade API docs referenced in the further reading section above.
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+
+Where did the name for the gummy class come from?
+=================================================
+
+The name comes from the
+`JGCM/ISO Guide to the Expression of Uncertainty in Measurement `_
+which is also known as the GUM. The GUM is the international standard used by
+metrology institutes and calibration labs for expressing and propagating
+measurement uncertainty. The gummy object implements many of the
+recommendations outlined in the GUM.
+
+Other references of note are the
+`draft 9th edition of the SI Brochure `_
+which contains the definitions of the SI units, and
+`NIST Special Publication 1038 `_
+where many of the US customary units are defined. Some physical constants
+used for unit definitions are from the
+`2014 CODATA recommended values `_
+and the
+`IAU 2009 system of astronomical constants `_.
+
+
+version history
+===============
+
+* Version 0.5.0, built 26 March 2019, is the first public release.
+* Version 0.5.1, built 2 April 2019, fixed a major bug that generated negative
+ uncertainties in some cases and fixed some other minor bugs. Improved support
+ for fraction.Fraction and mpmath.mpf values.
+* Version 0.5.2, built 5 April 2019, fixed a major bug that propagated
+ uncertainty incorrectly if a gummy was created with an uncertainty set with
+ an integer data type. Fixed several other minor bugs.
+* Version 0.5.3, built 10 April 2019, minor bug fixes.
* Version 0.5.4, built 15 April 2019, minor bug fixes.
* Version 0.5.5, built 7 May 2020, minor bug fixes.
* Version 0.5.6, built 24 September 2020, minor bug fixes.
-* Version 0.5.7, built 26 September 2020, minor change to setup.py.
-
-
-author
-======
-
-Harold Parks, parksh@nrc.ca, National Research Council Canada
-
-
-license
-=======
-
-MetroloPy is distributed as free software under the terms of the
-`GNU General Public License version 3 `_.
-In practice, this license imposes
-no restriction on using MetroloPy. However, if you want to further convey
-verbatim or modified versions of the code you must do so under the same license
-terms. Please contact NRC if you wish to license MetroloPy under different
-terms.
+* Version 0.5.7, built 26 September 2020, minor change to setup.py.
+* Verison 0.6.0, built xx October 2020, added the `Quantity` and `immy` classes
+ as well as a library of physical constants.
+
+
+author
+======
+
+Harold Parks, parksh@nrc.ca, National Research Council Canada
+
+
+license
+=======
+
+MetroloPy is distributed as free software under the terms of the
+`GNU General Public License version 3 `_.
+In practice, this license imposes
+no restriction on using MetroloPy. However, if you want to further convey
+verbatim or modified versions of the code you must do so under the same license
+terms. Please contact NRC if you wish to license MetroloPy under different
+terms.
diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html
index 1d55ef5..c03a821 100644
--- a/docs/_build/html/genindex.html
+++ b/docs/_build/html/genindex.html
@@ -5,7 +5,7 @@
- Index — metrolopy 0.5.7 documentation
+ Index — metrolopy 0.6.0 documentation
@@ -25,7 +25,7 @@
Most of the functionality in the MetroloPy package lies in the
-gummy object.
+gummy object which combines the functionality of the Unit_ and Quantity
+classes for dealing with units, the ummy_ class for first order propagation
+of uncertainty, and the Distribution class for Monte Carlo propagation of
+uncertianty. The immy and jummy classes support calculations with
+complex numbers.
The gummy class uses Unit instances to represent physical units. A
-number of units are loaded with the gummy package. See the
+
The gummy class uses Unit instances to represent physical units or units
+cns be multiplied or divided by other Unit instances to create composite
+units or multiply or divider numerical values to create Quantity instances.
+See the auto-generated documentation for the deatils of the Quantity class.
+A number of units are loaded with the gummy package. See the
search_units function to get a list of all
available units. Custom units can also be defined by creating instances
of the Unit class or a sub-class. Though you
@@ -1591,7 +1601,8 @@
Read/write at the class level, but read-only at the instance level.
+The default value is False; this should only be changed once at the
+beginning of the session. This property affects how the level of
+confidence p (sometimes called coverage probability) of an expanded
+uncertainty is related to the coverage factor k for a gummy based on
+data with finite degrees of freedom.
+
Standard uncertainties are often based on the standard deviation of a set
+of measurements (and the assumption that these measurements are drawn
+from a normally distributed population). Traditionally (e.g. the GUM
+2008 edition) the standard uncertainty is taken to be the standard
+deviation of the mean (s/sqrt(n), where s is the sample standard deviation
+and n is the number of measurements). However there is some “extra
+uncertainty” because the sample standard devation not exactly equal to
+the population standard deviation. This is taken into account by using
+a Student’s t distribution to calculate the expanded uncertainty. However
+it has been pointed out, by those who advocate a Bayesian point of view,
+that the probability distribution for the measurand here is best described
+by a shifted and scaled Student’s t distribution. So the standard
+uncertainty should be the standard deviation of this distribution which
+is s*sqrt{(n-1)/[n*(n-3)]}. Thus
+
u(bayesian) = [dof/(dof - 2)]*u(traditional)
+
where dof = n - 1 and the “extra uncertainty” is incorporated directly
+into the standard uncertainty.
Get or set the method for calculating the confidence interval from
+Monte-Carlo data. If this property is set at the class level, it will
+change the default cimethod value for new gummys but will not affect
+gummys that have already been created.
+
Can be set either to the string ‘shortest’ or the string ‘symmetric’.
+This property gets or sets the method for calculating confidence
+intervals from Monte-Carlo data.
+
If it is set to ‘shortest’, the confidence interval will be taken to be
+the shortest interval that includes the desired fraction of the probability
+distribution.
+
If it is set to ‘symmetric’, then the confidence interval will be set so
+that, for n Monte-Carlo samples and a coverage probability of p, then
+n`*(1-`p)/2 samples lie below the lower limit of the confidence interval
+and the same number of samples lie above the upper limit of the confidence
+interval.
Setting this to True or False forces or prevents scientific notation
+in the display of the value. If this is set to None thr scientific
+notation will be used if the x value is below 10**sci_notation_low or
+above 10**sci_notation_high.
A gummy object represents a numerical value with an uncertainty and (or) a
unit. They can be used in place of float values in Python expressions and
the uncertainty can be propagated with with both first-order and
@@ -3728,6 +3853,78 @@
A classmethod that applies a function to one or more gummy or jummy
+objects propagating the uncertainty.
+
+
Parameters
+
+
function (function) – The the function to be applied. For gummy.apply, ‘function’
+should take one or more float arguments and return a float value
+or float array. For jummy.apply, ‘function’ may also take and
+return complex values.
+
+
derivative (function) – The name of a second function that gives the derivatives
with respect to the arguments of function. derivative should
+take an equal number of arguments as function. If function
+takes one argument derivative should return a float and if
+function takes more than one argument then derivative should
+return a tuple, list or array of floats that contains the derivatives
+with respect to each argument. In the case of jummy.apply, the
+derivatives with respect to each argument may be real or complex
+values, in which case function is assumed to be holomorphic. Or
+the derivative may be a 2 x 2 matrix of the form:
+
+
+
[[ du/dx, du/dy ],
[ dv/dx, dv/dy ]]
+
+
+
+
+
+
where function(x + j*y) = u + j*v.
+
+
*args (gummy, jummy, or float) – One or more arguments to which function will be applied. These
+arguments need not all be Dfunc objects; arguments such as
+floats will be taken to be constants with no uncertainty.
+They may also be numpy ndarrays in which case the usual numpy
+broadcasting rules apply.
+
+
+
Returns
+
If none of the arguments are gummy or jummy
+then the return value is the same type as the return value of function.
+Otherwise gummy.apply returns a gummy and jummy.apply returns either a
+gummy or a jummy depending on whether function has a float or
+a complex return value.
This read-only property is used as a conversion flag during calculations.
-When an arithmetic operation is carried out between two gummys with
-different units, a unit conversion on one of the input quantities may be
-required to complete the calculation. Attach this flag to the unit that
-you prefer be converted.
Returns a copy of the gummy with converted units. This is equivalent
-to calling the copy method and then setting the unit and uunit properties
-on the copied gummy.
-
-
Parameters
-
-
unit (str or Unit) – The unit for the x value and if uunit is None, the
-uncertainty. It must be string, None, a Unit object, or the
-integer 1. Both 1 and None will be interpreted as the Unit
-instance one.
-
uunit `str`, `Unit` or None, optional – The unit for the uncertainty U. If this is None then U
-will have the same units as x. The default is None.
Returns a copy of the gummy. If the formatting parameter is
+True the display formatting information will be copied and if
+False the display formatting will be set to the default for a
+new gummy. The default for formatting is True. If tofloat
+is true the x and u properties will be converted to float values
+before copying.
Returns the number or degrees of freedom that the uncertainty of the
+gummy is based on. If the gummy was created as the result of an
+operation between two or more other gummys, then the dof is the effective
+number of degrees of freedom calculated using the Welch-Satterthwaite
+approximation. Caution: A variation of the the Welch-Satterthwaite
+approximation is used that takes into account correlations, see
+[R. Willink, Metrologia, 44, 340 (2007)]. However correlations are
+not handled perfectly. So if accurate dof calculations are need, care
+should be taken to ensure that correlations are not generated in
+intermediate calculations.
Gets the degrees of freedom contributed from particular gummys or
+utypes if all other free variables are held fixed. Caution: any
+correlations in the calculations can cause errors in dof calculations.
+
+
Parameters
+
x (gummy, str, or array_like) – A gummy, a string referencing a utype or a list containing
+gummys and strings.
Returns a copy of the gummy with different units but the same x and
u values. This is different from gummy.convert(unit) in that
gummy.convert(unit) changes the x and u `values to express the
@@ -3999,14 +4259,10 @@
The expanded uncertainty U (see the U property) is related to
the standard uncertainty u (see the u property) by U = k`*`u.
The coverage factor k can be set directly or the desired level
@@ -4109,6 +4373,13 @@
gummy.napply(function, arg1, arg2, …) and
+jummy.napply(function, arg1, arg2, …)
+
A classmethod that applies a function to one or more gummy or jummy
+objects propagating the uncertainty. This method is similar to apply
+except that the derivatives are computed numerically so a derivative
+function does not need to be supplied.
+
+
Parameters
+
+
function (function) – The the function to be applied. For gummy.apply, ‘function’
+should take one or more float arguments and return a float value
+r float array. For jummy.apply, ‘function’ may also take and
+return complex values.
+
*args (gummy, jummy, or float) – One or more arguments to which function will be applied. These
+arguments need not all be Dfunc objects; arguments such as
+floats will be taken to be constants with no uncertainty.
+They may also be numpy ndarrays in which case the usual numpy
+broadcasting rules apply.
+
+
+
Returns
+
If none of the arguments are gummy or jummy
+then the return value is the same type as the return value of function.
+Otherwise gummy.apply returns a gummy and jummy.apply returns either a
+gummy or a jummy depending on whether function has a float or
+a complex return value.
Returns a string displaying the value of the gummy in the desired format.
The fmt parameter is a string with the value in {“unicode”,”latex”,
“html”,”ascii”} or None. fmt will default to ‘ascii’ if self.printer
@@ -4283,6 +4653,12 @@
Returns a copy of the jummy. If the formatting parameter is
-True the display formatting information will be copied and if
-False the display formatting will be set to the default for a
-new jummy. The default for formatting is True. If the
-tofloats parameter is True x and u for both the real and
-imaginary components will be converted to floats.
Gets or sets the units of jummy.real and jummy.imag. If the
-units of jummy.real are different from jummy.imag then a
-tuple of Unit with length 2 is returned. Otherwise a Unit
-instance is returned.
The nummy object defined here was created as a super-class for gummy,
-integrating the Monte-Carlo uncertainty propagation code in the distributions
-module with the ummy object.
+
The nummy object defined here integrates the Monte-Carlo uncertainty
+propagation code in the distributions module with the ummy object. The nummy
+class is not intended to be used directly; rather it is utilized by the gummy
+class.
Read/write at the class level, but read-only at the instance level.
The default value is False; this should only be changed once at the
@@ -4883,12 +5259,12 @@
str in {‘shortest’, ‘symmetric’}), default is ‘shortest’
Get or set the method for calculating the confidence interval from
Monte-Carlo data. If this property is set at the class level, it will
-change the default cimethod value for new gummys but will not affect
+change the default cimethod value for new gummys but will no affect
gummys that have already been created.
Can be set either to the string ‘shortest’ or the string ‘symmetric’.
This property gets or sets the method for calculating confidence
@@ -4903,36 +5279,6 @@
Setting this property to False turns of the code for Monte-Carlo
-uncertainty propagation. This property should only be set once, before
-any gummy instances are created. Turning mcpropagate off then on again
-may have unpredictable results.
Sets whether to print the value using a cartesian or polar
+representaion. This property can be set at the class or instance
+level. The default is ‘cartesian’.
Returns a copy of the jummy. If the formatting parameter is
+True the display formatting information will be copied and if
+False the display formatting will be set to the default for a
+new jummy. The default for formatting is True. If the
+tofloats parameter is True x and u for both the real and
+imaginary components will be converted to floats.
Returns a copy of the gummy. If the formatting parameter is
+
Returns a copy of the ummy. If the formatting parameter is
True the display formatting information will be copied and if
False the display formatting will be set to the default for a
new gummy. The default for formatting is True. If tofloat
@@ -5521,7 +6005,7 @@
Returns the number or degrees of freedom that the uncertainty of the
-gummy is based on. If the gummy was created as the result of an
+ummy is based on. If the ummy was created as the result of an
operation between two or more other gummys, then the dof is the effective
-number of degrees of freedom calculated using a version of the Welch-
-Satterthwaite approximation that takes into account correlations, see
-[R. Willink, Metrologia, 44, 340 (2007)].
+number of degrees of freedom calculated using the Welch-Satterthwaite
+approximation. Caution: A variation of the the Welch-Satterthwaite
+approximation is used that takes into account correlations, see
+[R. Willink, Metrologia, 44, 340 (2007)]. However correlations are
+not handled perfectly. So if accurate dof calculations are need, care
+should be taken to ensure that correlations are not generated in
+intermediate calculations.
Gets the degrees of freedom contributed from particular gummys or
-utypes if all other free variables are held fixed.
+
Gets the degrees of freedom contributed from particular ummys or
+utypes if all other free variables are held fixed. Caution: any
+correlations in the calculations can cause errors in dof calculations.
Parameters
-
x (gummy, str, or array_like) – A gummy, a string referencing a utype or a list containing
-gummys and strings.
+
x (ummy, str, or array_like) – A ummy, a string referencing a utype or a list containing
+ummys and strings.
Represents a unit conversion. This class should only be used as arguments
-to Unit object initializers. Each conversion should be associated with one
-and only one parent Unit.
+to Unit object initializers. Each conversion should be associated with
+one and only one parent Unit; do not re-use conversion instances with more
+than one Unit instance.
+
The base Conversion class is defined by a single conversion factor.
+More comlicated conversions overriding the to and frm methods should
+inherit from the NonlinearConversion subclass and be used with units
+that inherit from the NonlinearUnit subclass.
Parameters
unit (str or Unit) – the Unit that the parent Unit will be converted to.
factor (float, optional) – The conversion factor between the parent Unit and the new Unit:
-[value with new Unit] = factor * [value with parent Unit]
-The default value is 1
+[value with new Unit] = factor * [value with parent Unit]. The
+conversion factor may not have a unit, but may be an ummy of gummy
+with not unit one. The default value is 1.
Instances of this class represent a quantity with a value and a unit.
+The behavior of Quantity instances under mathematical operations with
+other Quanitity object or numerical values depends on the unit. E.g.
+an interger of float may be added to Quantity(1,unit=’%’) but not to
+Quantity(1,unit=’m/s’). For operations involving only linear units, the
+units will be automatically converted to facilitate the operation, e.g.
+Quantity(1,unit=’psi’) may be added to Quantity(1,unit=’psi’) but not
+Quantity(1,unit=’db(uPa)’. Manual unit conversions can be realized by
+calling the `Quantity.convert method, or in place by setting the
+Quantity.unit property.
+
Quantity instances may be created directly or by multiplying or dividing
+a number by a Unit instance: Quantity(2.2,unit=’cm’) is equivalent to
+2.2 * unit(‘cm’).
+
+
Parameters
+
+
value (number like including ummy) – the value of the Quantity
+
unit (str or Unit) – The Unit instance representing the unit of the Quantity or a string
+that references the Unit instance.
This read-only property is used as a conversion flag during calculations.
+When an arithmetic operation is carried out between two Quantaties with
+different units, a unit conversion on one of the input quantities may be
+required to complete the calculation. Attach this flag to the unit that
+you prefer be converted.
+
Examples
+
>>> a=Quantity(1,unit='cm')
+>>> b=Quantity(2,unit='mm')
+>>> a+b
+1.2 cm
+>>> a.c+b
+12 mm
+>>> a+b.c
+1.2 cm
+>>> a*b
+0.2 cm**2
+>>>a.c*b
+20 mm**2
+
Returns a copy of the Quantity with converted units. A
+NoUnitConversionFoundError will be raised if the unit conversion is
+not possible.
+
+
Parameters
+
+
unit (str or Unit) – The unit for the x value and if uunit is None, the
+uncertainty. It must be string, None, a Unit object, or the
+integer 1. Both 1 and None will be interpreted as the Unit
+instance one.
+
uunit `str`, `Unit` or None, optional – The unit for the uncertainty U. If this is None then U
+will have the same units as x. The default is None.
If this property is set, a unit conversion will be performed. The value
+it is set to may be a string, None, a Unit object, or the integer 1.
+Both 1 and None will be interpreted as the Unit instance one. A
+NoUnitConversionFoundError will be raised if the unit conversion is
+not possible.
+
Example
+
>>> x=Quantity(0.001,unit='V')
+>>> x
+0.001 V
+>>> x.unit='uV'
+>>> x
+1000.0 uV
+
A subclass of Quantity. Instance of this class represent a list, tuple,
+or numpy array of values all with the same unit. Elements of the array
+are returned as Quantity instances. Instances of this class can be
+created directly or by multiplying a list, tuple, or numpy array by a
+Unit instance.
+
+
Parameters
+
+
value (list, tuple or ndarray) – the value of the Quantity
+
unit (str or Unit) – The Unit instance representing the unit of the Quantity or a string
+that references the Unit instance.
Creating an instance of this class creates a representation of a physical
-unit and adds it to the unit library. Units already in the unit library or
-derived units made up of other units in the unit library can be accessed
-by passing a text string with the unit name or symbol to the static method
-Unit.unit.
+unit and adds it to the unit library. Once created the unit intance may
+be retrived by passing a string with the unit name or alias to the unit
+or Unit.unit functions. Units can be multiplied and divided by other
+Units or Quantities and raised to numerical powers. Multiplying or
+dividing a numerical value by a Unit will create a Quantity instance.
Parameters
name (str) – The name of the unit. The name can be used access the unit with the
-Unit.unit method, but note that if you define a Unit with an
+unit function, but note that if you define a Unit with an
identical name to a previously defined unit then the older name will
be shadowed.
symbol (str) – A unicode symbol used when displaying the unit. If the add_symbol
parameter is set to True, then this symbol can also be used
-to access the unit with the Unit.unit method.
+to access the unit with the unit function.
conversion (Conversion or None, optional) – A conversion to another unit. When creating units be careful to avoid
circular conversions, i.e. you can define:
Gets a bool value indicating whether the Unit is linear. If the
+unit is linear then any associated values will follow the standard
+rules of arithmatic for Quantaties and the unit’s Conversion is
+defined by multiplying or dividing by a single conversion factor.
+Nonlinear units may have a more complicated conversion and may
+override the unusal operator methods.
Returns a string containing the symbol for the unit the format given by
-the keyword fmt which may be set to a string the values ‘html’, ‘latex’,
-‘ascii’, or ‘unicode’.
Finds an returns a Unit object from the Unit library.
+
Finds an returns a Unit from the unit library.
Parameters
-
txt – str, Unit or 1
-This may be a string representing the unit. The string can
+
txt (str, Unit or 1) – This may be a string representing the unit. The string can
contain the name, short name or (if the unit was created
with add_symbol set to True) the symbol of the unit or a
combination of names and/or symbols of several different
@@ -5958,13 +6599,19 @@
Finds an returns a Unit from the unit library. This function is an
+alias for the Unit.unit static method.
+
+
Parameters
+
+
txt (str, Unit or 1) – This may be a string representing the unit. The string can
+contain the name, short name or (if the unit was created
+with add_symbol set to True) the symbol of the unit or a
+combination of names and/or symbols of several different
+units. Spaces or the character ‘*’ represent multiplication,
+the character ‘/’ represents division and the string ‘**’
+represents the power operator. For example txt can be:
+
‘kg m**2/s’
+
or equivalently:
+
‘kilogram*metre*metre*second**-1’ or ‘(kg/s)*m**2’.
+
If a unit name contains a space, ‘*’ or ‘/’ character then the
+name must be enclosed in square brackets, e.g:
+
[light year]
+
If txt is a Unit instance that instance is returned.
+
+
exception (bool, optional) – If this is True then a UnitNotFoundError or UnitLibError
+is raised if a unit is not found that matches txt. If it is
+False and a unit is not found, then Unit.unit returns
+None without raising an exception. The default is True.
+
+
+
Returns
+
+
A Unit instance or possibly None if the exception parameter is