From c70c0765f5c81c54a680045f872efe50a5c83425 Mon Sep 17 00:00:00 2001 From: znichollscr <114576287+znichollscr@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:23:54 +0100 Subject: [PATCH 01/11] Add docs for testing module (#2070) --- CHANGES | 4 ++-- docs/conf.py | 1 + docs/ecosystem.rst | 2 +- pint/testing.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 8b2fe9ec8..07328fb1c 100644 --- a/CHANGES +++ b/CHANGES @@ -4,7 +4,7 @@ Pint Changelog 0.25.0 (unreleased) ------------------- -- Nothing changed yet +- Add docs to the functions in ``pint.testing`` (PR #2070) 0.24.4 (2024-11-07) @@ -32,7 +32,7 @@ Pint Changelog 0.24.1 (2024-06-24) ------------------ +------------------- - Fix custom formatter needing the registry object. (PR #2011) - Support python 3.9 following difficulties installing with NumPy 2. (PR #2019) diff --git a/docs/conf.py b/docs/conf.py index d856e1075..b27bff94a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,6 +45,7 @@ "sphinx_design", ] + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/ecosystem.rst b/docs/ecosystem.rst index c83c52f49..95a73bd45 100644 --- a/docs/ecosystem.rst +++ b/docs/ecosystem.rst @@ -13,7 +13,7 @@ Pint integrations: Packages using pint: ------------------- +-------------------- - `fluids `_ Practical fluid dynamics calculations - `ht `_ Practical heat transfer calculations diff --git a/pint/testing.py b/pint/testing.py index 21a1f55dd..c5508d8d2 100644 --- a/pint/testing.py +++ b/pint/testing.py @@ -1,3 +1,13 @@ +""" + pint.testing + ~~~~~~~~~~~~ + + Functions for testing whether pint quantities are equal. + + :copyright: 2016 by Pint Authors, see AUTHORS for more details.. + :license: BSD, see LICENSE for more details. +""" + from __future__ import annotations import math @@ -35,6 +45,25 @@ def _get_comparable_magnitudes(first, second, msg): def assert_equal(first, second, msg: str | None = None) -> None: + """ + Assert that two quantities are equal + + Parameters + ---------- + first + First quantity to compare + + second + Second quantity to compare + + msg + If supplied, message to show if the two quantities aren't equal. + + Raises + ------ + AssertionError + The two quantities are not equal. + """ if msg is None: msg = f"Comparing {first!r} and {second!r}. " @@ -60,6 +89,33 @@ def assert_equal(first, second, msg: str | None = None) -> None: def assert_allclose( first, second, rtol: float = 1e-07, atol: float = 0, msg: str | None = None ) -> None: + """ + Assert that two quantities are all close + + Unlike numpy, this uses a symmetric check of closeness. + + Parameters + ---------- + first + First quantity to compare + + second + Second quantity to compare + + rtol + Relative tolerance to use when checking for closeness. + + atol + Absolute tolerance to use when checking for closeness. + + msg + If supplied, message to show if the two quantities aren't equal. + + Raises + ------ + AssertionError + The two quantities are not close to within the supplied tolerance. + """ if msg is None: try: msg = f"Comparing {first!r} and {second!r}. " From b4369022050cc545f30cbd230365205f4ac3944b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20Ch=C3=A9ron?= Date: Tue, 10 Dec 2024 22:21:17 +0100 Subject: [PATCH 02/11] fix: Fix round function returning `float` instead of `int` (#2089) Fix #2081 --- CHANGES | 1 + pint/facets/plain/quantity.py | 12 ++++++------ pint/testsuite/test_quantity.py | 5 +++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 07328fb1c..e592ac1d6 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Pint Changelog ------------------- - Add docs to the functions in ``pint.testing`` (PR #2070) +- Fix round function returning float instead of int (#2081) 0.24.4 (2024-11-07) diff --git a/pint/facets/plain/quantity.py b/pint/facets/plain/quantity.py index a18919273..e70a02c88 100644 --- a/pint/facets/plain/quantity.py +++ b/pint/facets/plain/quantity.py @@ -1,9 +1,9 @@ """ - pint.facets.plain.quantity - ~~~~~~~~~~~~~~~~~~~~~~~~~ +pint.facets.plain.quantity +~~~~~~~~~~~~~~~~~~~~~~~~~ - :copyright: 2022 by Pint Authors, see AUTHORS for more details. - :license: BSD, see LICENSE for more details. +:copyright: 2022 by Pint Authors, see AUTHORS for more details. +:license: BSD, see LICENSE for more details. """ from __future__ import annotations @@ -1288,8 +1288,8 @@ def __rpow__(self, other) -> PlainQuantity[MagnitudeT]: def __abs__(self) -> PlainQuantity[MagnitudeT]: return self.__class__(abs(self._magnitude), self._units) - def __round__(self, ndigits: int | None = 0) -> PlainQuantity[MagnitudeT]: - return self.__class__(round(self._magnitude, ndigits=ndigits), self._units) + def __round__(self, ndigits: int | None = None) -> PlainQuantity[int]: + return self.__class__(round(self._magnitude, ndigits), self._units) def __pos__(self) -> PlainQuantity[MagnitudeT]: return self.__class__(operator.pos(self._magnitude), self._units) diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py index 26a5ee05d..6f173216c 100644 --- a/pint/testsuite/test_quantity.py +++ b/pint/testsuite/test_quantity.py @@ -60,6 +60,11 @@ def test_quantity_creation(self, caplog): assert 4.2 * self.ureg.meter == self.Q_(4.2, 2 * self.ureg.meter) assert len(caplog.records) == 1 + def test_round(self): + x = self.Q_(1.1, "kg") + assert isinstance(round(x).magnitude, int) + assert isinstance(round(x, 0).magnitude, float) + def test_quantity_with_quantity(self): x = self.Q_(4.2, "m") assert self.Q_(x, "m").magnitude == 4.2 From 2bdf58cee9e8fcbbea3d0d2f877c41bccec5d737 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 13 Dec 2024 18:28:43 -0500 Subject: [PATCH 03/11] bump typing_ext (#2091) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b63f8da99..8a931d122 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ platformdirs>=2.1.0 -typing_extensions>=4.0.0 +typing_extensions>=4.5.0 flexcache>=0.3 flexparser>=0.4 From fadbf7075ea8764d5363ffd401f7f8581848747a Mon Sep 17 00:00:00 2001 From: Jellby Date: Sun, 15 Dec 2024 13:27:37 +0100 Subject: [PATCH 04/11] CODATA 2022 update (#2049) --- CHANGES | 1 + pint/constants_en.txt | 21 +++++------ pint/default_en.txt | 3 -- pint/pint_convert.py | 85 ++++++++++++++++++++++--------------------- 4 files changed, 54 insertions(+), 56 deletions(-) diff --git a/CHANGES b/CHANGES index e592ac1d6..6b3752f03 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Pint Changelog - Add docs to the functions in ``pint.testing`` (PR #2070) - Fix round function returning float instead of int (#2081) +- Update constants to CODATA 2022 recommended values. (#2049) 0.24.4 (2024-11-07) diff --git a/pint/constants_en.txt b/pint/constants_en.txt index 9babc8fa2..2f6fcfb50 100644 --- a/pint/constants_en.txt +++ b/pint/constants_en.txt @@ -46,22 +46,21 @@ wien_wavelength_displacement_law_constant = ℎ * c / (k * wien_x) wien_frequency_displacement_law_constant = wien_u * k / ℎ #### MEASURED CONSTANTS #### -# Recommended CODATA-2018 values +# Recommended CODATA-2022 values # To some extent, what is measured and what is derived is a bit arbitrary. # The choice of measured constants is based on convenience and on available uncertainty. # The uncertainty in the last significant digits is given in parentheses as a comment. newtonian_constant_of_gravitation = 6.67430e-11 m^3/(kg s^2) = _ = gravitational_constant # (15) -rydberg_constant = 1.0973731568160e7 * m^-1 = R_∞ = R_inf # (21) -electron_g_factor = -2.00231930436256 = g_e # (35) -atomic_mass_constant = 1.66053906660e-27 kg = m_u # (50) -electron_mass = 9.1093837015e-31 kg = m_e = atomic_unit_of_mass = a_u_mass # (28) -proton_mass = 1.67262192369e-27 kg = m_p # (51) -neutron_mass = 1.67492749804e-27 kg = m_n # (95) -lattice_spacing_of_Si = 1.920155716e-10 m = d_220 # (32) -K_alpha_Cu_d_220 = 0.80232719 # (22) -K_alpha_Mo_d_220 = 0.36940604 # (19) -K_alpha_W_d_220 = 0.108852175 # (98) +rydberg_constant = 1.0973731568157e7 * m^-1 = R_∞ = R_inf # (12) +electron_g_factor = -2.00231930436092 = g_e # (36) +atomic_mass_constant = 1.66053906892e-27 kg = m_u # (52) +electron_mass = 9.1093837139e-31 kg = m_e = atomic_unit_of_mass = a_u_mass # (28) +proton_mass = 1.67262192595e-27 kg = m_p # (52) +neutron_mass = 1.67492750056e-27 kg = m_n # (85) +x_unit_Cu = 1.00207697e-13 m = Xu_Cu # (28) +x_unit_Mo = 1.00209952e-13 m = Xu_Mo # (53) +angstrom_star = 1.00001495e-10 = Å_star # (90) #### DERIVED CONSTANTS #### diff --git a/pint/default_en.txt b/pint/default_en.txt index 4250a48cb..bbac09bed 100644 --- a/pint/default_en.txt +++ b/pint/default_en.txt @@ -162,9 +162,6 @@ astronomical_unit = 149597870700 * meter = au # since Aug 2012 parsec = 1 / tansec * astronomical_unit = pc nautical_mile = 1852 * meter = nmi bohr = hbar / (alpha * m_e * c) = a_0 = a0 = bohr_radius = atomic_unit_of_length = a_u_length -x_unit_Cu = K_alpha_Cu_d_220 * d_220 / 1537.4 = Xu_Cu -x_unit_Mo = K_alpha_Mo_d_220 * d_220 / 707.831 = Xu_Mo -angstrom_star = K_alpha_W_d_220 * d_220 / 0.2090100 = Å_star planck_length = (hbar * gravitational_constant / c ** 3) ** 0.5 # Mass diff --git a/pint/pint_convert.py b/pint/pint_convert.py index 0934588b8..dd830718c 100644 --- a/pint/pint_convert.py +++ b/pint/pint_convert.py @@ -91,26 +91,47 @@ def _set(key: str, value): # m_e: Electron mass # m_p: Proton mass # m_n: Neutron mass - R_i = (ureg._units["R_inf"].converter.scale, 0.0000000000021e7) - g_e = (ureg._units["g_e"].converter.scale, 0.00000000000035) - m_u = (ureg._units["m_u"].converter.scale, 0.00000000050e-27) - m_e = (ureg._units["m_e"].converter.scale, 0.00000000028e-30) - m_p = (ureg._units["m_p"].converter.scale, 0.00000000051e-27) - m_n = (ureg._units["m_n"].converter.scale, 0.00000000095e-27) + # x_Cu: Copper x unit + # x_Mo: Molybdenum x unit + # A_s: Angstrom star + R_i = (ureg._units["R_inf"].converter.scale, 0.0000000000012e7) + g_e = (ureg._units["g_e"].converter.scale, 0.00000000000036) + m_u = (ureg._units["m_u"].converter.scale, 0.00000000052e-27) + m_e = (ureg._units["m_e"].converter.scale, 0.0000000028e-31) + m_p = (ureg._units["m_p"].converter.scale, 0.00000000052e-27) + m_n = (ureg._units["m_n"].converter.scale, 0.00000000085e-27) + x_Cu = (ureg._units["x_unit_Cu"].converter.scale, 0.00000028e-13) + x_Mo = (ureg._units["x_unit_Mo"].converter.scale, 0.00000053e-13) + A_s = (ureg._units["angstrom_star"].converter.scale, 0.00000090e-10) if args.corr: + # fmt: off # Correlation matrix between measured constants (to be completed below) - # R_i g_e m_u m_e m_p m_n + # R_i g_e m_u m_e m_p m_n x_Cu x_Mo A_s corr = [ - [1.0, -0.00206, 0.00369, 0.00436, 0.00194, 0.00233], # R_i - [-0.00206, 1.0, 0.99029, 0.99490, 0.97560, 0.52445], # g_e - [0.00369, 0.99029, 1.0, 0.99536, 0.98516, 0.52959], # m_u - [0.00436, 0.99490, 0.99536, 1.0, 0.98058, 0.52714], # m_e - [0.00194, 0.97560, 0.98516, 0.98058, 1.0, 0.51521], # m_p - [0.00233, 0.52445, 0.52959, 0.52714, 0.51521, 1.0], - ] # m_n + [ 1.00000, -0.00122, 0.00438, 0.00225, 0.00455, 0.00277, 0.00000, 0.00000, 0.00000], # R_i + [-0.00122, 1.00000, 0.97398, 0.97555, 0.97404, 0.59702, 0.00000, 0.00000, 0.00000], # g_e + [ 0.00438, 0.97398, 1.00000, 0.99839, 0.99965, 0.61279, 0.00000, 0.00000, 0.00000], # m_u + [ 0.00225, 0.97555, 0.99839, 1.00000, 0.99845, 0.61199, 0.00000, 0.00000, 0.00000], # m_e + [ 0.00455, 0.97404, 0.99965, 0.99845, 1.00000, 0.61281, 0.00000, 0.00000, 0.00000], # m_p + [ 0.00277, 0.59702, 0.61279, 0.61199, 0.61281, 1.00000,-0.00098,-0.00108,-0.00063], # m_n + [ 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,-0.00098, 1.00000, 0.00067, 0.00039], # x_Cu + [ 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,-0.00108, 0.00067, 1.00000, 0.00100], # x_Mo + [ 0.00000, 0.00000, 0.00000, 0.00000, 0.00000,-0.00063, 0.00039, 0.00100, 1.00000], # A_s + ] + # fmt: on try: - (R_i, g_e, m_u, m_e, m_p, m_n) = uncertainties.correlated_values_norm( - [R_i, g_e, m_u, m_e, m_p, m_n], corr + ( + R_i, + g_e, + m_u, + m_e, + m_p, + m_n, + x_Cu, + x_Mo, + A_s, + ) = uncertainties.correlated_values_norm( + [R_i, g_e, m_u, m_e, m_p, m_n, x_Cu, x_Mo, A_s], corr ) except AttributeError: raise Exception( @@ -123,6 +144,9 @@ def _set(key: str, value): m_e = uncertainties.ufloat(*m_e) m_p = uncertainties.ufloat(*m_p) m_n = uncertainties.ufloat(*m_n) + x_Cu = uncertainties.ufloat(*x_Cu) + x_Mo = uncertainties.ufloat(*x_Mo) + A_s = uncertainties.ufloat(*A_s) _set("R_inf", R_i) _set("g_e", g_e) @@ -130,6 +154,9 @@ def _set(key: str, value): _set("m_e", m_e) _set("m_p", m_p) _set("m_n", m_n) + _set("x_unit_Cu", x_Cu) + _set("x_unit_Mo", x_Mo) + _set("angstrom_star", A_s) # Measured constants with zero correlation _set( @@ -139,32 +166,6 @@ def _set(key: str, value): ), ) - _set( - "d_220", - uncertainties.ufloat(ureg._units["d_220"].converter.scale, 0.000000032e-10), - ) - - _set( - "K_alpha_Cu_d_220", - uncertainties.ufloat( - ureg._units["K_alpha_Cu_d_220"].converter.scale, 0.00000022 - ), - ) - - _set( - "K_alpha_Mo_d_220", - uncertainties.ufloat( - ureg._units["K_alpha_Mo_d_220"].converter.scale, 0.00000019 - ), - ) - - _set( - "K_alpha_W_d_220", - uncertainties.ufloat( - ureg._units["K_alpha_W_d_220"].converter.scale, 0.000000098 - ), - ) - ureg._root_units_cache = {} ureg._build_cache() From d886c2066253caf7fb48ee3d86ddd4b270512265 Mon Sep 17 00:00:00 2001 From: andrewgsavage Date: Sun, 15 Dec 2024 12:51:30 +0000 Subject: [PATCH 05/11] qto.py: Make nan/inf magnitude checks accept uncertainties (#2093) * qto.py: Make nan/inf magnitude checks accept uncertainties Co-authored-by: Doron Behar --- CHANGES | 1 + pint/facets/plain/qto.py | 12 ++++++------ pint/testsuite/test_issues.py | 20 +++++++++++++++++++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 6b3752f03..e91f11a0c 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ Pint Changelog - Add docs to the functions in ``pint.testing`` (PR #2070) - Fix round function returning float instead of int (#2081) - Update constants to CODATA 2022 recommended values. (#2049) +- Fixed issue with `.to_compact` and Magnitudes with uncertainties / Quantities with units (PR #2069, issue #2044) 0.24.4 (2024-11-07) diff --git a/pint/facets/plain/qto.py b/pint/facets/plain/qto.py index 22176491d..9d8b7f611 100644 --- a/pint/facets/plain/qto.py +++ b/pint/facets/plain/qto.py @@ -110,12 +110,12 @@ def to_compact( ) return quantity - if ( - quantity.unitless - or quantity.magnitude == 0 - or math.isnan(quantity.magnitude) - or math.isinf(quantity.magnitude) - ): + qm = ( + quantity.magnitude + if not hasattr(quantity.magnitude, "nominal_value") + else quantity.magnitude.nominal_value + ) + if quantity.unitless or qm == 0 or math.isnan(qm) or math.isinf(qm): return quantity SI_prefixes: dict[int, str] = {} diff --git a/pint/testsuite/test_issues.py b/pint/testsuite/test_issues.py index 847f269f0..8501661d0 100644 --- a/pint/testsuite/test_issues.py +++ b/pint/testsuite/test_issues.py @@ -400,7 +400,7 @@ def test_angstrom_creation(self, module_registry): module_registry.Quantity(2, "Å") def test_alternative_angstrom_definition(self, module_registry): - module_registry.Quantity(2, "\u212B") + module_registry.Quantity(2, "\u212b") def test_micro_creation_U03bc(self, module_registry): module_registry.Quantity(2, "μm") @@ -1331,3 +1331,21 @@ def test_issue2007(): assert f"{q:~C}" == "1" assert f"{q:~D}" == "1" assert f"{q:~H}" == "1" + + +@helpers.requires_uncertainties() +@helpers.requires_numpy() +def test_issue2044(): + from numpy.testing import assert_almost_equal + from uncertainties import ufloat + + ureg = UnitRegistry() + # First make sure this doesn't fail completely (A Measurement) + q = ureg.Quantity(10_000, "m").plus_minus(0.01).to_compact() + assert_almost_equal(q.m.n, 10.0) + assert q.u == "kilometer" + + # Similarly, for a Ufloat with units + q = (ufloat(10_000, 0.01) * ureg.m).to_compact() + assert_almost_equal(q.m.n, 10.0) + assert q.u == "kilometer" From 3cbf3dddeaf2cf8be90e7540f839eab24e38ee41 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Sun, 15 Dec 2024 17:44:01 +0100 Subject: [PATCH 06/11] Typing: Fix return type of PlainQuantity.to (#2090) --- CHANGES | 1 + pint/facets/plain/quantity.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e91f11a0c..53fd5d218 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Pint Changelog - Add docs to the functions in ``pint.testing`` (PR #2070) - Fix round function returning float instead of int (#2081) +- Fix return type of `PlainQuantity.to` (#2088) - Update constants to CODATA 2022 recommended values. (#2049) - Fixed issue with `.to_compact` and Magnitudes with uncertainties / Quantities with units (PR #2069, issue #2044) diff --git a/pint/facets/plain/quantity.py b/pint/facets/plain/quantity.py index e70a02c88..6234060da 100644 --- a/pint/facets/plain/quantity.py +++ b/pint/facets/plain/quantity.py @@ -32,6 +32,7 @@ is_duck_array_type, is_upcast_type, np, + Self, zero_or_nan, ) from ...errors import DimensionalityError, OffsetUnitCalculusError, PintTypeError @@ -515,7 +516,7 @@ def ito( def to( self, other: QuantityOrUnitLike | None = None, *contexts, **ctx_kwargs - ) -> PlainQuantity: + ) -> Self: """Return PlainQuantity rescaled to different units. Parameters From 415fcef0521057a3b7a272dc3b5b567749ba708c Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:39:57 +0100 Subject: [PATCH 07/11] Fix code style (#2095) --- pint/facets/plain/quantity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pint/facets/plain/quantity.py b/pint/facets/plain/quantity.py index 6234060da..f1e977499 100644 --- a/pint/facets/plain/quantity.py +++ b/pint/facets/plain/quantity.py @@ -26,13 +26,13 @@ from ..._typing import Magnitude, QuantityOrUnitLike, Scalar, UnitLike from ...compat import ( HAS_NUMPY, + Self, _to_magnitude, deprecated, eq, is_duck_array_type, is_upcast_type, np, - Self, zero_or_nan, ) from ...errors import DimensionalityError, OffsetUnitCalculusError, PintTypeError From 0ba0b5383df8ee3e15c9926282f961be8ab88cd3 Mon Sep 17 00:00:00 2001 From: William Andrea <22385371+wjandrea@users.noreply.github.com> Date: Thu, 26 Dec 2024 13:53:05 -0400 Subject: [PATCH 08/11] Fix syntax highlighting in overview doc (#2098) Remove bogus syntax highlighting on LICENSE in overview.rst --- docs/getting/overview.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/getting/overview.rst b/docs/getting/overview.rst index 61dfc14f4..f97ad2999 100644 --- a/docs/getting/overview.rst +++ b/docs/getting/overview.rst @@ -105,6 +105,7 @@ License ------- .. literalinclude:: ../../LICENSE + :language: none .. _`comprehensive list of physical units, prefixes and constants`: https://github.com/hgrecco/pint/blob/master/pint/default_en.txt .. _`uncertainties package`: https://pythonhosted.org/uncertainties/ From 74b708661577623c0c288933d8ed6271f32a4b8b Mon Sep 17 00:00:00 2001 From: Michael Weinold <23102087+michaelweinold@users.noreply.github.com> Date: Fri, 27 Dec 2024 12:39:11 +0100 Subject: [PATCH 09/11] updated uncertainties package documentation url (#2099) --- docs/advanced/measurement.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/measurement.rst b/docs/advanced/measurement.rst index a49c8212b..0958d8db8 100644 --- a/docs/advanced/measurement.rst +++ b/docs/advanced/measurement.rst @@ -69,4 +69,4 @@ the `Propagation of uncertainty`_ rules. .. _`Propagation of uncertainty`: http://en.wikipedia.org/wiki/Propagation_of_uncertainty -.. _`Uncertainties package`: https://uncertainties-python-package.readthedocs.io/en/latest/ +.. _`Uncertainties package`: https://uncertainties.readthedocs.io/en/latest/ From 6082bdc1a9777d0408c8f3c9087bcd8f66dd3189 Mon Sep 17 00:00:00 2001 From: Eskild Schroll-Fleischer <54531016+nneskildsf@users.noreply.github.com> Date: Tue, 7 Jan 2025 00:20:53 +0100 Subject: [PATCH 10/11] Add conductivity dimension (#2113) --- CHANGES | 1 + pint/default_en.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 53fd5d218..806897330 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Pint Changelog - Fix return type of `PlainQuantity.to` (#2088) - Update constants to CODATA 2022 recommended values. (#2049) - Fixed issue with `.to_compact` and Magnitudes with uncertainties / Quantities with units (PR #2069, issue #2044) +- Add conductivity dimension. (#2112) 0.24.4 (2024-11-07) diff --git a/pint/default_en.txt b/pint/default_en.txt index bbac09bed..87dc60ec5 100644 --- a/pint/default_en.txt +++ b/pint/default_en.txt @@ -448,6 +448,9 @@ conventional_ohm_90 = R_K / R_K90 * ohm = Ω_90 = ohm_90 siemens = ampere / volt = S = mho absiemens = 1e9 * siemens = abS = abmho +# Conductivity +[conductivity] = [conductance]/[length] + # Capacitance [capacitance] = [charge] / [electric_potential] farad = coulomb / volt = F From 18f1191bfca1feb9f0d85a1ec71ba87b2d92a7d1 Mon Sep 17 00:00:00 2001 From: Eskild Schroll-Fleischer <54531016+nneskildsf@users.noreply.github.com> Date: Wed, 15 Jan 2025 23:00:45 +0100 Subject: [PATCH 11/11] Add absorbance unit and dimension (#2115) --- CHANGES | 1 + pint/default_en.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 806897330..f7a06d5a5 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ Pint Changelog - Update constants to CODATA 2022 recommended values. (#2049) - Fixed issue with `.to_compact` and Magnitudes with uncertainties / Quantities with units (PR #2069, issue #2044) - Add conductivity dimension. (#2112) +- Add absorbance unit and dimension. (#2114) 0.24.4 (2024-11-07) diff --git a/pint/default_en.txt b/pint/default_en.txt index 87dc60ec5..600e9a0f6 100644 --- a/pint/default_en.txt +++ b/pint/default_en.txt @@ -499,6 +499,10 @@ nuclear_magneton = e * hbar / (2 * m_p) = µ_N = mu_N [refractive_index] = [] refractive_index_unit = [] = RIU +# Absorbance +[absorbance] = [] +absorbance_unit = [] = AU + # Logaritmic Unit Definition # Unit = scale; logbase; logfactor # x_dB = [logfactor] * log( x_lin / [scale] ) / log( [logbase] )