Repository: uncscode/particula

Issue:
add utility to strip units
- simple utility to return quantities with no units, akin to `.magnitude`.

Comments:

Patch:
diff --git a/README.md b/README.md
index f546085..564338c 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@
 
 Particula is a simple, fast, and powerful particle simulator, or at least two of the three, we hope. It is a simple particle system that is designed to be easy to use and easy to extend. The goal is to have a robust aerosol (gas phase *and* particle phase) simulation system that can be used to answer scientific questions that arise for experiments and research discussions.
 
-(*DISCLAIMER* [GitHub Copilot](https://copilot.github.com/) is heavily involved in the development of this project and especially in the writing of these paragraphs! _DISCLAIMER_)
+(*DISCLAIMER* [GitHub Copilot](https://copilot.github.com/) is heavily involved in the development of this project and especially in the writing of these paragraphs! *DISCLAIMER*)
 
-(*WARNING* `particula` is in early and messy development. It is not ready for production use yet, but you are welcome to use it anyway --- even better, you're welcome to contribute! _WARNING_)
+(*WARNING* `particula` is in early and messy development. It is not ready for production use yet, but you are welcome to use it anyway --- even better, you're welcome to contribute! *WARNING*)
 
 ## Goals & conduct
 
diff --git a/particula/__init__.py b/particula/__init__.py
index 74fbd0e..2e8db4a 100644
--- a/particula/__init__.py
+++ b/particula/__init__.py
@@ -19,4 +19,4 @@ from pint import UnitRegistry
 # u is the unit registry name.
 u = UnitRegistry()
 
-__version__ = '0.0.4-dev0'
+__version__ = '0.0.4.dev0'
diff --git a/particula/aerosol_dynamics/physical_parameters.py b/particula/aerosol_dynamics/physical_parameters.py
index 11eb5d4..f52a613 100644
--- a/particula/aerosol_dynamics/physical_parameters.py
+++ b/particula/aerosol_dynamics/physical_parameters.py
@@ -1,29 +1,14 @@
-"""centralized location for physical parameters.
+""" A centralized location for physical parameters.
 """
 
-from particula import u
-
-# Boltzmann's constant in m^2 kg s^-2 K^-1
-BOLTZMANN_CONSTANT = 1.380649e-23 * u.m**2 * u.kg / u.s**2 / u.K
-
-# Avogadro's number
-AVOGADRO_NUMBER = 6.022140857e23 / u.mol
-
-# Gas constant in J mol^-1 K^-1
-GAS_CONSTANT = BOLTZMANN_CONSTANT * AVOGADRO_NUMBER
-
-# elementary charge in C
-ELEMENTARY_CHARGE_VALUE = 1.60217662e-19 * u.C
-
-# Relative permittivity of air at room temperature
-# Previously known as the "dielectric constant"
-# Often denoted as epsilon
-RELATIVE_PERMITTIVITY_AIR = 1.0005  # unitless
-
-# permittivity of free space in F/m
-# Also known as the electric constant, permittivity of free space
-# Often denoted by epsilon_0
-VACUUM_PERMITTIVITY = 8.85418782e-12 * u.F / u.m
-
-# permittivity of air
-ELECTRIC_PERMITTIVITY = RELATIVE_PERMITTIVITY_AIR * VACUUM_PERMITTIVITY
+# pylint: disable=unused-import,
+# flake8: noqa: F401
+from particula.get_constants import (
+    BOLTZMANN_CONSTANT,
+    AVOGADRO_NUMBER,
+    GAS_CONSTANT,
+    ELEMENTARY_CHARGE_VALUE,
+    RELATIVE_PERMITTIVITY_AIR,
+    VACUUM_PERMITTIVITY,
+    ELECTRIC_PERMITTIVITY,
+)
diff --git a/particula/get_constants.py b/particula/get_constants.py
new file mode 100644
index 0000000..c0729f6
--- /dev/null
+++ b/particula/get_constants.py
@@ -0,0 +1,48 @@
+""" A centralized location for important, unchanged physics parameters.
+
+    This file contains constants that are used in multiple modules. Each
+    constant has its own units and exported with them. The constants are
+    mostly related to atmospheric aerosol particles in usual conditions.
+    They are flexible enough to depend on on the temperature and other
+    environmental variablaes (defined in the _environment module). In
+    the event there is an interest in overriding the values of these
+    constants:
+
+    TODO:
+        - Add a way to override the constants by parsing a user-supplied
+            configuration file.
+"""
+
+from particula import u
+
+# Boltzmann's constant in m^2 kg s^-2 K^-1
+BOLTZMANN_CONSTANT = 1.380649e-23 * u.m**2 * u.kg / u.s**2 / u.K
+
+# Avogadro's number
+AVOGADRO_NUMBER = 6.022140857e23 / u.mol
+
+# Gas constant in J mol^-1 K^-1
+GAS_CONSTANT = BOLTZMANN_CONSTANT * AVOGADRO_NUMBER
+
+# elementary charge in C
+ELEMENTARY_CHARGE_VALUE = 1.60217662e-19 * u.C
+
+# Relative permittivity of air at room temperature
+# Previously known as the "dielectric constant"
+# Often denoted as epsilon
+RELATIVE_PERMITTIVITY_AIR = 1.0005  # unitless
+
+# permittivity of free space in F/m
+# Also known as the electric constant, permittivity of free space
+# Often denoted by epsilon_0
+VACUUM_PERMITTIVITY = 8.85418782e-12 * u.F / u.m
+
+# permittivity of air
+ELECTRIC_PERMITTIVITY = RELATIVE_PERMITTIVITY_AIR * VACUUM_PERMITTIVITY
+
+# viscosity of air at 273.15 K
+# these values are used to calculate the dynamic viscosity of air
+REF_VISCOSITY_AIR = 1.716e-5 * u.Pa * u.s
+REF_TEMPERATURE = 273.15 * u.K
+SUTHERLAND_CONSTANT = 110.4 * u.K
+MOLECULAR_WEIGHT_AIR = (28.9644 * u.g / u.mol).to_base_units()
diff --git a/particula/strip_units.py b/particula/strip_units.py
new file mode 100644
index 0000000..031973a
--- /dev/null
+++ b/particula/strip_units.py
@@ -0,0 +1,17 @@
+""" A simple utility to get rid of units if desired.
+"""
+
+from particula import u
+
+
+def unitless(quantity):
+
+    """ This simple utility will return:
+            the magnitude of a quantity if it has units
+            the quantity itself if it does not have units
+    """
+
+    return (
+        quantity.magnitude if isinstance(quantity, u.Quantity)
+        else quantity
+    )


Test patch:
diff --git a/particula/tests/constants_test.py b/particula/tests/constants_test.py
new file mode 100644
index 0000000..0255a95
--- /dev/null
+++ b/particula/tests/constants_test.py
@@ -0,0 +1,42 @@
+""" Testing getting constants from the get_constants.py file
+"""
+
+from particula import u
+from particula.get_constants import (
+    BOLTZMANN_CONSTANT,
+    AVOGADRO_NUMBER,
+    GAS_CONSTANT,
+)
+
+
+def test_get_constants():
+
+    """ simple tests are conducted as follows:
+
+            * see if GAS_CONSTANT maniuplation is good
+            * see if BOLTZMANN_CONSTANT units are good
+    """
+
+    assert (
+        GAS_CONSTANT
+        ==
+        BOLTZMANN_CONSTANT * AVOGADRO_NUMBER
+    )
+
+    assert (
+        GAS_CONSTANT.units
+        ==
+        BOLTZMANN_CONSTANT.units * AVOGADRO_NUMBER.units
+    )
+
+    assert (
+        GAS_CONSTANT.magnitude
+        ==
+        BOLTZMANN_CONSTANT.magnitude * AVOGADRO_NUMBER.magnitude
+    )
+
+    assert (
+        BOLTZMANN_CONSTANT.units
+        ==
+        u.m**2 * u.kg / u.s**2 / u.K
+    )
diff --git a/particula/tests/unitless_test.py b/particula/tests/unitless_test.py
new file mode 100644
index 0000000..ab6ed65
--- /dev/null
+++ b/particula/tests/unitless_test.py
@@ -0,0 +1,24 @@
+""" A quick test of strip_units.unitless utility
+"""
+
+from particula import u
+from particula.strip_units import unitless
+
+
+def test_strip_units():
+
+    """ testing getting rid of units of an input quantity
+
+        Tests:
+            * see if a quantity with units is stripped
+            * see if a quantity without units is returned
+            * see if manipulation of quantities is also ok
+    """
+
+    assert unitless(1) == 1
+
+    assert unitless(1 * u.kg) == 1
+
+    assert unitless(5 * u.m) == 5
+
+    assert unitless((5 * u.kg) * (1 * u.m)) == 5