From c57b8c78cf240dbde40b9c446c9952922c08a4fe Mon Sep 17 00:00:00 2001 From: Mykhaylo Shumko Date: Wed, 8 Mar 2023 15:35:20 -0500 Subject: [PATCH 1/3] Contstrained the .dll or .so glob pattern which ignores anything other than libirbem.dll or libirbem.so. --- python/IRBEM/IRBEM.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/IRBEM/IRBEM.py b/python/IRBEM/IRBEM.py index 80eaf04a..c5a2fbeb 100644 --- a/python/IRBEM/IRBEM.py +++ b/python/IRBEM/IRBEM.py @@ -1078,12 +1078,12 @@ def _load_shared_object(path=None): """ if path is None: if (sys.platform == 'win32') or (sys.platform == 'cygwin'): - obj_ext = '*.dll' + obj_name = 'libirbem.dll' loader = ctypes.WinDLL else: - obj_ext = '*.so' + obj_name = 'libirbem.so' loader = ctypes.cdll - matched_object_files = list(pathlib.Path(__file__).parents[2].glob(obj_ext)) + matched_object_files = list(pathlib.Path(__file__).parents[2].rglob(obj_name)) assert len(matched_object_files) == 1, ( f'{len(matched_object_files)} .so or .dll shared object files found in ' f'{pathlib.Path(__file__).parents[2]} folder: {matched_object_files}.' From 8b09dee70623d3c2b70a527107d0a1a3a1294a22 Mon Sep 17 00:00:00 2001 From: Mike Shumko Date: Thu, 12 Dec 2024 14:49:10 -0500 Subject: [PATCH 2/3] Changed bmin to bmirr variable name. --- python/IRBEM/IRBEM.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/IRBEM/IRBEM.py b/python/IRBEM/IRBEM.py index a8e2aefe..1217c3f8 100644 --- a/python/IRBEM/IRBEM.py +++ b/python/IRBEM/IRBEM.py @@ -329,7 +329,7 @@ def find_mirror_point(self, X, maginput, alpha): Returns ------- dict - A dictionary with "blocal" and "bmin" scalars, and "POSIT" that contains the + A dictionary with "blocal" and "bmirr" scalars, as well as "POSIT" that contains the GEO coordinates of the mirror point. """ a = ctypes.c_double(alpha) @@ -338,7 +338,7 @@ def find_mirror_point(self, X, maginput, alpha): self._prepMagInput(maginput) iyear, idoy, ut, x1, x2, x3 = self._prepTimeLoc(X) - blocal, bmin = [ctypes.c_double(-9999) for i in range(2)] + blocal, bmirr = [ctypes.c_double(-9999) for i in range(2)] positType = (3 * ctypes.c_double) posit = positType() @@ -349,9 +349,9 @@ def find_mirror_point(self, X, maginput, alpha): ctypes.byref(iyear), ctypes.byref(idoy), ctypes.byref(ut), \ ctypes.byref(x1), ctypes.byref(x2), ctypes.byref(x3), \ ctypes.byref(a), ctypes.byref(self.maginput), \ - ctypes.byref(blocal), ctypes.byref(bmin), ctypes.byref(posit)) + ctypes.byref(blocal), ctypes.byref(bmirr), ctypes.byref(posit)) - self.find_mirror_point_output = {'blocal':blocal.value, 'bmin':bmin.value, \ + self.find_mirror_point_output = {'blocal':blocal.value, 'bmirr':bmirr.value, \ 'POSIT':posit[:]} return self.find_mirror_point_output From acfd5afaeab4f1e8cec54711157e56d7cd773890 Mon Sep 17 00:00:00 2001 From: Mike Shumko Date: Thu, 12 Dec 2024 14:54:28 -0500 Subject: [PATCH 3/3] Updated test. --- python/IRBEM/test_IRBEM.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/IRBEM/test_IRBEM.py b/python/IRBEM/test_IRBEM.py index 335e3b87..ad196394 100644 --- a/python/IRBEM/test_IRBEM.py +++ b/python/IRBEM/test_IRBEM.py @@ -141,7 +141,7 @@ def test_find_mirror_point(self): """ Test find_mirror_point for locally-mirroring electrons. """ - find_mirror_point_true_dict = {'blocal': 42271.69731031445, 'bmin': 42271.69731031445, + find_mirror_point_true_dict = {'blocal': 42271.69731031445, 'bmirr': 42271.69731031445, 'POSIT': [0.35282136776620165, 0.4204761325793738, 0.9448914452448274]} self.model.find_mirror_point(self.X, self.maginput, 90) self.assertAlmostEqualDict(self.model.find_mirror_point_output,