From 54c3e7be2dfc1fc60107bb0711604d15477422a9 Mon Sep 17 00:00:00 2001 From: acpaquette <acpaquette@usgs.gov> Date: Tue, 5 Mar 2024 11:47:23 -0700 Subject: [PATCH] Small fixes (#583) * Added missing camera version to lorri driver * Minor fixes for ores drivers * Minor fixes for viking drivers * Cleaned up msi imports * Removed drivers from disabled list that no longer need to be disabled * Reverted enabling drivers for another PR * Fixed orex tests * Added changelog entries * Added missing property tests for new horizons and viking * Updated viking load tests failing to compare focal lengths * Moved changelog entries to correct place * Fixed small changelog typo --- CHANGELOG.md | 3 + ale/drivers/msi_drivers.py | 11 +- ale/drivers/nh_drivers.py | 4 + ale/drivers/osirisrex_drivers.py | 60 +++- ale/drivers/viking_drivers.py | 22 +- tests/pytests/data/isds/f004a47_isd.json | 2 +- tests/pytests/data/isds/f004b65_isd.json | 2 +- tests/pytests/data/isds/f704b28_isd.json | 2 +- tests/pytests/data/isds/f735a00_isd.json | 2 +- tests/pytests/data/isds/osirisrex_isd.json | 325 ++++++++++++++++++++- tests/pytests/test_newhorizons_drivers.py | 34 +++ tests/pytests/test_osirisrex_drivers.py | 4 +- tests/pytests/test_viking_drivers.py | 18 ++ 13 files changed, 454 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4764ffd..5b29c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,9 @@ release. - Fixed landed sensors to correctly project locally [#590](https://github.com/DOI-USGS/ale/pull/590) - Fixed Hayabusa amica center time computation to match ISIS [#592](https://github.com/DOI-USGS/ale/pull/592) - Set Lunar Oribter abberation correction to None as it is in ISIS [#593](https://github.com/DOI-USGS/ale/pull/593) +- Fixed missing sensor_model_version attribute on NewHorizonsLorriIsisLabelNaifSpiceDriver [#583](https://github.com/DOI-USGS/ale/pull/583) +- Fixed missing sensor_model_version attribute on VikingIsisLabelNaifSpiceDriver [#583](https://github.com/DOI-USGS/ale/pull/583) +- Fixed incorrect distortion look up in Orex camera when working with PolyCam images [#583](https://github.com/DOI-USGS/ale/pull/583) ## [0.10.0] - 2024-01-08 diff --git a/ale/drivers/msi_drivers.py b/ale/drivers/msi_drivers.py index c06476f..bd58647 100644 --- a/ale/drivers/msi_drivers.py +++ b/ale/drivers/msi_drivers.py @@ -1,16 +1,7 @@ -import os -import spiceypy as spice -import json -import numpy as np -import pvl - -import ale from ale.base import Driver from ale.base.label_isis import IsisLabel from ale.base.data_naif import NaifSpice -from ale.base.type_distortion import RadialDistortion, NoDistortion -from ale.base.type_sensor import Framer, LineScanner -from ale.util import generate_kernels_from_cube +from ale.base.type_distortion import NoDistortion from ale.base.type_sensor import Framer from ale.base.type_distortion import NoDistortion diff --git a/ale/drivers/nh_drivers.py b/ale/drivers/nh_drivers.py index 4fd7eb4..92a1457 100644 --- a/ale/drivers/nh_drivers.py +++ b/ale/drivers/nh_drivers.py @@ -99,6 +99,10 @@ class NewHorizonsLorriIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoD def frame_chain(self): self._props['exact_ck_times'] = False return super().frame_chain + + @property + def sensor_model_version(self): + return 2 class NewHorizonsLeisaIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, NoDistortion, Driver): """ diff --git a/ale/drivers/osirisrex_drivers.py b/ale/drivers/osirisrex_drivers.py index 1123fa3..4369d96 100644 --- a/ale/drivers/osirisrex_drivers.py +++ b/ale/drivers/osirisrex_drivers.py @@ -7,6 +7,8 @@ from ale.base.type_sensor import Framer from ale.base.base import Driver from ale.base.type_distortion import RadialDistortion +from ale import util + class OsirisRexCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, RadialDistortion, Driver): @property def instrument_id(self): @@ -26,6 +28,22 @@ class OsirisRexCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Radi "SamCam" : "SAMCAM" } return 'ORX_OCAMS_' + sensor_lookup[super().instrument_id] + + @property + def polyCamFocusPositionNaifId(self): + """ + Returns the focal length specific Naif ID for USGS Astro + IAK distortion model look ups. + + Returns + ------- + : int + Special focal length specific Naif ID + """ + if self.instrument_id == "ORX_OCAMS_POLYCAM": + return self.label['IsisCube']['Instrument']['PolyCamFocusPositionNaifId'] + else: + return None @property def sensor_name(self): @@ -52,21 +70,6 @@ class OsirisRexCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Radi """ return self.label['IsisCube']['Instrument']['ExposureDuration'].value * 0.001 - - @property - def sensor_frame_id(self): - """ - Returns the Naif ID code for the sensor reference frame. - This is the frame of the OsirisRex instrument itself, and is not dependent on filter. - - Returns - ------- - : int - Naif ID code for the sensor frame - """ - return -64000 - - @property def detector_center_line(self): """ @@ -120,4 +123,31 @@ class OsirisRexCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Radi if self.filter_name == "UNKNOWN": return spice.gdpool('INS{}_OD_K'.format(self.ikid),0, 3).tolist() else: + if self.polyCamFocusPositionNaifId != None: + return spice.gdpool('INS{focusId}_OD_K_{filter}'.format(focusId = self.polyCamFocusPositionNaifId, filter = self.filter_name),0, 3).tolist() return spice.gdpool('INS{ikid}_OD_K_{filter}'.format(ikid = self.ikid, filter = self.filter_name),0, 3).tolist() + + @property + def naif_keywords(self): + """ + Gets all default naif keywords as well as any naif keywords that + contain the special focal length specific Naif ID + + Returns + ------- + : dict + Dictionary of keywords and values that ISIS creates and attaches to the label + """ + return {**super().naif_keywords, **util.query_kernel_pool(f"*{self.polyCamFocusPositionNaifId}*")} + + @property + def sensor_model_version(self): + """ + Returns the ISIS camera version + + Returns + ------- + : int + Camera version number + """ + return 1 \ No newline at end of file diff --git a/ale/drivers/viking_drivers.py b/ale/drivers/viking_drivers.py index a0f1a11..4d0d1c4 100644 --- a/ale/drivers/viking_drivers.py +++ b/ale/drivers/viking_drivers.py @@ -132,17 +132,20 @@ class VikingIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, """ if not hasattr(self, "_focal_length"): if (self.spacecraft_name == "VIKING ORBITER 1"): - if (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A"): + if (self.sensor_name == "Visual Imaging Subsystem Camera A"): self._focal_length = 474.398 - elif (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B"): + elif (self.sensor_name == "Visual Imaging Subsystem Camera B"): self._focal_length = 474.448 + print("Setting focal") elif (self.spacecraft_name == "VIKING ORBITER 2"): - if (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A"): + if (self.sensor_name == "Visual Imaging Subsystem Camera A"): self._focal_length = 474.610 - elif (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B"): + elif (self.sensor_name == "Visual Imaging Subsystem Camera B"): self._focal_length = 474.101 else: raise Exception(f"Unknown viking instrument to get focal length: {self.spacecraft_name}, {self.sensor_name}") + + return self._focal_length @property def detector_center_line(self): @@ -152,6 +155,17 @@ class VikingIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, def detector_center_sample(self): return 0 + @property + def sensor_model_version(self): + """ + Returns the ISIS camera version + + Returns + ------- + : int + Camera version number + """ + return 1 class VikingIsisLabelIsisSpiceDriver(Framer, IsisLabel, IsisSpice, NoDistortion, Driver): diff --git a/tests/pytests/data/isds/f004a47_isd.json b/tests/pytests/data/isds/f004a47_isd.json index e368d0f..1aaa968 100644 --- a/tests/pytests/data/isds/f004a47_isd.json +++ b/tests/pytests/data/isds/f004a47_isd.json @@ -154,7 +154,7 @@ "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": { - "focal_length": null + "focal_length": 474.398 }, "detector_center": { "line": 0, diff --git a/tests/pytests/data/isds/f004b65_isd.json b/tests/pytests/data/isds/f004b65_isd.json index b964456..c3fa919 100644 --- a/tests/pytests/data/isds/f004b65_isd.json +++ b/tests/pytests/data/isds/f004b65_isd.json @@ -154,7 +154,7 @@ "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": { - "focal_length": null + "focal_length": 474.61 }, "detector_center": { "line": 0, diff --git a/tests/pytests/data/isds/f704b28_isd.json b/tests/pytests/data/isds/f704b28_isd.json index 803b390..c0aba63 100644 --- a/tests/pytests/data/isds/f704b28_isd.json +++ b/tests/pytests/data/isds/f704b28_isd.json @@ -154,7 +154,7 @@ "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": { - "focal_length": null + "focal_length": 474.101 }, "detector_center": { "line": 0, diff --git a/tests/pytests/data/isds/f735a00_isd.json b/tests/pytests/data/isds/f735a00_isd.json index 9479517..9861392 100644 --- a/tests/pytests/data/isds/f735a00_isd.json +++ b/tests/pytests/data/isds/f735a00_isd.json @@ -154,7 +154,7 @@ "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": { - "focal_length": null + "focal_length": 474.448 }, "detector_center": { "line": 0, diff --git a/tests/pytests/data/isds/osirisrex_isd.json b/tests/pytests/data/isds/osirisrex_isd.json index 5a14bf7..dd2b875 100644 --- a/tests/pytests/data/isds/osirisrex_isd.json +++ b/tests/pytests/data/isds/osirisrex_isd.json @@ -1 +1,324 @@ -{"isis_camera_version": 1, "image_lines": 1024, "image_samples": 1024, "name_platform": "OSIRIS-REX", "name_sensor": "MapCam", "reference_height": {"maxheight": 1000, "minheight": -1000, "unit": "m"}, "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL", "center_ephemeris_time": 604882849.4327942, "radii": {"semimajor": 0.283065, "semiminor": 0.24972, "unit": "km"}, "body_rotation": {"time_dependent_frames": [10106, 1], "ck_table_start_time": 604882849.4327942, "ck_table_end_time": 604882849.4327942, "ck_table_original_size": 1, "ephemeris_times": [604882849.4327942], "quaternions": [[-0.24468662154888665, -0.8995476917306681, 0.3540944064834505, 0.07456244922312974]], "angular_velocities": [[1.5901075118354376e-05, 0.00020029780775859552, -0.0003531029098106748]], "reference_frame": 1}, "instrument_pointing": {"time_dependent_frames": [-64000, 1], "ck_table_start_time": 604882849.4327942, "ck_table_end_time": 604882849.4327942, "ck_table_original_size": 1, "ephemeris_times": [604882849.4327942], "quaternions": [[-0.49481036455664573, 0.4609332756246706, -0.3664592415687433, -0.6390702956780986]], "angular_velocities": [[5.395053026508693e-06, -5.108637996042997e-06, 2.277063782852625e-06]], "reference_frame": 1, "constant_frames": [-64000], "constant_rotation": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]}, "naif_keywords": {"BODY2101955_RADII": [0.283065, 0.271215, 0.24972], "BODY_FRAME_CODE": 10106, "BODY_CODE": 2101955, "INS-64361_TOLERANCE": 1e-10, "INS-64361_ITRANSL": [0.0, 117.64705882353, 0.0], "INS-64361_ITRANSS": [0.0, 0.0, 117.64705882353], "FRAME_-64361_CLASS": 3.0, "INS-64361_FOCAL_LENGTH": 125.2, "FRAME_-64361_CENTER": -64.0, "INS-64361_WAVELENGTH_RANGE": [440.0, 890.0], "CK_-64361_SPK": -64.0, "INS-64361_OD_CENTER_PAN": [486.2, 450.3], "INS-64361_PIXEL_LINES": 1024.0, "INS-64361_OD_CENTER_B": [497.3, 456.8], "INS-64361_TRANSX": [0.0, 0.0, 0.0085], "INS-64361_TRANSY": [0.0, 0.0085, 0.0], "INS-64361_OD_CENTER_V": [494.3, 473.8], "INS-64361_OD_CENTER_W": [510.3, 461.2], "INS-64361_OD_CENTER_X": [504.5, 450.5], "INS-64361_F/NUMBER": 3.295, "INS-64361_LT_SURFACE_CORRECT": "FALSE", "INS-64361_FOV_ANGLE_UNITS": "DEGREES", "INS-64361_SWAP_OBSERVER_TARGET": "TRUE", "INS-64361_FOV_REF_ANGLE": 1.9849999999999999, "INS-64361_DEBUG_MODEL": "FALSE", "INS-64361_BORESIGHT": [0.0, 0.0, 1.0], "INS-64361_LIGHTTIME_CORRECTION": "LT+S", "INS-64361_FOV_CLASS_SPEC": "ANGLES", "INS-64361_FOV_REF_VECTOR": [1.0, 0.0, 0.0], "INS-64361_IFOV": 67.675, "INS-64361_FOV_CENTER_PIXEL": [511.5, 511.5], "INS-64361_DISTORTION_MODEL": "OPENCV", "INS-64361_FOV_SHAPE": "RECTANGLE", "INS-64361_FOV_CROSS_ANGLE": 1.9849999999999999, "INS-64361_PIXEL_SIZE": 8.5, "INS-64361_FL_UNCERTAINTY": 0.5, "INS-64361_FOV_FRAME": "ORX_OCAMS_MAPCAM", "INS-64361_OD_K_PAN": [2.21e-05, 0.000171, 5.96e-05, 0.0, 0.0], "FRAME_-64361_NAME": "ORX_OCAMS_MAPCAM", "INS-64361_OD_K_B": [5.06e-05, 0.00016299999999999998, 6e-05, 0.0, 0.0], "INS-64361_PIXEL_SAMPLES": 1024.0, "INS-64361_OD_K_V": [7.450000000000001e-05, 0.00022, 6.22e-05, 0.0, 0.0], "INS-64361_OD_K_W": [2.21e-05, 0.000132, 6.08e-05, 0.0, 0.0], "INS-64361_OD_K_X": [2.44e-05, -3.6099999999999997e-05, 8.869999999999999e-05, 0.0, 0.0], "INS-64361_CCD_CENTER": [511.5, 511.5], "FRAME_-64361_CLASS_ID": -64361.0, "CK_-64361_SCLK": -64.0, "INS-64361_SPOC_FITS_NAXIS1": [0.0, 1.0, 0.0], "INS-64361_SPOC_FITS_NAXIS2": [1.0, 0.0, 0.0], "BODY2101955_PM": [140.68835, 2011.145755336826, 1.815e-06], "BODY2101955_POLE_DEC": [-60.3586, 0.0, 0.0], "BODY2101955_POLE_RA": [85.46097, 0.0, 0.0], "BODY2101955_LONG_AXIS": 0.0, "OBJECT_2101955_FRAME": "IAU_BENNU"}, "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": {"focal_length": 125.2}, "detector_center": {"line": 511.5, "sample": 511.5}, "focal2pixel_lines": [0.0, 117.64705882353, 0.0], "focal2pixel_samples": [0.0, 0.0, 117.64705882353], "optical_distortion": {"radial": {"coefficients": [2.21e-05, 0.000171, 5.96e-05]}}, "starting_detector_line": 0, "starting_detector_sample": 0, "instrument_position": {"spk_table_start_time": 604882849.4327942, "spk_table_end_time": 604882849.4327942, "spk_table_original_size": 1, "ephemeris_times": [604882849.4327942], "positions": [[6.263896259086776, -0.17789034115912727, -2.0516825743917164]], "velocities": [[-1.6329228503551952e-05, 5.936927842752571e-06, -2.2327914272865625e-05]], "reference_frame": 1}, "sun_position": {"spk_table_start_time": 604882849.4327942, "spk_table_end_time": 604882849.4327942, "spk_table_original_size": 1, "ephemeris_times": [604882849.4327942], "positions": [[94633635.43566033, -98012563.34059505, -55786970.073704116]], "velocities": [[27.39074526770413, 14.215569043304772, 7.916498653173447]], "reference_frame": 1}} \ No newline at end of file +{ + "isis_camera_version": 1, + "image_lines": 1024, + "image_samples": 1024, + "name_platform": "OSIRIS-REX", + "name_sensor": "MapCam", + "reference_height": { + "maxheight": 1000, + "minheight": -1000, + "unit": "m" + }, + "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL", + "center_ephemeris_time": 604882849.4327942, + "radii": { + "semimajor": 0.283065, + "semiminor": 0.24972, + "unit": "km" + }, + "body_rotation": { + "time_dependent_frames": [ + 10106, + 1 + ], + "ck_table_start_time": 604882849.4327942, + "ck_table_end_time": 604882849.4327942, + "ck_table_original_size": 1, + "ephemeris_times": [ + 604882849.4327942 + ], + "quaternions": [ + [ + -0.24468662154888665, + -0.8995476917306681, + 0.3540944064834505, + 0.07456244922312974 + ] + ], + "angular_velocities": [ + [ + 1.5901075118354376e-05, + 0.00020029780775859552, + -0.0003531029098106748 + ] + ], + "reference_frame": 1 + }, + "instrument_pointing": { + "time_dependent_frames": [ + -64361, + -64000, + 1 + ], + "ck_table_start_time": 604882849.4327942, + "ck_table_end_time": 604882849.4327942, + "ck_table_original_size": 1, + "ephemeris_times": [ + 604882849.4327942 + ], + "quaternions": [ + [ + 0.4945916645160911, + -0.4620797005791134, + 0.36450726891518725, + 0.6395278622639601 + ] + ], + "angular_velocities": [ + [ + 5.395053026508693e-06, + -5.108637996042997e-06, + 2.277063782852625e-06 + ] + ], + "reference_frame": 1, + "constant_frames": [ + -64361 + ], + "constant_rotation": [ + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0 + ] + }, + "naif_keywords": { + "BODY2101955_RADII": [ + 0.283065, + 0.271215, + 0.24972 + ], + "BODY_FRAME_CODE": 10106, + "BODY_CODE": 2101955, + "INS-64361_TOLERANCE": 1e-10, + "INS-64361_ITRANSL": [ + 0.0, + 117.64705882353, + 0.0 + ], + "INS-64361_ITRANSS": [ + 0.0, + 0.0, + 117.64705882353 + ], + "FRAME_-64361_CLASS": 3.0, + "INS-64361_FOCAL_LENGTH": 125.2, + "FRAME_-64361_CENTER": -64.0, + "INS-64361_WAVELENGTH_RANGE": [ + 440.0, + 890.0 + ], + "CK_-64361_SPK": -64.0, + "INS-64361_OD_CENTER_PAN": [ + 486.2, + 450.3 + ], + "INS-64361_PIXEL_LINES": 1024.0, + "INS-64361_OD_CENTER_B": [ + 497.3, + 456.8 + ], + "INS-64361_TRANSX": [ + 0.0, + 0.0, + 0.0085 + ], + "INS-64361_TRANSY": [ + 0.0, + 0.0085, + 0.0 + ], + "INS-64361_OD_CENTER_V": [ + 494.3, + 473.8 + ], + "INS-64361_OD_CENTER_W": [ + 510.3, + 461.2 + ], + "INS-64361_OD_CENTER_X": [ + 504.5, + 450.5 + ], + "INS-64361_F/NUMBER": 3.295, + "INS-64361_LT_SURFACE_CORRECT": "FALSE", + "INS-64361_FOV_ANGLE_UNITS": "DEGREES", + "INS-64361_SWAP_OBSERVER_TARGET": "TRUE", + "INS-64361_FOV_REF_ANGLE": 1.9849999999999999, + "INS-64361_DEBUG_MODEL": "FALSE", + "INS-64361_BORESIGHT": [ + 0.0, + 0.0, + 1.0 + ], + "INS-64361_LIGHTTIME_CORRECTION": "LT+S", + "INS-64361_FOV_CLASS_SPEC": "ANGLES", + "INS-64361_FOV_REF_VECTOR": [ + 1.0, + 0.0, + 0.0 + ], + "INS-64361_IFOV": 67.675, + "INS-64361_FOV_CENTER_PIXEL": [ + 511.5, + 511.5 + ], + "INS-64361_DISTORTION_MODEL": "OPENCV", + "INS-64361_FOV_SHAPE": "RECTANGLE", + "INS-64361_FOV_CROSS_ANGLE": 1.9849999999999999, + "INS-64361_PIXEL_SIZE": 8.5, + "INS-64361_FL_UNCERTAINTY": 0.5, + "INS-64361_FOV_FRAME": "ORX_OCAMS_MAPCAM", + "INS-64361_OD_K_PAN": [ + 2.21e-05, + 0.000171, + 5.96e-05, + 0.0, + 0.0 + ], + "FRAME_-64361_NAME": "ORX_OCAMS_MAPCAM", + "INS-64361_OD_K_B": [ + 5.06e-05, + 0.00016299999999999998, + 6e-05, + 0.0, + 0.0 + ], + "INS-64361_PIXEL_SAMPLES": 1024.0, + "INS-64361_OD_K_V": [ + 7.450000000000001e-05, + 0.00022, + 6.22e-05, + 0.0, + 0.0 + ], + "INS-64361_OD_K_W": [ + 2.21e-05, + 0.000132, + 6.08e-05, + 0.0, + 0.0 + ], + "INS-64361_OD_K_X": [ + 2.44e-05, + -3.6099999999999997e-05, + 8.869999999999999e-05, + 0.0, + 0.0 + ], + "INS-64361_CCD_CENTER": [ + 511.5, + 511.5 + ], + "FRAME_-64361_CLASS_ID": -64361.0, + "CK_-64361_SCLK": -64.0, + "INS-64361_SPOC_FITS_NAXIS1": [ + 0.0, + 1.0, + 0.0 + ], + "INS-64361_SPOC_FITS_NAXIS2": [ + 1.0, + 0.0, + 0.0 + ], + "BODY2101955_PM": [ + 140.68835, + 2011.145755336826, + 1.815e-06 + ], + "BODY2101955_POLE_DEC": [ + -60.3586, + 0.0, + 0.0 + ], + "BODY2101955_POLE_RA": [ + 85.46097, + 0.0, + 0.0 + ], + "BODY2101955_LONG_AXIS": 0.0, + "OBJECT_2101955_FRAME": "IAU_BENNU" + }, + "detector_sample_summing": 1, + "detector_line_summing": 1, + "focal_length_model": { + "focal_length": 125.2 + }, + "detector_center": { + "line": 511.5, + "sample": 511.5 + }, + "focal2pixel_lines": [ + 0.0, + 117.64705882353, + 0.0 + ], + "focal2pixel_samples": [ + 0.0, + 0.0, + 117.64705882353 + ], + "optical_distortion": { + "radial": { + "coefficients": [ + 2.21e-05, + 0.000171, + 5.96e-05 + ] + } + }, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "instrument_position": { + "spk_table_start_time": 604882849.4327942, + "spk_table_end_time": 604882849.4327942, + "spk_table_original_size": 1, + "ephemeris_times": [ + 604882849.4327942 + ], + "positions": [ + [ + 6.263896259086776, + -0.17789034115912727, + -2.0516825743917164 + ] + ], + "velocities": [ + [ + -1.6329228503551952e-05, + 5.936927842752571e-06, + -2.2327914272865625e-05 + ] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 604882849.4327942, + "spk_table_end_time": 604882849.4327942, + "spk_table_original_size": 1, + "ephemeris_times": [ + 604882849.4327942 + ], + "positions": [ + [ + 94633635.43566033, + -98012563.34059505, + -55786970.073704116 + ] + ], + "velocities": [ + [ + 27.39074526770413, + 14.215569043304772, + 7.916498653173447 + ] + ], + "reference_frame": 1 + } +} \ No newline at end of file diff --git a/tests/pytests/test_newhorizons_drivers.py b/tests/pytests/test_newhorizons_drivers.py index 40f09c6..958eec0 100644 --- a/tests/pytests/test_newhorizons_drivers.py +++ b/tests/pytests/test_newhorizons_drivers.py @@ -110,6 +110,40 @@ class test_leisa_isis_naif(unittest.TestCase): def test_exposure_duration(self): np.testing.assert_almost_equal(self.driver.exposure_duration, 0.856) +# ========= Test Leisa isislabel and naifspice driver ========= +class test_lorri_isis_naif(unittest.TestCase): + def setUp(self): + label = get_image_label("lor_0034974380_0x630_sci_1", "isis") + self.driver = NewHorizonsLorriIsisLabelNaifSpiceDriver(label) + + def test_instrument_id(self): + assert self.driver.instrument_id == "NH_LORRI" + + def test_ikid(self): + assert self.driver.ikid == -98301 + + def test_ephemeris_stop_time(self): + with patch('ale.drivers.nh_drivers.spice.scs2e', return_value=12345) as scs2e: + assert self.driver.ephemeris_stop_time == 12345 + scs2e.assert_called_with(-98, '1/0034974379:47125') + + def test_detector_center_sample(self): + with patch('ale.drivers.nh_drivers.spice.gdpool', return_value=[-1, 0, -1]) as gdpool: + assert self.driver.detector_center_sample == 0 + + def test_detector_center_line(self): + with patch('ale.drivers.nh_drivers.spice.gdpool', return_value=[0, -1, -1]) as gdpool: + assert self.driver.detector_center_line == 0 + + def test_sensor_name(self): + assert self.driver.sensor_name == "NEW HORIZONS" + + def test_exposure_duration(self): + np.testing.assert_almost_equal(self.driver.exposure_duration, 7.5e-05) + + def test_sensor_model_version(self): + assert self.driver.sensor_model_version == 2 + class test_mvic_framer_isis3_naif(unittest.TestCase): def setUp(self): diff --git a/tests/pytests/test_osirisrex_drivers.py b/tests/pytests/test_osirisrex_drivers.py index 74b60db..a234253 100644 --- a/tests/pytests/test_osirisrex_drivers.py +++ b/tests/pytests/test_osirisrex_drivers.py @@ -45,7 +45,9 @@ class test_osirisrex_isis_naif(unittest.TestCase): np.testing.assert_almost_equal(self.driver.exposure_duration, 0.005285275) def test_sensor_frame_id(self): - assert self.driver.sensor_frame_id == -64000 + with patch('ale.drivers.osirisrex_drivers.spice.bods2c', return_value=-64361) as bods2c: + assert self.driver.sensor_frame_id == -64361 + bods2c.assert_called_with('ORX_OCAMS_MAPCAM') def test_detector_center_sample(self): with patch('ale.drivers.osirisrex_drivers.spice.gdpool', return_value=np.array([12345, 100])) as gdpool, \ diff --git a/tests/pytests/test_viking_drivers.py b/tests/pytests/test_viking_drivers.py index 38e3da2..3b63c9e 100644 --- a/tests/pytests/test_viking_drivers.py +++ b/tests/pytests/test_viking_drivers.py @@ -291,6 +291,12 @@ class test_isis_naif(unittest.TestCase): def test_short_mission_name(self): assert self.driver.short_mission_name == 'viking' + def test_instrument_id(self): + assert self.driver.instrument_id == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B" + + def test_sensor_name(self): + assert self.driver.sensor_name == "Visual Imaging Subsystem Camera B" + def test_spacecraft_name(self): assert self.driver.spacecraft_name == 'VIKING ORBITER 1' @@ -305,8 +311,20 @@ class test_isis_naif(unittest.TestCase): assert self.driver.ephemeris_start_time == 54324.99 scs2e.assert_called_with(-27999, '40031801') + def test_detector_center_line(self): + assert self.driver.detector_center_line == 0 + + def test_detector_center_sample(self): + assert self.driver.detector_center_sample == 0 + + def test_focal_length(self): + assert self.driver.focal_length == 474.448 + @patch('ale.base.label_isis.IsisLabel.exposure_duration', 0.43) def test_ephemeris_start_time_different_exposure(self): with patch('ale.drivers.viking_drivers.spice.scs2e', return_value=54321) as scs2e: assert self.driver.ephemeris_start_time == 54322.75 scs2e.assert_called_with(-27999, '40031801') + + def test_sensor_model_version(self): + assert self.driver.sensor_model_version == 1 -- GitLab