Repository: PlasmaPy/PlasmaPy

Issue:
Minor changes in CollisionFrequencies
@JaydenR2305 I noticed a couple minor changes I'd like to make for the new `CollisionFrequencies` class

1) Right now the `Coulomb_log` attribute must be an astropy quantity object (u.dimensionless_unscaled). However, it's natural to just enter this as a float. Can you add a line like this: 

```python
if not isinstance(Coulomb_log, u.Quantity):
      Coulomb_log *= u.dimensionless_unscaled

```


2) Right now an  unhandled error is raised if the n_b and v_a/T_a arrays are different sizes. I think there should be a validation check at the beginning of the function making sure they have the same shape. That requirement should also be added to the docstring.

If you open a new PR for that, it should be easy to merge


Discussion:

Resolving patch:
diff --git a/plasmapy/formulary/collisions.py b/plasmapy/formulary/collisions.py
--- a/plasmapy/formulary/collisions.py
+++ b/plasmapy/formulary/collisions.py
@@ -910,7 +910,7 @@ def collision_frequency(
     .. note::
         The `~plasmapy.formulary.collisions.collision_frequency` function has been
         replaced by the more general `~plasmapy.formulary.collisions.CollisionFrequencies` class.
-        To replicate the functionality of collision_frequency, create a
+        To replicate the functionality of `~plasmapy.formulary.collisions.collision_frequency`, create a
         `~plasmapy.formulary.collisions.CollisionFrequencies` class and access the ``Lorentz_collision_frequency`` attribute.
 
     Collision frequency of particles in a plasma.
@@ -2120,8 +2120,9 @@ def __init__(
         Raises
         ------
         `ValueError`
-            If both :math:`v_a` and :math:`T_a` are specified, or neither
-            :math:`v_a` nor :math:`T_a` are specified.
+            If both :math:`v_a` and :math:`T_a` are specified, neither
+            :math:`v_a` nor :math:`T_a` are specified, or specified arrays
+            don't have equal size.
 
         Notes
         -----
@@ -2203,6 +2204,13 @@ def __init__(
         elif T_a is not None:
             raise ValueError("Please specify either v_a or T_a, not both.")
 
+        if (
+            isinstance(v_a, np.ndarray)
+            and isinstance(n_b, np.ndarray)
+            and v_a.shape != n_b.shape
+        ):
+            raise ValueError("Please specify arrays of equal length.")
+
         self.test_particle = test_particle
         self.field_particle = field_particle
         self.v_a = v_a
@@ -2213,7 +2221,11 @@ def __init__(
         )
         self.n_b = n_b
         self.T_b = T_b
-        self.Coulomb_log = Coulomb_log
+        self.Coulomb_log = (
+            Coulomb_log
+            if isinstance(Coulomb_log, u.Quantity)
+            else Coulomb_log * u.dimensionless_unscaled
+        )
 
     @cached_property
     def _mass_ratio(self):
@@ -2321,7 +2333,7 @@ def phi(self):
         The parameter phi used in calculating collision frequencies
         calculated using the default error tolerances of `~scipy.integrate.quad`.
 
-        For more information refer to page 31 of the NRL Formulary.
+        For more information refer to page 31 of :cite:t:`nrlformulary:2019`.
         """
         vectorized_integral = np.vectorize(self._phi_explicit)
 


Test patch:
diff --git a/plasmapy/formulary/tests/test_collisions.py b/plasmapy/formulary/tests/test_collisions.py
--- a/plasmapy/formulary/tests/test_collisions.py
+++ b/plasmapy/formulary/tests/test_collisions.py
@@ -1713,7 +1713,7 @@ class TestCollisionFrequencies:
         v_a=1 * u.m / u.s,
         T_b=1 * u.K,
         n_b=1 * u.m**-3,
-        Coulomb_log=1 * u.dimensionless_unscaled,
+        Coulomb_log=1,
     )
 
     MKS_unit_conversion_test_constructor_arguments = {
@@ -1762,6 +1762,7 @@ class TestCollisionFrequencies:
             ("energy_loss", u.Hz),
             ("x", u.dimensionless_unscaled),
             ("Lorentz_collision_frequency", u.Hz),
+            ("Coulomb_log", u.dimensionless_unscaled),
         ],
     )
     def test_units(self, attribute_to_test, expected_attribute_units):
@@ -2126,6 +2127,17 @@ def test_limit_values(
                     "Coulomb_log": 1 * u.dimensionless_unscaled,
                 },
             ),
+            # Arrays of unequal shape error
+            (
+                ValueError,
+                (Particle("e-"), Particle("e-")),
+                {
+                    "v_a": np.ndarray([1, 1]) * u.cm / u.s,
+                    "T_b": 1 * u.eV,
+                    "n_b": ones_array * u.cm**-3,
+                    "Coulomb_log": 1 * u.dimensionless_unscaled,
+                },
+            ),
         ],
     )
     def test_errors(