Repository: PlasmaPy/PlasmaPy

Issue:
Move `plasmapy.data` to `plasmapy.particles.data`
> @rocco8773  will initiate PR on moving plasmapy.data to plasmapy.particles.data

https://docs.google.com/document/d/14ofIBJlXIoxYjtlGPiXeUWKIp7Ynull5Q5K8eeIDyWg/edit#

You signed up for it, mate :smile: 


Discussion:
Thanks mate! At least it's now on my GitHub notification list. 🤣

Resolving patch:
diff --git a/plasmapy/data/__init__.py b/plasmapy/particles/data/__init__.py
similarity index 100%
rename from plasmapy/data/__init__.py
rename to plasmapy/particles/data/__init__.py
diff --git a/plasmapy/particles/elements.py b/plasmapy/particles/elements.py
--- a/plasmapy/particles/elements.py
+++ b/plasmapy/particles/elements.py
@@ -36,7 +36,8 @@ def _element_obj_hook(obj):
 
 
 _Elements = json.loads(
-    pkgutil.get_data("plasmapy", "data/elements.json"), object_hook=_element_obj_hook
+    pkgutil.get_data("plasmapy", "particles/data/elements.json"),
+    object_hook=_element_obj_hook
 )
 
 
diff --git a/plasmapy/particles/isotopes.py b/plasmapy/particles/isotopes.py
--- a/plasmapy/particles/isotopes.py
+++ b/plasmapy/particles/isotopes.py
@@ -29,5 +29,6 @@ def _isotope_obj_hook(obj):
 
 
 _Isotopes = json.loads(
-    pkgutil.get_data("plasmapy", "data/isotopes.json"), object_hook=_isotope_obj_hook
+    pkgutil.get_data("plasmapy", "particles/data/isotopes.json"),
+    object_hook=_isotope_obj_hook
 )


Test patch:
diff --git a/plasmapy/classes/sources/tests/test_openpmd_hdf5.py b/plasmapy/classes/sources/tests/test_openpmd_hdf5.py
--- a/plasmapy/classes/sources/tests/test_openpmd_hdf5.py
+++ b/plasmapy/classes/sources/tests/test_openpmd_hdf5.py
@@ -1,6 +1,6 @@
 from plasmapy.classes.sources import openpmd_hdf5
 from plasmapy.classes.exceptions import DataStandardError
-from plasmapy.data.test import rootdir
+from plasmapy.particles.data.test import data_dir
 import plasmapy.classes
 
 from astropy import units as u
@@ -11,21 +11,21 @@
 
 @pytest.fixture(scope="module")
 def h5_2d(request):
-    h5 = openpmd_hdf5.HDF5Reader(hdf5=os.path.join(rootdir, "data00000255.h5"))
+    h5 = openpmd_hdf5.HDF5Reader(hdf5=os.path.join(data_dir, "data00000255.h5"))
     yield h5
     h5.close()
 
 
 @pytest.fixture(scope="module")
 def h5_3d(request):
-    h5 = openpmd_hdf5.HDF5Reader(hdf5=os.path.join(rootdir, "data00000100.h5"))
+    h5 = openpmd_hdf5.HDF5Reader(hdf5=os.path.join(data_dir, "data00000100.h5"))
     yield h5
     h5.close()
 
 
 @pytest.fixture(scope="module")
 def h5_theta(request):
-    h5 = openpmd_hdf5.HDF5Reader(hdf5=os.path.join(rootdir, "data00000200.h5"))
+    h5 = openpmd_hdf5.HDF5Reader(hdf5=os.path.join(data_dir, "data00000200.h5"))
     yield h5
     h5.close()
 
@@ -142,7 +142,7 @@ def test_unavailable_hdf5():
 
 def test_non_openpmd_hdf5():
     with pytest.raises(DataStandardError):
-        openpmd_hdf5.HDF5Reader(hdf5=os.path.join(rootdir, "blank.h5"))
+        openpmd_hdf5.HDF5Reader(hdf5=os.path.join(data_dir, "blank.h5"))
 
 
 def test_HDF5Reader(h5_2d):
diff --git a/plasmapy/classes/tests/test_plasma_factory.py b/plasmapy/classes/tests/test_plasma_factory.py
--- a/plasmapy/classes/tests/test_plasma_factory.py
+++ b/plasmapy/classes/tests/test_plasma_factory.py
@@ -4,12 +4,12 @@
 import pytest
 
 import plasmapy.classes
-from plasmapy.data.test import rootdir
+from plasmapy.particles.data.test import data_dir
 
 
 @pytest.fixture(scope="module")
 def h5(request):
-    h5 = plasmapy.classes.Plasma(hdf5=os.path.join(rootdir, "data00000255.h5"))
+    h5 = plasmapy.classes.Plasma(hdf5=os.path.join(data_dir, "data00000255.h5"))
     yield h5
     h5.close()
 
diff --git a/plasmapy/data/test/__init__.py b/plasmapy/data/test/__init__.py
deleted file mode 100644
--- a/plasmapy/data/test/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import os
-import glob
-
-import plasmapy
-
-rootdir = os.path.join(os.path.dirname(plasmapy.__file__), "data", "test")
-file_list = glob.glob(os.path.join(rootdir, "*.[!p]*"))
diff --git a/plasmapy/particles/data/test/__init__.py b/plasmapy/particles/data/test/__init__.py
new file mode 100644
--- /dev/null
+++ b/plasmapy/particles/data/test/__init__.py
@@ -0,0 +1,5 @@
+import os
+import glob
+
+data_dir = os.path.dirname(__file__)
+data_files = glob.glob(os.path.join(data_dir, "*.[!p]*"))
diff --git a/plasmapy/data/test/blank.h5 b/plasmapy/particles/data/test/blank.h5
similarity index 100%
rename from plasmapy/data/test/blank.h5
rename to plasmapy/particles/data/test/blank.h5
diff --git a/plasmapy/data/test/data00000100.h5 b/plasmapy/particles/data/test/data00000100.h5
similarity index 100%
rename from plasmapy/data/test/data00000100.h5
rename to plasmapy/particles/data/test/data00000100.h5
diff --git a/plasmapy/data/test/data00000200.h5 b/plasmapy/particles/data/test/data00000200.h5
similarity index 100%
rename from plasmapy/data/test/data00000200.h5
rename to plasmapy/particles/data/test/data00000200.h5
diff --git a/plasmapy/data/test/data00000255.h5 b/plasmapy/particles/data/test/data00000255.h5
similarity index 100%
rename from plasmapy/data/test/data00000255.h5
rename to plasmapy/particles/data/test/data00000255.h5