Repository: PlasmaPy/PlasmaPy

Issue:
Check consistency of argument ordering in physics
Here are a few example signatures straight from `physics.transport`:

```
def Coulomb_logarithm(n_e, T, particles, V=None):
def Debye_length(T_e, n_e):
def Debye_number(T_e, n_e):
def upper_hybrid_frequency(B, n_e):
```
It would be nice to ensure that non-keyword arguments, where applicable, have the same ordering - like in other scientific packages, like Numpy, a consistent API is helpful for being able to call multiple functions without having to check the signature each time you call them.

Any consistent ordering would be welcome - but common sense takes precedence.

Discussion:

Patch:
diff --git a/plasmapy/physics/transport.py b/plasmapy/physics/transport.py
index 75073cbd..8af344d3 100644
--- a/plasmapy/physics/transport.py
+++ b/plasmapy/physics/transport.py
@@ -8,21 +8,22 @@
 from .parameters import Debye_length
 
 
-@check_quantity({"n_e": {"units": units.m**-3},
-                 "T": {"units": units.K, "can_be_negative": False}
+@check_quantity({"T": {"units": units.K, "can_be_negative": False},
+                 "n_e": {"units": units.m**-3}
                  })
-def Coulomb_logarithm(n_e, T, particles, V=None):
+def Coulomb_logarithm(T, n_e, particles, V=None):
     r"""Estimates the Coulomb logarithm.
 
     Parameters
     ----------
-    n_e : Quantity
-        The electron density in units convertible to per cubic meter.
 
     T : Quantity
-        Temperature in units of temperature or energy per particle,
-        which is assumed to be equal for both the test particle and
-        the target particle
+    Temperature in units of temperature or energy per particle,
+    which is assumed to be equal for both the test particle and
+    the target particle
+
+    n_e : Quantity
+        The electron density in units convertible to per cubic meter.
 
     particles : tuple
         A tuple containing string representations of the test particle
@@ -90,9 +91,9 @@ def Coulomb_logarithm(n_e, T, particles, V=None):
     Examples
     --------
     >>> from astropy import units as u
-    >>> Coulomb_logarithm(T=1e6*units.K, n_e=1e19*units.m**-3, ('e', 'p'))
+    >>> Coulomb_logarithm(T=1e6*u.K, n_e=1e19*u.m**-3, ('e', 'p'))
     14.748259780491056
-    >>> Coulomb_logarithm(1e6*units.K, 1e19*units.m**-3, ('e', 'p'),
+    >>> Coulomb_logarithm(1e6*u.K, 1e19*u.m**-3, ('e', 'p'),
                           V=1e6*u.m/u.s)
 
     References


Test patch:
diff --git a/plasmapy/physics/tests/test_transport.py b/plasmapy/physics/tests/test_transport.py
index 3e5333a0..a1553e55 100644
--- a/plasmapy/physics/tests/test_transport.py
+++ b/plasmapy/physics/tests/test_transport.py
@@ -18,37 +18,37 @@ def test_Coulomb_logarithm():
     particles = ('e', 'p')
 
     for i in range(3):
-        assert np.isclose(Coulomb_logarithm(n_e[i], T[i], particles),
+        assert np.isclose(Coulomb_logarithm(T[i], n_e[i], particles),
                           Lambda[i], atol=0.01)
 
-    assert np.isclose(Coulomb_logarithm(5*u.m**-3, 1*u.eV, ('e', 'e')),
-                      Coulomb_logarithm(5*u.m**-3, 11604.5220*u.K, ('e', 'e')))
+    assert np.isclose(Coulomb_logarithm(1*u.eV, 5*u.m**-3, ('e', 'e')),
+                      Coulomb_logarithm(11604.5220*u.K, 5*u.m**-3, ('e', 'e')))
 
-    assert np.isclose(Coulomb_logarithm(1e9*u.cm**-3, 1e2*u.K, ('e', 'p')),
+    assert np.isclose(Coulomb_logarithm(1e2*u.K, 1e9*u.cm**-3, ('e', 'p')),
                       5.97, atol=0.01)
 
-    assert np.isclose(Coulomb_logarithm(1e9*u.cm**-3, 1e7*u.K, ('e', 'p')),
+    assert np.isclose(Coulomb_logarithm(1e7*u.K, 1e9*u.cm**-3, ('e', 'p')),
                       21.6, atol=0.1)
 
-    assert np.isclose(Coulomb_logarithm(1e24*u.cm**-3, 1e8*u.K, ('e', 'p')),
+    assert np.isclose(Coulomb_logarithm(1e8*u.K, 1e24*u.cm**-3, ('e', 'p')),
                       6.69, atol=0.01)
 
-    assert np.allclose(Coulomb_logarithm(n_e, T, particles), Lambda, atol=0.01)
+    assert np.allclose(Coulomb_logarithm(T, n_e, particles), Lambda, atol=0.01)
 
-    assert np.isclose(Coulomb_logarithm(5*u.m**-3, 1e5*u.K, ('e', 'e'),
+    assert np.isclose(Coulomb_logarithm(1e5*u.K, 5*u.m**-3, ('e', 'e'),
                                         V=1e4*u.m/u.s), 21.379082011)
 
     with pytest.raises(UserWarning):
-        Coulomb_logarithm(1*u.m**-3, 1e5*u.K, ('e', 'p'), 299792458*u.m/u.s)
+        Coulomb_logarithm(1e5*u.K, 1*u.m**-3, ('e', 'p'), 299792458*u.m/u.s)
 
     with pytest.raises(u.UnitConversionError):
-        Coulomb_logarithm(1*u.m**-3, 1e5*u.g, ('e', 'p'), 29979245*u.m/u.s)
+        Coulomb_logarithm(1e5*u.g, 1*u.m**-3, ('e', 'p'), 29979245*u.m/u.s)
 
     with pytest.raises(ValueError):
-        Coulomb_logarithm(5*u.m**-3, 1*u.K, ('e'))
+        Coulomb_logarithm(1*u.K, 5*u.m**-3, ('e'))
 
     with pytest.raises(ValueError):
-        Coulomb_logarithm(5*u.m**-3, 1*u.K, ('e', 'g'))
+        Coulomb_logarithm(1*u.K, 5*u.m**-3, ('e', 'g'))
 
     with pytest.raises(ValueError):
-        Coulomb_logarithm(5*u.m**-3, 1*u.K, ('e', 'D'))
+        Coulomb_logarithm(1*u.K, 5*u.m**-3, ('e', 'D'))