Repository: PlasmaPy/PlasmaPy

Issue:
Fix xfailing tests in `test_nullpoint.py` for NumPy 1.24+
We started getting the following failures when we started using NumPy 1.24 (though there's a small chance that it's from a different package).  I'm not sure what caused the change, but for the time I'm marking these tests as xfailing in #2098. We'd probably need to go through these with a debugger step by step.

```
______________________________________ test_null_point_find4 _______________________________________
tests/test_nullpoint.py:302: in test_null_point_find4
    npoints4 = uniform_null_point_find(**nullpoint4_args)
nullpoint.py:1526: in uniform_null_point_find
    vspace = _vector_space(
nullpoint.py:254: in _vector_space
    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
E   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
______________________________________ test_null_point_find8 _______________________________________
tests/test_nullpoint.py:381: in test_null_point_find8
    npoints8 = uniform_null_point_find(**nullpoint8_args)
nullpoint.py:1526: in uniform_null_point_find
    vspace = _vector_space(
nullpoint.py:254: in _vector_space
    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
E   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
___________ Test_classify_null_point.test_classify_null_point_vals[kwargs2-Spiral null] ____________
tests/test_nullpoint.py:457: in test_classify_null_point_vals
    assert uniform_null_point_find(**kwargs)[0].classification == expected
nullpoint.py:1526: in uniform_null_point_find
    vspace = _vector_space(
nullpoint.py:254: in _vector_space
    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
E   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
===================================== short test summary info ======================================
FAILED tests/test_nullpoint.py::test_null_point_find4 - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous ...
FAILED tests/test_nullpoint.py::test_null_point_find8 - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous ...
FAILED tests/test_nullpoint.py::Test_classify_null_point::test_classify_null_point_vals[kwargs2-Spiral null] - ValueError: setting an array element with a sequence. The requested array has an inhomogeneous ...
```

Discussion:

Patch:
diff --git a/CITATION.cff b/CITATION.cff
index 49523acb..0a89a7df 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -112,6 +112,10 @@ authors:
   family-names: Carroll
   alias: seanwilliamcarroll
 
+- given-names: Sarthak
+  family-names: Choudhary
+  alias: martha889
+
 - given-names: Christian
   family-names: Clauss
   alias: cclauss
@@ -210,6 +214,11 @@ authors:
   family-names: Hansen
   alias: raymonshansen
 
+- given-names: Mohammed
+  family-names: Haque
+  affiliation: Hunter College
+  alias: mohawk811
+
 - given-names: Julien
   family-names: Hillairet
   affiliation: CEA
@@ -490,6 +499,10 @@ authors:
   family-names: Stinson
   alias: 14tstinson
 
+- given-names: Michaela
+  family-names: Švancarová
+  alias: mysakli
+
 - given-names: Antoine
   family-names: Tavant
   affiliation: Centre Spatial de l'École Polytechnique
@@ -521,6 +534,8 @@ authors:
   orcid: https://orcid.org/0000-0002-6468-5710
   alias: svincena
 
+- alias: WineDarkMoon
+
 - given-names: Tingfeng
   family-names: Wu
   orcid: https://orcid.org/0000-0001-8745-204X
diff --git a/changelog/2133.bugfix.rst b/changelog/2133.bugfix.rst
new file mode 100644
index 00000000..05b20dce
--- /dev/null
+++ b/changelog/2133.bugfix.rst
@@ -0,0 +1,2 @@
+The ``plasmapy.analysis.nullpoint._vector_space`` function now returns a
+list for its delta values instead of an array.
diff --git a/plasmapy/analysis/nullpoint.py b/plasmapy/analysis/nullpoint.py
index 71bc69cc..a19e3b81 100644
--- a/plasmapy/analysis/nullpoint.py
+++ b/plasmapy/analysis/nullpoint.py
@@ -251,7 +251,7 @@ def _vector_space(
         w = w_arr
     else:
         u, v, w = func(x, y, z)
-    return np.array([x, y, z]), np.array([u, v, w]), np.array([dx, dy, dz])
+    return np.array([x, y, z]), np.array([u, v, w]), [dx, dy, dz]
 
 
 def _trilinear_coeff_cal(vspace, cell):


Test patch:
diff --git a/plasmapy/analysis/tests/test_nullpoint.py b/plasmapy/analysis/tests/test_nullpoint.py
index 2c87e3ad..6e854d66 100644
--- a/plasmapy/analysis/tests/test_nullpoint.py
+++ b/plasmapy/analysis/tests/test_nullpoint.py
@@ -289,7 +289,6 @@ def test_null_point_find3():
 
 
 @pytest.mark.slow()
-@pytest.mark.xfail(np.__version__ >= "1.24.0", reason="See issue #2101.")
 def test_null_point_find4():
     r"""Test `~plasmapy.analysis.nullpoint.null_point_find`."""
     # Two null points
@@ -369,7 +368,6 @@ def test_null_point_find7():
 
 
 @pytest.mark.slow()
-@pytest.mark.xfail(np.__version__ >= "1.24.0", reason="See issue #2101.")
 def test_null_point_find8():
     r"""Test `~plasmapy.analysis.nullpoint.null_point_find`."""
     # Non-linear field
@@ -426,9 +424,6 @@ class Test_classify_null_point:
                 "func": lambda x, y, z: [(y - 5.5) * (y + 5.5), (z - 5.5), (x - 5.5)],
             },
             "Spiral null",
-            marks=pytest.mark.xfail(
-                np.__version__ >= "1.24.0", reason="See issue #2101."
-            ),
         ),
         (
             {