From 1136e728f0833a5b8f6f605eddf0d96af62e2981 Mon Sep 17 00:00:00 2001 From: Jacob Cain Date: Wed, 29 May 2024 02:41:13 -0700 Subject: [PATCH 1/4] juno drivers test naif kwds --- tests/pytests/test_juno_drivers.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/pytests/test_juno_drivers.py b/tests/pytests/test_juno_drivers.py index 01aa8271e..309a66b6e 100644 --- a/tests/pytests/test_juno_drivers.py +++ b/tests/pytests/test_juno_drivers.py @@ -21,7 +21,6 @@ def test_kernels(): for kern in binary_kernels: os.remove(kern) -@pytest.mark.xfail @pytest.mark.parametrize("label_type", ['isis3']) def test_mro_load(test_kernels, label_type): label_file = get_image_label('JNCR_2016240_01M06152_V01', label_type) @@ -51,3 +50,22 @@ def test_ephemeris_start_time(self): def test_sensor_model_version(self): assert self.driver.sensor_model_version == 1 + + def test_naif_keywords(self): + with patch('ale.base.data_naif.spice.bodvrd', return_value=[1000, 1000, 1000]) as bodvrd, \ + patch('ale.base.data_naif.spice.bods2c', return_value=599) as bods2c, \ + patch('ale.base.data_naif.spice.cidfrm', return_value=(10015, 'IAU_JUPITER')) as cidfrm: + + naif_keywords = { + "BODY599_RADII" : 1000, + "BODY_CODE" : 599, + "BODY_FRAME_CODE" : 10015 + } + + assert self.driver.naif_keywords["BODY_CODE"] == naif_keywords["BODY_CODE"] + assert self.driver.naif_keywords["BODY599_RADII"] == naif_keywords["BODY599_RADII"] + assert self.driver.naif_keywords["BODY_FRAME_CODE"] == naif_keywords["BODY_FRAME_CODE"] + + bodvrd.assert_called_with('JUPITER', 'RADII', 3) + bods2c.assert_called_with('JUPITER') + cidfrm.assert_called_with(599) \ No newline at end of file From 5b6f569c6201dc4f0de171a8e2fb401dd3e4d0de Mon Sep 17 00:00:00 2001 From: Jacob Cain Date: Wed, 29 May 2024 02:55:29 -0700 Subject: [PATCH 2/4] hayabusa driver tests --- tests/pytests/test_hayabusa2_drivers.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/pytests/test_hayabusa2_drivers.py b/tests/pytests/test_hayabusa2_drivers.py index 1301c2564..f458390bc 100644 --- a/tests/pytests/test_hayabusa2_drivers.py +++ b/tests/pytests/test_hayabusa2_drivers.py @@ -8,6 +8,7 @@ import spiceypy as spice import ale +from ale.drivers.hayabusa2_drivers import Hayabusa2ONCIsisLabelNaifSpiceDriver from ale.formatters.formatter import to_isd from conftest import get_image_kernels, convert_kernels, get_image_label, compare_dicts, get_isd @@ -20,7 +21,6 @@ def test_kernels(): for kern in binary_kernels: os.remove(kern) -@pytest.mark.xfail @pytest.mark.parametrize("label_type", ['isis3']) def test_hayabusa_load(test_kernels, label_type): label_file = get_image_label('hyb2_onc_20151203_084458_w2f_l2a', label_type) @@ -29,3 +29,18 @@ def test_hayabusa_load(test_kernels, label_type): compare_dict = get_isd('hayabusa2') print(json.dumps(isd_obj, indent=2)) assert compare_dicts(isd_obj, compare_dict) == [] + +class test_hayabusa(unittest.TestCase): + + def setUp(self): + label = get_image_label("hyb2_onc_20151203_084458_w2f_l2a", "isis3") + self.driver = Hayabusa2ONCIsisLabelNaifSpiceDriver(label) + + def test_instrument_id(self): + assert self.driver.instrument_id == 'HAYABUSA2_ONC-W2' + + def test_sensor_model_version(self): + assert self.driver.sensor_model_version == 1 + + def test_spacecraft_name(self): + assert self.driver.spacecraft_name == 'HAYABUSA2' \ No newline at end of file From 86f6d8a332abf226a17eb445852b47b06306a41c Mon Sep 17 00:00:00 2001 From: Jacob Cain Date: Thu, 30 May 2024 13:27:00 -0700 Subject: [PATCH 3/4] added remaining odyssey tests --- tests/pytests/test_themis_drivers.py | 47 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/tests/pytests/test_themis_drivers.py b/tests/pytests/test_themis_drivers.py index 1084c21bc..74862a5e6 100644 --- a/tests/pytests/test_themis_drivers.py +++ b/tests/pytests/test_themis_drivers.py @@ -76,6 +76,41 @@ def test_start_time(self): def test_sensor_model_version(self): assert self.driver.sensor_model_version == 1 + def test_ikid(self): + assert self.driver.ikid == -53031 + + def test_sampling_factor(self): + assert self.driver.sampling_factor == 1 + + def test_ephemeris_start_time(self): + with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=400001111.2222333) as scs2e: + assert self.driver.ephemeris_start_time == 400001111.4885301 + + def test_ephemeris_stop_time(self): + with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=400001111.2222333) as scs2e: + assert self.driver.ephemeris_stop_time == 400001127.9656446 + + def test_focal_length(self): + assert self.driver.focal_length == 203.9213 + + def test_detector_center_sample(self): + assert self.driver.detector_center_sample == 160.0 + + def test_detector_center_line(self): + assert self.driver.detector_center_line == 0 + + def test_tdi_mode(self): + assert self.driver.tdi_mode == "ENABLED" + + def test_sensor_name(self): + assert self.driver.sensor_name == "MARS_ODYSSEY" + + def test_band_times(self): + with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=400001111.2222333) as scs2e: + assert self.driver.band_times == [400001111.4885301, + 400001112.0211237, 400001112.8865883, 400001113.7520529, + 400001114.6175175, 400001115.4829821, 400001116.34844667, + 400001117.2139113, 400001118.0460888, 400001118.9115534] class test_themisvis_isis_naif(unittest.TestCase): def setUp(self): @@ -120,13 +155,13 @@ def test_detector_center_line(self): def test_detector_center_sample(self): assert self.driver.detector_center_sample == 512 - - def test_framelets_flipped(self): - assert self.driver.framelets_flipped == True def test_sampling_factor(self): assert self.driver.sampling_factor == 1 + def test_sensor_names(self): + assert self.driver.sensor_name == "MARS_ODYSSEY" + def test_num_frames(self): assert self.driver.num_frames == 19 @@ -138,4 +173,8 @@ def test_interframe_delay(self): def test_band_times(self): with patch('ale.drivers.ody_drivers.spice.scs2e', return_value=392211096.4307215) as scs2e: - assert self.driver.band_times == [392211098.2259215] \ No newline at end of file + assert self.driver.band_times == [392211098.2259215] + + def test_framelets_flipped(self): + assert self.driver.framelets_flipped == True + From fb91f02d4521af4bc53b5be470a85ba6f8a99512 Mon Sep 17 00:00:00 2001 From: Jacob Cain Date: Thu, 30 May 2024 13:34:03 -0700 Subject: [PATCH 4/4] renamed tests to match drivers (themis -> ody) --- tests/pytests/{test_themis_drivers.py => test_ody_drivers.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/pytests/{test_themis_drivers.py => test_ody_drivers.py} (100%) diff --git a/tests/pytests/test_themis_drivers.py b/tests/pytests/test_ody_drivers.py similarity index 100% rename from tests/pytests/test_themis_drivers.py rename to tests/pytests/test_ody_drivers.py