Repository: radioactivedecay/radioactivedecay (language: python)

Issue:
disenigrations per minute
<!-- Hi! Thank you for raising an issue with this package!
Note if you have a general usage question or feature request, please use the Discussions tab instead. -->

#### What is the issue?
<!-- Tell us what happens instead of the expected behaviour -->

After creating an inventory and calling activities('dpm') I recieve the opposite of the correct answer.  1 Bq = 60 dpm , but the result is 1/60 instead

#### Steps to reproduce
<!-- Provide a minimal example that reproduces the problem -->
Just make an inventory with inv = rd.Inventory({'H-3', 1.0})   inv.activites('dpm')  should return 60 but instead returns .01666

#### Environment
OS version: <!-- Windows 10/Linux/macOS etc. -->
Python version: <!-- 3.6/3.7/3.8/3.9/3.10/3.11 -->
radioactivedecay version: <!-- ex. 0.4.16 -->
Installed via: <!-- pip/conda-forge -->

MacOs in VSCode
Python 3.9.6
radioactivedecay version 0.4.16



#### Additional context
<!--- Add any other context about the problem here, screenshots, etc. -->

Please email back to



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f61fbb7..d76d816 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## [0.4.17] - 2023-03-10
+- Fix bug where the conversion of dpm to other activity units, and vice versa, was incorrect (#87 &
+#88).
+
 ## [0.4.16] - 2022-10-29
 - Added support for Python v3.11. Use latest importlib-resources API (`files()` etc.) to fix
 warnings. Fix pylint `__repr__()` usage warnings in tests. Use isort to sort imports and check in
diff --git a/docs/source/overview.rst b/docs/source/overview.rst
index 837f117..d598df1 100644
--- a/docs/source/overview.rst
+++ b/docs/source/overview.rst
@@ -246,6 +246,7 @@ Special thanks to:
 * `Jonathan Wing <https://github.com/JWingUtk>`_
 * `radioactivedecay-github <https://github.com/radioactivedecay-github>`_
 * `Christian Schreinemachers <https://github.com/Cs137>`_
+* `Sean Neutzmann <https://github.com/snuetzmann>`_
 
 for suggestions, support and assistance to this project.
 
diff --git a/radioactivedecay/__init__.py b/radioactivedecay/__init__.py
index 201cad8..8470928 100644
--- a/radioactivedecay/__init__.py
+++ b/radioactivedecay/__init__.py
@@ -25,7 +25,7 @@
 
 """
 
-__version__ = "0.4.16"
+__version__ = "0.4.17"
 
 from radioactivedecay.decaydata import DEFAULTDATA, DecayData
 from radioactivedecay.inventory import Inventory, InventoryHP
diff --git a/radioactivedecay/converters.py b/radioactivedecay/converters.py
index 5ae9cda..5bcfb31 100644
--- a/radioactivedecay/converters.py
+++ b/radioactivedecay/converters.py
@@ -272,7 +272,7 @@ class UnitConverterFloat(UnitConverter):
         "TCi": 1.0e12 * 3.7e10,
         "PCi": 1.0e15 * 3.7e10,
         "ECi": 1.0e18 * 3.7e10,
-        "dpm": 60.0,
+        "dpm": 1.0 / 60.0,
     }
 
     mass_units: Dict[str, float] = {
@@ -364,7 +364,7 @@ class UnitConverterSympy(UnitConverter):
         "TCi": Integer(1000000000000) * 37000000000,
         "PCi": Integer(1000000000000000) * 37000000000,
         "ECi": Integer(1000000000000000000) * 37000000000,
-        "dpm": Integer(60),
+        "dpm": Integer(1) / 60,
     }
 
     mass_units: Dict[str, Expr] = {


Test patch:
diff --git a/tests/test_converters.py b/tests/test_converters.py
index f8d162d..5923c34 100644
--- a/tests/test_converters.py
+++ b/tests/test_converters.py
@@ -387,9 +387,7 @@ def test_activity_unit_conv(self) -> None:
             places=(18 + 15),
         )
 
-        self.assertEqual(
-            UnitConverterFloat.activity_unit_conv(1.0, "Bq", "dpm"), 1.0 / 60.0
-        )
+        self.assertEqual(UnitConverterFloat.activity_unit_conv(1.0, "Bq", "dpm"), 60.0)
 
         # Catch some incorrect activity units
         with self.assertRaises(ValueError):
@@ -740,7 +738,7 @@ def test_activity_unit_conv(self) -> None:
 
         self.assertEqual(
             UnitConverterSympy.activity_unit_conv(Integer(1), "Bq", "dpm"),
-            1 / Integer(60),
+            Integer(60),
         )
 
         # Catch some incorrect activity units
diff --git a/tests/test_inventory.py b/tests/test_inventory.py
index ab1e28a..75fbf7b 100644
--- a/tests/test_inventory.py
+++ b/tests/test_inventory.py
@@ -22,7 +22,8 @@ def warning_message_if_dict_not_equal(
     calculated: Dict[str, float], expected: Dict[str, float]
 ) -> None:
     """
-    Warning message if calculated dictionary of floats is not equal to expected dictionary of floats.
+    Warning message if calculated dictionary of floats is not equal to expected dictionary of
+    floats.
     """
 
     return (