metrolopy 0.6.3__py3-none-any.whl → 0.6.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metrolopy/budget.py +1 -1
- metrolopy/dfunc.py +4 -1
- metrolopy/distributions.py +1 -1
- metrolopy/fit.py +3 -3
- metrolopy/gummy.py +10 -9
- metrolopy/tests/__init__.py +0 -2
- metrolopy/tests/test_complex.py +137 -132
- metrolopy/tests/test_create.py +347 -343
- metrolopy/tests/test_gummy.py +639 -637
- metrolopy/tests/test_misc.py +94 -80
- metrolopy/tests/test_operations.py +337 -330
- metrolopy/tests/test_ubreakdown.py +335 -310
- metrolopy/unitparser.py +2 -2
- metrolopy/version.py +2 -2
- {metrolopy-0.6.3.dist-info → metrolopy-0.6.5.dist-info}/METADATA +102 -95
- {metrolopy-0.6.3.dist-info → metrolopy-0.6.5.dist-info}/RECORD +20 -20
- {metrolopy-0.6.3.dist-info → metrolopy-0.6.5.dist-info}/WHEEL +1 -1
- {metrolopy-0.6.3.dist-info → metrolopy-0.6.5.dist-info/licenses}/LICENSE +0 -0
- {metrolopy-0.6.3.dist-info → metrolopy-0.6.5.dist-info}/top_level.txt +0 -0
- {metrolopy-0.6.3.dist-info → metrolopy-0.6.5.dist-info}/zip-safe +0 -0
metrolopy/unitparser.py
CHANGED
|
@@ -134,7 +134,7 @@ class _UnitParser:
|
|
|
134
134
|
c = self.txt[self.i]
|
|
135
135
|
if c == '(':
|
|
136
136
|
if par == 0:
|
|
137
|
-
if cl.
|
|
137
|
+
if cl.isspace() or cl == '*':
|
|
138
138
|
f = float(et)
|
|
139
139
|
if np.modf(f)[0] == 0:
|
|
140
140
|
return int(f)
|
|
@@ -147,7 +147,7 @@ class _UnitParser:
|
|
|
147
147
|
else:
|
|
148
148
|
par += 1
|
|
149
149
|
elif c == '[':
|
|
150
|
-
if cl.
|
|
150
|
+
if cl.isspace() or cl == '*':
|
|
151
151
|
f = float(et)
|
|
152
152
|
if np.modf(f)[0] == 0:
|
|
153
153
|
return int(f)
|
metrolopy/version.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# module version
|
|
4
4
|
|
|
5
|
-
# Copyright (C)
|
|
5
|
+
# Copyright (C) 2025 National Research Council Canada
|
|
6
6
|
# Author: Harold Parks
|
|
7
7
|
|
|
8
8
|
# This file is part of MetroloPy.
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
# You should have received a copy of the GNU General Public License along with
|
|
21
21
|
# MetroloPy. If not, see <http://www.gnu.org/licenses/>.
|
|
22
22
|
|
|
23
|
-
__version__ = '0.6.
|
|
23
|
+
__version__ = '0.6.5'
|
|
@@ -1,95 +1,102 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name: metrolopy
|
|
3
|
-
Version: 0.6.
|
|
4
|
-
Summary: tools for dealing with measured quantities: uncertainty propagation and unit conversion
|
|
5
|
-
Home-page: http://nrc-cnrc.github.io/MetroloPy/
|
|
6
|
-
Author: Harold Parks, National Research Council Canada
|
|
7
|
-
Author-email: parksh@nrc.ca
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Classifier:
|
|
11
|
-
Classifier:
|
|
12
|
-
Classifier:
|
|
13
|
-
Classifier:
|
|
14
|
-
Classifier:
|
|
15
|
-
Classifier:
|
|
16
|
-
Classifier:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
>>>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: metrolopy
|
|
3
|
+
Version: 0.6.5
|
|
4
|
+
Summary: tools for dealing with measured quantities: uncertainty propagation and unit conversion
|
|
5
|
+
Home-page: http://nrc-cnrc.github.io/MetroloPy/
|
|
6
|
+
Author: Harold Parks, National Research Council Canada
|
|
7
|
+
Author-email: parksh@nrc.ca
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: Jupyter
|
|
12
|
+
Classifier: Framework :: IPython
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
17
|
+
Requires-Python: >=3.5
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: numpy>=1.13
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Provides-Extra: pretty
|
|
25
|
+
Requires-Dist: IPython; extra == "pretty"
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: provides-extra
|
|
34
|
+
Dynamic: requires-dist
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
Dynamic: summary
|
|
37
|
+
|
|
38
|
+
# MetroloPy
|
|
39
|
+
|
|
40
|
+
tools for dealing with physical quantities: uncertainty propagation and unit conversion
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
Install MetroloPy with `pip install metrolopy` or
|
|
47
|
+
`conda install -c conda-forge metrolopy`.
|
|
48
|
+
|
|
49
|
+
Physical quantities can then be represented in Python as `gummy` objects with an uncertainty and (or) a unit:
|
|
50
|
+
|
|
51
|
+
<pre><code>>>> import metrolopy as uc
|
|
52
|
+
>>> a = uc.gummy(1.2345,u=0.0234,unit='cm')
|
|
53
|
+
>>> a
|
|
54
|
+
1.234(23) cm
|
|
55
|
+
|
|
56
|
+
>>> b = uc.gummy(3.034,u=0.174,unit='mm')
|
|
57
|
+
>>> f = uc.gummy(uc.UniformDist(center=0.9345,half_width=0.096),unit='N')
|
|
58
|
+
>>> p = f/(a*b)
|
|
59
|
+
>>> p
|
|
60
|
+
2.50(21) N/cm<sup>2</sup>
|
|
61
|
+
|
|
62
|
+
>>> p.unit = 'kPa'
|
|
63
|
+
>>> p.uunit = '%'
|
|
64
|
+
>>> p
|
|
65
|
+
25.0 kPa ± 8.5%
|
|
66
|
+
</code></pre>
|
|
67
|
+
|
|
68
|
+
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:
|
|
69
|
+
|
|
70
|
+
* [a tutorial](https://nrc-cnrc.github.io/MetroloPy/_build/html/_static/tutorial.html) (or <a href="https://nrc-cnrc.github.io/MetroloPy/_build/html/_downloads/tutorial.ipynb" download> download the tutorial as Jupyter notebook</a>)
|
|
71
|
+
* [the documentation](https://nrc-cnrc.github.io/MetroloPy/)
|
|
72
|
+
* [the issues page on GitHub](https://github.com/nrc-cnrc/Metrolopy/issues)
|
|
73
|
+
* [a list of the units built into MetroloPy](https://nrc-cnrc.github.io/MetroloPy/_static/units.html)
|
|
74
|
+
* [a list of the physical constants built into MetroloPy](https://nrc-cnrc.github.io/MetroloPy/_static/constants.html)
|
|
75
|
+
|
|
76
|
+
## new in version 0.6.0
|
|
77
|
+
|
|
78
|
+
* A constant library has been added with physical constants that can be accessed
|
|
79
|
+
by name or alias with the `constant` function. The `search_constants` function
|
|
80
|
+
with no argument gives a listing of all built-in constants. Each constant
|
|
81
|
+
definition includes any correlations with other constants.
|
|
82
|
+
|
|
83
|
+
* The `Quantity` class has been added to represent a general numerical value
|
|
84
|
+
multiplied by a unit and the `unit` function has been added to retrieve
|
|
85
|
+
`Unit` instances from the unit library by name or alias. `Unit` instances
|
|
86
|
+
can now be multiplied and divided by other `Unit` instances to produce
|
|
87
|
+
composite units, can be multiplied and divided by numbers to produce
|
|
88
|
+
`Quantity` instances or multiply or divide `Quantity` instances. The
|
|
89
|
+
`gummy` class is now a subclass of `Quantity` with a `nummy` value rather
|
|
90
|
+
than a subclass of `nummy`. A `QuantityArray` class has been introduced
|
|
91
|
+
to represent an array of values all with the same unit. Multiplying a `Unit`
|
|
92
|
+
instance by a list, tuple, or numpy array produces a `QuantityArray` instance.
|
|
93
|
+
|
|
94
|
+
* The `immy` class has been introduced as an `ummy` valued counterpart of the
|
|
95
|
+
`jummy` class for representing complex values with uncertainties. `immy`
|
|
96
|
+
and `jummy` values can now be displayed in a polar representation in addition
|
|
97
|
+
to a cartesian representation. `immy` and `jummy` .r and .phi properties
|
|
98
|
+
have been added to access the magnitude and argument of the values as a
|
|
99
|
+
complement to the .real and .imag properties.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
metrolopy/__init__.py,sha256=0v85v_dekYLX9ZdvqWL5G9mYAhWmGB6BjhpKDQ590O8,1567
|
|
2
|
-
metrolopy/budget.py,sha256=
|
|
2
|
+
metrolopy/budget.py,sha256=UFABTvfJvOyI_a8BX6BtJTjAJA-ufZ2YYW1lf7B2GgA,51388
|
|
3
3
|
metrolopy/codata2018.py,sha256=LBQwebsLZ_ZqPdfLYkY0770C0bQUgglvVXazZg4y8OM,37547
|
|
4
4
|
metrolopy/constant.py,sha256=2wz1FT850DEwLW6Ai6C3golEZGBQWuTKn8MMrQMA_PY,16083
|
|
5
5
|
metrolopy/constcom.py,sha256=ZVNaFcOVOQQ__Vm56hUyiPp4796IA7dotpDG5rBIw4w,7917
|
|
6
|
-
metrolopy/dfunc.py,sha256=
|
|
7
|
-
metrolopy/distributions.py,sha256=
|
|
6
|
+
metrolopy/dfunc.py,sha256=_0XvFeOHfZzZp4vZZ1LRCSg2QEIEFvmVjm_DUMjtJLU,12439
|
|
7
|
+
metrolopy/distributions.py,sha256=oIRBgkU_S_kaBzQJcf-ydITVhMRUsc58yjL0wtmuUP0,45680
|
|
8
8
|
metrolopy/exceptions.py,sha256=tISrU8mLvqLCcan32n-wFnR2oj2-wICjbnYk0RGT0Jc,1804
|
|
9
|
-
metrolopy/fit.py,sha256=
|
|
9
|
+
metrolopy/fit.py,sha256=DFi6drCOUiJqZTvD8lfh59D4pgSZrm9RYrcDp-4yQyc,101138
|
|
10
10
|
metrolopy/functions.py,sha256=EIXvpqgeZ1iVFD8ygPByvWsp6EEvQ3qHBro9bX6YZqs,10051
|
|
11
|
-
metrolopy/gummy.py,sha256=
|
|
11
|
+
metrolopy/gummy.py,sha256=3MU0DZERggsH0gaV8yMVvJOr04VnDF3AAAQrzAqT2Ww,141054
|
|
12
12
|
metrolopy/indexed.py,sha256=wFgTeCOKcZFVxUCsNhjyqWCmG3rbgk2t04m4kQ6AFew,6676
|
|
13
13
|
metrolopy/license.txt,sha256=hOKIMVY_W-ijJs8Q2Xo7gf2LE_r88c7eYO3-n0FYyFs,33041
|
|
14
14
|
metrolopy/logunit.py,sha256=pvo5j2TpR4yXcTEBKZPBht1blDFTfNRRMojV4Wgap3k,7468
|
|
@@ -24,21 +24,21 @@ metrolopy/relunits.py,sha256=L3rvCpwWgUJa3ec-fYmf_UwfyI2DypoJnkQWjnIKgQA,2193
|
|
|
24
24
|
metrolopy/siunits.py,sha256=TppienkBMQ4ndF43ed-GE6gyKitkKiWa4oOmr75u-tU,8541
|
|
25
25
|
metrolopy/ummy.py,sha256=klkvVauuWRDckQLYySPFjNHk2dukDfLUs6u7X0oaFpc,74302
|
|
26
26
|
metrolopy/unit.py,sha256=SG7pxcNlMGzMat9UO3KfmUF72LKZHTTTfhoDMk_gf7M,61159
|
|
27
|
-
metrolopy/unitparser.py,sha256=
|
|
27
|
+
metrolopy/unitparser.py,sha256=nCXbA3S-0AG2QoSqvylGB01U_O_OOFLR-clxPlw75DM,9578
|
|
28
28
|
metrolopy/unitutils.py,sha256=vkVJK1X2QcVbspW6A0BvBw4_FcAsoij2epmJdwEuKSc,12687
|
|
29
29
|
metrolopy/usunits.py,sha256=FivB92A0lwCf0Ptie9z1EVKTS-v79oYaLBuqn0Jx4nA,11202
|
|
30
|
-
metrolopy/version.py,sha256=
|
|
31
|
-
metrolopy/tests/__init__.py,sha256=
|
|
30
|
+
metrolopy/version.py,sha256=qdP-E9kxZGFATxDBBjyf2fDZFPlwZIqavNaAvbZSAP0,829
|
|
31
|
+
metrolopy/tests/__init__.py,sha256=J9UlhmiF967vTW40zh2tBFFDOf8rOP9ep4LKaMtXkw8,199
|
|
32
32
|
metrolopy/tests/common.py,sha256=-AUUXiz5vuORxpYDKdUkUG9j6jLRVp5fBGRlRTKI0kE,3474
|
|
33
|
-
metrolopy/tests/test_complex.py,sha256=
|
|
34
|
-
metrolopy/tests/test_create.py,sha256=
|
|
35
|
-
metrolopy/tests/test_gummy.py,sha256=
|
|
36
|
-
metrolopy/tests/test_misc.py,sha256=
|
|
37
|
-
metrolopy/tests/test_operations.py,sha256=
|
|
38
|
-
metrolopy/tests/test_ubreakdown.py,sha256=
|
|
39
|
-
metrolopy-0.6.
|
|
40
|
-
metrolopy-0.6.
|
|
41
|
-
metrolopy-0.6.
|
|
42
|
-
metrolopy-0.6.
|
|
43
|
-
metrolopy-0.6.
|
|
44
|
-
metrolopy-0.6.
|
|
33
|
+
metrolopy/tests/test_complex.py,sha256=pSKujsTr8smV21_3JbPdeJxVVtgUqjPm6lOGw3-1NI0,7862
|
|
34
|
+
metrolopy/tests/test_create.py,sha256=k0boYIdTL0m2m5GRnf6U6kKh0QwgjN8WNCcF0wvI32E,17886
|
|
35
|
+
metrolopy/tests/test_gummy.py,sha256=EGIqGSBM8VmoiSx5B_0lV-cPa-a6LXVWAMdYZRlYJ1Y,23248
|
|
36
|
+
metrolopy/tests/test_misc.py,sha256=lGlrZyAoWaKKTjyOpS7b8Zu79shOSvX5AQAnxdkCSnA,4325
|
|
37
|
+
metrolopy/tests/test_operations.py,sha256=VXGA9cVQL-eGeAdfIHryF8Hf8TeN8uOlZ7VRgdSsBYQ,12944
|
|
38
|
+
metrolopy/tests/test_ubreakdown.py,sha256=r1IlMa2cB8iOAq0AmCOqgZ9L2WvBaZvfdml3Xhcx6Qk,13655
|
|
39
|
+
metrolopy-0.6.5.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
40
|
+
metrolopy-0.6.5.dist-info/METADATA,sha256=PG1GF7ohO45sTQtBdYnfAMzy8fIO06DPEFXNwbT413E,4586
|
|
41
|
+
metrolopy-0.6.5.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
42
|
+
metrolopy-0.6.5.dist-info/top_level.txt,sha256=TTY_Gf2M3yWScmUStgI-RYOc0YKVcr108GaTl4sedSo,10
|
|
43
|
+
metrolopy-0.6.5.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
44
|
+
metrolopy-0.6.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|