diff --git a/ale/base/type_sensor.py b/ale/base/type_sensor.py index 16e7e0b99..0a9142c71 100644 --- a/ale/base/type_sensor.py +++ b/ale/base/type_sensor.py @@ -54,7 +54,7 @@ def ephemeris_time(self): : ndarray ephemeris times split based on image lines """ - return np.linspace(self.ephemeris_start_time, self.ephemeris_stop_time, max(2, int(self.image_lines / 64))) + return np.linspace(self.ephemeris_start_time, self.ephemeris_stop_time, max(2, int(self.image_lines/64))) @property def ephemeris_stop_time(self): diff --git a/ale/drivers/hayabusa2_drivers.py b/ale/drivers/hayabusa2_drivers.py index 6b68c59d6..d2ab85f87 100644 --- a/ale/drivers/hayabusa2_drivers.py +++ b/ale/drivers/hayabusa2_drivers.py @@ -4,9 +4,10 @@ from ale.base.data_naif import NaifSpice from ale.base.label_isis import IsisLabel from ale.base.type_sensor import Framer +from ale.base.type_distortion import NoDistortion from ale.base.base import Driver -class Hayabusa2ONCIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver): +class Hayabusa2ONCIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver): @property def instrument_id(self): diff --git a/ale/drivers/juno_drivers.py b/ale/drivers/juno_drivers.py index b9bdaa889..137e413cb 100644 --- a/ale/drivers/juno_drivers.py +++ b/ale/drivers/juno_drivers.py @@ -2,9 +2,10 @@ from ale.base.data_naif import NaifSpice from ale.base.label_isis import IsisLabel from ale.base.type_sensor import Framer +from ale.base.type_distortion import NoDistortion from ale.base.base import Driver -class JunoJunoCamIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver): +class JunoJunoCamIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver): """ Driver for reading Juno ISIS labels. """ diff --git a/ale/drivers/nh_drivers.py b/ale/drivers/nh_drivers.py index 529166d7c..f7d96edab 100644 --- a/ale/drivers/nh_drivers.py +++ b/ale/drivers/nh_drivers.py @@ -7,11 +7,12 @@ import numpy as np from ale.base import Driver +from ale.base.type_distortion import NoDistortion from ale.base.data_naif import NaifSpice from ale.base.label_isis import IsisLabel from ale.base.type_sensor import Framer -class NewHorizonsLorriIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver): +class NewHorizonsLorriIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver): """ Driver for reading New Horizons LORRI ISIS3 Labels. These are Labels that have been ingested into ISIS from PDS EDR images but have not been spiceinit'd yet. @@ -22,7 +23,7 @@ def instrument_id(self): Returns an instrument id for uniquely identifying the instrument, but often also used to be piped into Spice Kernels to acquire IKIDs. Therefore they the same ID the Spice expects in bods2c calls. - + Returns ------- : str @@ -52,3 +53,15 @@ def ikid(self): Naif Integer ID code for the instrument """ return self.label['IsisCube']['Kernels']['NaifFrameCode'] + + @property + def detector_center_line(self): + return float(spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 3)[0]) + + @property + def detector_center_sample(self): + return float(spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 3)[1]) + + @property + def sensor_name(self): + return self.label['IsisCube']['Instrument']['SpacecraftName'] diff --git a/ale/drivers/ody_drivers.py b/ale/drivers/ody_drivers.py index 9d1cab5a2..c55387c8e 100644 --- a/ale/drivers/ody_drivers.py +++ b/ale/drivers/ody_drivers.py @@ -1,14 +1,15 @@ import spiceypy as spice import ale +from ale.base.base import Driver +from ale.base.type_distortion import NoDistortion from ale.base.data_naif import NaifSpice from ale.base.label_isis import IsisLabel from ale.base.type_sensor import LineScanner -from ale.base.base import Driver import pvl -class OdyThemisIrIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, Driver): +class OdyThemisIrIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, NoDistortion, Driver): """ Driver for Themis IR ISIS cube """ @@ -59,8 +60,24 @@ def ephemeris_start_time(self): return og_start_time + offset + @property + def focal_length(self): + return 202.059 + + @property + def detector_center_line(self): + return 0 + + @property + def detector_center_sample(self): + return 0 + + @property + def sensor_name(self): + return self.label['IsisCube']['Instrument']['SpacecraftName'] + -class OdyThemisVisIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, Driver): +class OdyThemisVisIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, NoDistortion, Driver): """" Driver for Themis VIS ISIS cube """ @@ -136,3 +153,19 @@ def line_exposure_duration(self): # if no units are available, assume the exposure duration is given in milliseconds line_exposure_duration = line_exposure_duration * 0.001 return line_exposure_duration + + @property + def focal_length(self): + return 202.059 + + @property + def detector_center_line(self): + return 0 + + @property + def detector_center_sample(self): + return 0 + + @property + def sensor_name(self): + return self.label['IsisCube']['Instrument']['SpacecraftName'] diff --git a/ale/drivers/tgo_drivers.py b/ale/drivers/tgo_drivers.py index a81215c4e..69b21f67d 100644 --- a/ale/drivers/tgo_drivers.py +++ b/ale/drivers/tgo_drivers.py @@ -10,8 +10,9 @@ from ale.base.data_naif import NaifSpice from ale.base.label_isis import IsisLabel from ale.base.type_sensor import Framer +from ale.base.type_distortion import NoDistortion -class TGOCassisIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver): +class TGOCassisIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver): """ Driver for reading TGO Cassis ISIS3 Labels. These are Labels that have been ingested into ISIS from PDS EDR images but have not been spiceinit'd yet. @@ -64,3 +65,7 @@ def sensor_model_version(self): ISIS sensor model version """ return 1 + + @property + def sensor_name(self): + return self.label['IsisCube']['Instrument']['SpacecraftName'] diff --git a/tests/pytests/data/isds/cassis_isd.json b/tests/pytests/data/isds/cassis_isd.json new file mode 100644 index 000000000..82678f13f --- /dev/null +++ b/tests/pytests/data/isds/cassis_isd.json @@ -0,0 +1,264 @@ +{ + "isis_camera_version": 1, + "naif_keywords": { + "BODY499_RADII": [3396.19, 3396.19, 3376.2], + "BODY_FRAME_CODE": 10014, + "BODY_CODE": 499, + "INS-143400_FOV_ANGLE_UNITS": "DEGREES", + "INS-143400_OD_A3_DIST": [ + 1.78250771483506e-05, + 4.24592743471094e-06, + 9.51220699036653e-06, + 0.00215158425420738, + -0.0066835595774833, + 0.573741540971609 + ], + "TKFRAME_-143400_ANGLES": [0.021, 0.12, -179.881], + "FRAME_-143400_CENTER": -143.0, + "INS-143400_FOV_CLASS_SPEC": "ANGLES", + "INS-143400_OD_A3_CORR": [ + -3.13320167004204e-05, + -7.35655125749807e-06, + -1.57664245066771e-05, + 0.00373549465439151, + -0.0141671946930935, + 1.0 + ], + "INS-143400_FOV_REF_VECTOR": [1.0, 0.0, 0.0], + "TKFRAME_-143400_AXES": [1.0, 2.0, 3.0], + "TKFRAME_-143400_SPEC": "ANGLES", + "INS-143400_OD_A2_DIST": [ + -5.69725741015406e-05, + 0.00215155905679149, + -0.00716392991767185, + 0.000124152787728634, + 0.576459544392426, + 0.010576940564854 + ], + "FRAME_-143400_NAME": "TGO_CASSIS_CRU", + "INS-143400_BORESIGHT": [0.0, 0.0, 1.0], + "INS-143400_ITRANSL": [0.0, 0.0, 100.0], + "TKFRAME_-143400_RELATIVE": "TGO_SPACECRAFT", + "INS-143400_ITRANSS": [0.0, 100.0, 0.0], + "INS-143400_FOV_CROSS_ANGLE": 0.67057, + "INS-143400_BORESIGHT_LINE": 1024.5, + "INS-143400_OD_A2_CORR": [ + 9.9842559363676e-05, + 0.00373543707958162, + -0.0133299918873929, + -0.000215311328389359, + 0.995296015537294, + -0.0183542717710778 + ], + "INS-143400_SWAP_OBSERVER_TARGET": "TRUE", + "FRAME_-143400_CLASS_ID": -143400.0, + "INS-143400_LIGHTTIME_CORRECTION": "LT+S", + "INS-143400_BORESIGHT_SAMPLE": 1024.5, + "INS-143400_PIXEL_PITCH": 0.01, + "INS-143400_FOV_REF_ANGLE": 0.67057, + "INS-143400_FOV_SHAPE": "RECTANGLE", + "INS-143400_OD_A1_DIST": [ + 0.00213658795560622, + -0.00711785765064197, + 1.10355974742147e-05, + 0.573607182625377, + 0.000250884350194894, + 0.000550623913037132 + ], + "INS-143400_FILTER_SAMPLES": 2048.0, + "INS-143400_FILTER_LINES": 2048.0, + "INS-143400_OD_A1_CORR": [ + 0.00376130530948266, + -0.0134154156065812, + -1.86749521007237e-05, + 1.00021352681836, + -0.000432362371703953, + -0.000948065735350123 + ], + "INS-143400_FOV_FRAME": "TGO_CASSIS_FSA", + "INS-143400_LT_SURFACE_CORRECT": "TRUE", + "INS-143400_NAME": "TGO_CASSIS", + "INS-143400_FOCAL_LENGTH": 874.9, + "FRAME_-143400_CLASS": 4.0, + "INS-143400_TRANSX": [0.0, 0.01, 0.0], + "INS-143400_TRANSY": [0.0, 0.0, 0.01], + "TKFRAME_-143400_UNITS": "DEGREES", + "FRAME_1503499_CLASS": 4.0, + "FRAME_1500499_SEC_FRAME": "J2000", + "FRAME_1500499_DEF_STYLE": "PARAMETERIZED", + "TKFRAME_1503499_SPEC": "MATRIX", + "FRAME_1500499_PRI_AXIS": "Z", + "BODY499_POLE_DEC": [52.8865, -0.0609, 0.0], + "FRAME_1502499_PRI_TARGET": "SUN", + "FRAME_1502499_CENTER": 499.0, + "FRAME_1501499_ANGLE_1_COEFFS": [-47.68143, 3.362106117068471e-11], + "FRAME_1502499_FAMILY": "TWO-VECTOR", + "FRAME_1503499_NAME": "MME2000", + "FRAME_1502499_SEC_TARGET": "SUN", + "FRAME_1501499_EPOCH": 0.0, + "FRAME_1500499_SEC_SPEC": "RECTANGULAR", + "FRAME_1501499_UNITS": "DEGREES", + "FRAME_1500499_CENTER": 499.0, + "FRAME_1502499_PRI_OBSERVER": "MARS", + "FRAME_1500499_FAMILY": "TWO-VECTOR", + "FRAME_1502499_SEC_VECTOR_DEF": "OBSERVER_TARGET_VELOCITY", + "FRAME_1500499_CLASS": 5.0, + "FRAME_1500499_SEC_VECTOR_DEF": "CONSTANT", + "FRAME_1501499_ANGLE_2_COEFFS": [-37.1135, -1.929804547874363e-11], + "FRAME_1500499_PRI_SPEC": "RECTANGULAR", + "BODY499_POLE_RA": [317.68143, -0.1061, 0.0], + "FRAME_1500499_PRI_VECTOR": [0.0, 0.0, 1.0], + "FRAME_1502499_PRI_VECTOR_DEF": "OBSERVER_TARGET_POSITION", + "TKFRAME_1503499_RELATIVE": "J2000", + "FRAME_1500499_NAME": "MME", + "FRAME_1500499_PRI_VECTOR_DEF": "CONSTANT", + "FRAME_1500499_SEC_VECTOR": [0.0, 0.0, 1.0], + "BODY499_PM": [176.63, 350.89198226, 0.0], + "FRAME_1502499_SEC_FRAME": "J2000", + "FRAME_1502499_PRI_ABCORR": "NONE", + "FRAME_1503499_CENTER": 499.0, + "FRAME_1502499_DEF_STYLE": "PARAMETERIZED", + "FRAME_1503499_CLASS_ID": 1503499.0, + "FRAME_1502499_RELATIVE": "J2000", + "FRAME_1502499_SEC_ABCORR": "NONE", + "FRAME_1501499_CLASS": 5.0, + "TKFRAME_1503499_MATRIX": [ + 0.6732521982472339, + 0.7394129276360181, + 0.0, + -0.589638760543004, + 0.536879430789133, + 0.6033958972853946, + 0.4461587269353556, + -0.4062376142607541, + 0.7974417791532832 + ], + "FRAME_1502499_CLASS_ID": 1502499.0, + "FRAME_1501499_ANGLE_3_COEFFS": 0.0, + "FRAME_1501499_RELATIVE": "J2000", + "FRAME_1501499_NAME": "MME_IAU2000", + "FRAME_1501499_CENTER": 499.0, + "FRAME_1501499_CLASS_ID": 1501499.0, + "FRAME_1500499_RELATIVE": "J2000", + "FRAME_1501499_FAMILY": "EULER", + "FRAME_1502499_SEC_AXIS": "Y", + "FRAME_1502499_CLASS": 5.0, + "FRAME_1501499_DEF_STYLE": "PARAMETERIZED", + "FRAME_1500499_CLASS_ID": 1500499.0, + "FRAME_1500499_PRI_FRAME": "IAU_MARS", + "BODY499_GM": 42828.314, + "FRAME_1502499_PRI_AXIS": "X", + "FRAME_1502499_SEC_OBSERVER": "MARS", + "FRAME_1502499_NAME": "MSO", + "FRAME_1501499_AXES": [3.0, 1.0, 3.0], + "FRAME_1500499_SEC_AXIS": "Y" + }, + "detector_sample_summing": 0, + "detector_line_summing": 0, + "focal_length_model": {"focal_length": 874.9}, + "detector_center": {"line": 1024.5, "sample": 1024.5}, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "focal2pixel_lines": [0.0, 0.0, 100.0], + "focal2pixel_samples": [0.0, 100.0, 0.0], + "optical_distortion": {"radial": {"coefficients": [0.0, 0.0, 0.0]}}, + "image_lines": 256, + "image_samples": 2048, + "name_platform": "TRACE GAS ORBITER", + "name_sensor": "TRACE GAS ORBITER", + "reference_height": {"maxheight": 1000, "minheight": -1000, "unit": "m"}, + "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL", + "center_ephemeris_time": 533471602.76595086, + "radii": {"semimajor": 3396.19, "semiminor": 3376.2, "unit": "km"}, + "instrument_pointing": { + "time_dependent_frames": [-143410, -143400, -143000, 1], + "constant_frames" : [-143420, -143410], + "ck_table_start_time": 533471602.76595, + "ck_table_end_time": 533471602.76595, + "ck_table_original_size": 1, + "ephemeris_times": [533471602.76595], + "quaternions": [ + [-0.38852078202718, + -0.53534661398878, + -0.74986993015978, + 0.012275694110544 + ] + ], + "angular_velocities": [ + [-5.18973909108511e-04, + -2.78782123621868e-04, + 2.84462861654798e-04 + ] + ], + "reference_frame": 1, + "constant_rotation": [ + 0.0021039880161896, + -5.08910327554815e-04, + 0.99999765711961, + 0.98482103650022, + 0.17356149021485, + -0.0019837290716917, + -0.17356007404082, + 0.98482290292452, + 8.66356891752243e-04 + ] + }, + "body_rotation": { + "time_dependent_frames": [10014, 1], + "ck_table_start_time": 533471602.76595, + "ck_table_end_time": 533471602.76595, + "ck_table_original_size": 1, + "ephemeris_times": [533471602.76595], + "quaternions": [ + [-0.84364286886959, + 0.083472339272581, + 0.30718999789287, + -0.43235793455935 + ] + ], + "angular_velocities": [ + [3.16231952619494e-05, + -2.8811745785852e-05, + 5.6516725802331e-05 + ] + ], + "reference_frame": 1 + }, + "instrument_position": { + "spk_table_start_time": 533471602.76595, + "spk_table_end_time": 533471602.76595, + "spk_table_original_size": 1, + "ephemeris_times": [533471602.76595], + "positions": [ + [-2707.0266303122, + 2307.373459613, + 2074.8887762465] + ], + "velocities": [ + [-1.6101681507607, + -4.1440662687653, + -0.48379032129765 + ] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 533471602.76595, + "spk_table_end_time": 533471602.76595, + "spk_table_original_size": 1, + "ephemeris_times": [533471602.76595], + "positions": [ + [-206349081.4204, + 17157784.002827, + 13440194.20453 + ] + ], + "velocities": [ + [-3.3908615862221, + -23.832213042409, + -10.839726759899 + ] + ], + "reference_frame": 1 + } +} diff --git a/tests/pytests/data/isds/hayabusa2_isd.json b/tests/pytests/data/isds/hayabusa2_isd.json new file mode 100644 index 000000000..55c6402aa --- /dev/null +++ b/tests/pytests/data/isds/hayabusa2_isd.json @@ -0,0 +1,184 @@ +{ + "isis_camera_version": 1, + "naif_keywords": { + "BODY399_RADII": [ + 6378.1366, + 6378.1366, + 6356.7519 + ], + "BODY_FRAME_CODE": 10013, + "BODY_CODE": 399, + "INS-37120_BORESIGHT_SAMPLE": 512.5, + "INS-37120_FOCAL_LENGTH": 10.44, + "INS-37120_FOV_CROSS_ANGLE": 32.62, + "FRAME_-37120_CLASS_ID": -37120.0, + "INS-37120_OD_K": [ + 1.014, + 2.9329999999999996e-07, + -1.3839999999999997e-13 + ], + "INS-37120_FOV_REF_ANGLE": 32.62, + "INS-37120_BORESIGHT": [ + 0.0, + 0.0, + 10.44 + ], + "INS-37120_FILTER_BANDWIDTH": 170.0, + "INS-37120_PIXEL_LINES": 1024.0, + "FRAME_-37120_CLASS": 4.0, + "TKFRAME_-37120_RELATIVE": "HAYABUSA2_SC_BUS_PRIME", + "TKFRAME_-37120_ANGLES": [ + -270.0, + -121.0, + 0.0 + ], + "INS-37120_FOV_SHAPE": "RECTANGLE", + "FRAME_-37120_CENTER": -37.0, + "INS-37120_IFOV": 0.00124521, + "INS-37120_FILTER_TRANSMITTANCE": 0.25, + "INS-37120_FOV_FRAME": "HAYABUSA2_ONC-W2", + "INS-37120_ITRANSL": [ + 0.0, + 0.0, + 76.923076923077 + ], + "INS-37120_ITRANSS": [ + 0.0, + 76.923076923077, + 0.0 + ], + "INS-37120_TRANSX": [ + 0.0, + 0.013, + 0.0 + ], + "TKFRAME_-37120_UNITS": "DEGREES", + "INS-37120_TRANSY": [ + 0.0, + 0.0, + 0.013 + ], + "INS-37120_PIXEL_SAMPLES": 1024.0, + "INS-37120_FOV_CLASS_SPEC": "ANGLES", + "INS-37120_FOV_REF_VECTOR": [ + 0.0, + 1.0, + 0.0 + ], + "INS-37120_PIXEL_PITCH": 0.013, + "INS-37120_PIXEL_SIZE": [ + 0.013, + 0.013 + ], + "FRAME_-37120_NAME": "HAYABUSA2_ONC-W2", + "INS-37120_FOV_ANGLE_UNITS": "DEGREES", + "TKFRAME_-37120_AXES": [ + 3.0, + 2.0, + 1.0 + ], + "TKFRAME_-37120_SPEC": "ANGLES", + "INS-37120_BORESIGHT_LINE": 512.5, + "INS-37120_FILTER_QE": 0.7, + "INS-37120_FILTER_BANDCENTER": 570.0, + "INS-37120_CCD_CENTER": [ + 512.5, + 512.5 + ], + "INS-37120_F/RATIO": 9.6, + "BODY399_N_GEOMAG_CTR_DIPOLE_LAT": 80.13, + "BODY399_POLE_RA": [ + 0.0, + -0.641, + 0.0 + ], + "BODY399_POLE_DEC": [ + 90.0, + -0.557, + 0.0 + ], + "BODY399_N_GEOMAG_CTR_DIPOLE_LON": 287.62, + "BODY399_LONG_AXIS": 0.0, + "BODY399_PM": [ + 190.147, + 360.9856235, + 0.0 + ] + }, + "detector_sample_summing": 1, + "detector_line_summing": 1, + "focal_length_model": {"focal_length": 10.44}, + "detector_center": {"line": 512.5, "sample": 512.5}, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "focal2pixel_lines": [0.0, 0.0, 76.923076923077], + "focal2pixel_samples": [0.0, 76.923076923077, 0.0], + "optical_distortion": {"radial": {"coefficients": [0.0, 0.0, 0.0]}}, + "image_lines": 1024, + "image_samples": 1024, + "name_platform": "HAYABUSA-2", + "name_sensor": "Optical Navigation Camera", + "reference_height": {"maxheight": 1000, "minheight": -1000, "unit": "m"}, + "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL", + "center_ephemeris_time": 502404366.34876287, + "radii": {"semimajor": 6378.1366, "semiminor": 6356.7519, "unit": "km"}, + "instrument_pointing": { + "time_dependent_frames": [-37000, 1], + "constant_frames": [-37120, -37000], + "constant_rotation": [ + 9.46109594816419e-17, 0.51503807491005, -0.85716730070211, + 1.0, -1.83697019872103e-16, 0.0, + -1.57459078670793e-16, -0.85716730070211, -0.51503807491005], + "ck_table_start_time": 502404366.34876, + "ck_table_end_time": 502404366.34876, + "ck_table_original_size": 1, + "ephemeris_times": [502404366.34876287], + "quaternions": [ + [-0.5013652613006103, 0.83203136256, 0.04949957619999998, -0.2321776872] + ], + "angular_velocities" : [ + [-3.3566444941696236e-05, 3.30201152018665e-05, 2.987092640139532e-06] + ], + "reference_frame": 1 + }, + "body_rotation": { + "time_dependent_frames": [10013, 1], + "ck_table_start_time": 502404366.34876, + "ck_table_end_time": 502404366.34876, + "ck_table_original_size": 1, + "ephemeris_times": [502404366.34876287], + "quaternions": [ + [-0.1979938370409085, -0.0007582477662989689, 0.00015456662316054356, -0.9802029594238645] + ], + "angular_velocities" : [ + [1.128586084254313e-07, -1.9793051740218293e-10, 7.292106285199177e-05] + ], + "reference_frame": 1 + }, + "instrument_position": { + "spk_table_start_time": 502404366.34876, + "spk_table_end_time": 502404366.34876, + "spk_table_original_size": 1, + "ephemeris_times": [502404366.34876287], + "positions": [ + [30.15558294075686, -21415.864299596455, 29138.041066520385] + ], + "velocities": [ + [1.5409457644671734, 5.3312261011154565, -3.5389092329306164] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 502404366.34876, + "spk_table_end_time": 502404366.34876, + "spk_table_original_size": 1, + "ephemeris_times": [502404366.34876287], + "positions": [ + [-48916727.046504386, -127647230.31032252, -55336271.675298646] + ], + "velocities": [ + [28.58340952406857, -8.972886737522412, -3.888902421092297] + ], + "reference_frame": 1 + } +} diff --git a/tests/pytests/data/isds/juno_isd.json b/tests/pytests/data/isds/juno_isd.json new file mode 100644 index 000000000..db328e373 --- /dev/null +++ b/tests/pytests/data/isds/juno_isd.json @@ -0,0 +1,175 @@ +{ + "isis_camera_version": 1, + "naif_keywords": {"BODY599_RADII": [71492.0, 71492.0, 66854.0], + "BODY_FRAME_CODE": 10015, + "BODY_CODE": 599, + "INS-61500_ITRANSS": [0.0, 135.1351, 0.0], + "INS-61500_DISTORTION_K1": -5.962420945566733e-08, + "INS-61500_DISTORTION_K2": 2.738191004225615e-14, + "FRAME_-61500_CLASS_ID": -61500.0, + "INS-61500_BORESIGHT": [0.0, 0.0, 1.0], + "TKFRAME_-61500_RELATIVE": "JUNO_JUNOCAM_CUBE", + "INS-61500_BORESIGHT_SAMPLE": 814.21, + "INS-61500_FOV_SHAPE": "POLYGON", + "INS-61500_FILTER_OFFSET": 1.0, + "INS-61500_SWAP_OBSERVER_TARGET": "TRUE", + "INS-61500_LIGHTTIME_CORRECTION": "NONE", + "INS-61500_FOV_BOUNDARY_CORNERS": [-0.47351727, -0.18862601, 0.86034971, -0.47852984, -0.11376363, + 0.87067045, -0.47934991, -0.09577177, 0.87238262, -0.48125208], + "INS-61500_PIXEL_PITCH": 0.0074, + "INS-61500_FOV_FRAME": "JUNO_JUNOCAM", + "TKFRAME_-61500_ANGLES": [0.69 , -0.469, 0.583], + "FRAME_-61500_CENTER": -61.0, + "FRAME_-61500_CLASS": 4.0, + "FRAME_-61500_NAME": "JUNO_JUNOCAM", + "INS-61500_LT_SURFACE_CORRECT": "FALSE", + "TKFRAME_-61500_AXES": [3.0, 2.0, 1.0], + "INS-61500_PIXEL_SIZE": 0.0074, + "TKFRAME_-61500_SPEC": "ANGLES", + "INS-61500_DISTORTION_X": 814.21, + "INS-61500_DISTORTION_Y": 78.48, + "INS-61500_BORESIGHT_LINE": 600.0, + "INS-61500_FILTER_LINES": 1200.0, + "INS-61500_INTERFRAME_DELTA": 0.001, + "INS-61500_FILTER_NAME": "FULLCCD", + "INS-61500_TRANSX": [0.0, 0.0074, 0.0], + "INS-61500_TRANSY": [0.0, 0.0, 0.0074], + "TKFRAME_-61500_UNITS": "DEGREES", + "INS-61500_ITRANSL": [0.0, 0.0, 135.1351], + "INS-61500_START_TIME_BIAS": 0.06188, + "INS-61500_FOCAL_LENGTH": 10.95637, + "INS-61500_FILTER_SAMPLES": 1648.0, + "BODY599_PM": [284.95, 870.536, 0.0], + "BODY599_LONG_AXIS": 0.0, + "BODY599_NUT_PREC_DEC": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + "BODY599_NUT_PREC_PM": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + "BODY599_POLE_RA": [ 2.68056595e+02, -6.49900000e-03, 0.00000000e+00], + "BODY599_POLE_DEC": [6.4495303e+01, 2.4130000e-03, 0.0000000e+00], + "BODY599_NUT_PREC_RA": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + "INS-61504_DISTORTION_K1": -5.962420945566733e-08, + "INS-61504_DISTORTION_K2": 2.738191004225615e-14, + "INS-61504_START_TIME_BIAS": 0.06188, + "INS-61504_FOV_FRAME": "JUNO_JUNOCAM", + "INS-61504_FILTER_OFFSET": 284.52, + "INS-61504_FILTER_NAME": "METHANE", + "INS-61504_FOV_BOUNDARY_CORNERS": [-0.47351727, -0.18862601, 0.86034971, -0.47852984, -0.11376363, + 0.87067045, 0.49067337, -0.11299511, 0.86398596, 0.48553839], + "INS-61504_INTERFRAME_DELTA": 0.001, + "INS-61504_FILTER_SAMPLES": 1648.0, + "INS-61504_DISTORTION_X": 814.21, + "INS-61504_DISTORTION_Y": 315.48, + "INS-61504_PIXEL_SIZE": 0.0074, + "INS-61504_FILTER_LINES": 128.0, + "INS-61504_BORESIGHT": [ 0.00854687, -0.16805056, 0.98574133], + "INS-61504_FOCAL_LENGTH": 10.95637, + "INS-61504_FOV_SHAPE": "RECTANGLE" + }, + "detector_sample_summing": 1, + "detector_line_summing": 1, + "focal_length_model": { + "focal_length": 10.95637 + }, + "detector_center": { + "line": 600.0, + "sample": 814.21 + }, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "focal2pixel_lines": [ + 0.0, + 0.0, + 135.1351 + ], + "focal2pixel_samples": [ + 0.0, + 135.1351, + 0.0 + ], + "optical_distortion": { + "radial": { + "coefficients": [ + 0.0, + 0.0, + 0.0 + ] + } + }, + "image_lines": 128, + "image_samples": 1648, + "name_platform": "JUNO", + "name_sensor": "JUNO EPO CAMERA", + "reference_height": { + "maxheight": 1000, + "minheight": -1000, + "unit": "m" + }, + "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL", + "center_ephemeris_time": 525560475.1286545, + "radii": { + "semimajor": 71492.0, + "semiminor": 66854.0, + "unit": "km" + }, + "instrument_pointing": { + "time_dependent_frames": [-61000, 1], + "ck_table_start_time": 525560475.1286545, + "ck_table_end_time": 525560475.1286545, + "ck_table_original_size": 1, + "ephemeris_times": [5.25560475e+08], + "quaternions": [ + [-0.42623555, -0.55051779, 0.46456631, -0.5472034 ] + ], + "angular_velocities": [ + [ 0.204182 , -0.00811453, -0.00786116] + ], + "constant_frames": [-61500, -61505, -61000], + "constant_rotation": + [0.0022409695777088, -0.002220557600931, + -0.99999502357726, 0.012486301868467, + -0.99991951530675, 0.0022483714915059, + -0.99991953192294, -0.012491278263463, + -0.0022130626614382 + ], + "reference_frame": 1 + }, + "body_rotation": { + "time_dependent_frames": [10015, 1], + "ck_table_start_time": 525560475.1286545, + "ck_table_end_time": 525560475.1286545, + "ck_table_original_size": 1, + "ephemeris_times": [5.25560475e+08], + "quaternions": [ + [-0.89966963, 0.20059167, -0.09209383, 0.37666467] + ], + "angular_velocities": [ + [-2.56683271e-06, -7.56713067e-05, 1.58718697e-04] + ], + "reference_frame": 1 + }, + "instrument_position": { + "spk_table_start_time": 525560475.1286545, + "spk_table_end_time": 525560475.1286545, + "spk_table_original_size": 1, + "ephemeris_times": [525560475.1286545], + "positions": [ + [-7197.04131196, -382913.71404775, 145608.88474678] + ], + "velocities": [ + [0.39087306, 24.13639337, 2.15702628] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 525560475.0262545, + "spk_table_end_time": 525560475.0262545, + "spk_table_original_size": 1, + "ephemeris_times": [5.25560475e+08], + "positions": [ + [814823700.57661,22018509.45354,-10399060.67075] + ], + "velocities": [ + [-0.10070347311145,11.449085311077,4.9098525890309] + ], + "reference_frame": 1 + } +} diff --git a/tests/pytests/data/isds/newhorizons_isd.json b/tests/pytests/data/isds/newhorizons_isd.json new file mode 100644 index 000000000..19f94d7f4 --- /dev/null +++ b/tests/pytests/data/isds/newhorizons_isd.json @@ -0,0 +1,220 @@ +{ + "isis_camera_version": 2, + "naif_keywords": { + "BODY501_RADII": [1829.4, 1819.4, 1815.7], + "BODY_FRAME_CODE": 10023, + "BODY_CODE": 501, + "INS-98301_SIP_B_1_1": 3.7063022991452e-07, + "INS-98301_SIP_B_1_2": 3.6773991492864e-13, + "INS-98301_SIP_A_2_0": 3.7132883452972e-07, + "INS-98301_SIP_A_2_1": 3.6773993329229e-13, + "INS-98301_FOCAL_LENGTH_UNITS": "mm", + "INS-98301_OOC_KMAT": + [76.94085558205741, + 0.0, + 0.0, + 76.94085558205741], + "INS-98301_SIP_BP_0_2": -2.4738992578302e-07, + "INS-98301_SIP_BP_0_3": 4.5900372459772e-09, + "INS-98301_SIP_B_2_0": -2.5764535470748e-10, + "INS-98301_SIP_B_2_1": -4.550504716094301e-09, + "INS-98301_BORESIGHT": [0.0, 0.0, -1.0], + "INS-98301_SIP_A_3_0": -4.5683524653106e-09, + "INS-98301_SIP_BP_1_1": -3.7439988768003e-07, + "INS-98301_REFERENCE_VECTOR": [1.0, 0.0, 0.0], + "INS-98301_SIP_B_ORDER": 3.0, + "INS-98301_OOC_EM_SIGMA": [1.6e-07, 8.3e-07, 8e-07], + "INS-98301_SIP_B_3_0": -4.8263374371619e-16, + "INS-98301_APERTURE_DIAM_UNITS": "mm", + "FRAME_-98301_NAME": "NH_LORRI_1X1", + "INS-98301_SIP_BP_2_1": 4.5900372459772e-09, + "INS-98301_SIP_AP_ORDER": 3.0, + "INS-98301_FOV_REF_ANGLE": 0.14560853, + "INS-98301_APERTURE_DIAMETER": 208.0, + "INS-98301_FOV_SHAPE": "RECTANGLE", + "TKFRAME_-98301_SPEC": "MATRIX", + "FRAME_-98301_CLASS_ID": -98301.0, + "INS-98301_OOC_FOCAL_LENGTH_SIGMA": 0.02, + "INS-98301_ITRANSL": [ + 0.0, + 0.0, + 76.923076923077 + ], + "INS-98301_ITRANSS": [ + 0.0, + 76.923076923077, + 0.0 + ], + "INS-98301_SIP_AP_1_1": -2.4738992578302e-07, + "INS-98301_SIP_AP_1_2": 4.5900372459772e-09, + "INS-98301_FOV_CLASS_SPEC": "ANGLES", + "INS-98301_PIXEL_LINES": 1024.0, + "INS-98301_SIP_AP_2_0": -3.7439988768003e-07, + "INS-98301_SIP_A_ORDER": 3.0, + "FRAME_-98301_CENTER": -98.0, + "INS-98301_FOV_REF_VECTOR": [ + 1.0, + 0.0, + 0.0 + ], + "TKFRAME_-98301_RELATIVE": "NH_LORRI", + "INS-98301_SIP_BP_ORDER": 3.0, + "INS-98301_FOV_FRAME": "NH_LORRI_1X1", + "INS-98301_FOV_ANGLE_UNITS": "DEGREES", + "INS-98301_SIP_AP_3_0": 4.5900372459772e-09, + "INS-98301_PLATFORM_ID": -98000.0, + "TKFRAME_-98301_MATRIX": [ + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0 + ], + "FRAME_-98301_CLASS": 4.0, + "INS-98301_PIXEL_SIZE": 12.997, + "INS-98301_FOCAL_LENGTH": 2618.4775964615383, + "INS-98301_F/NUMBER": 12.59, + "INS-98301_OOC_FOCAL_LENGTH": 2618.4775964615383, + "INS-98301_TRANSX": [ + 0.0, + 0.013, + 0.0 + ], + "INS-98301_TRANSY": [ + 0.0, + 0.0, + 0.013 + ], + "INS-98301_PIXEL_SAMPLES": 1024.0, + "INS-98301_FOV_CROSS_ANGLE": 0.14560853, + "INS-98301_SIP_A_0_2": -3.8995992016686996e-10, + "INS-98301_SIP_A_0_3": -4.826382722745001e-16, + "INS-98301_OOC_CCD_CENTER": [511.5, 511.5], + "INS-98301_IFOV": 4.963571, + "INS-98301_CCD_CENTER": [511.5, 511.5], + "INS-98301_SIP_B_0_2": 2.4536068067188e-07, + "INS-98301_SIP_B_0_3": -4.5685088916275e-09, + "INS-98301_SIP_A_1_1": 2.4489911491959e-07, + "INS-98301_SIP_A_1_2": -4.550660817442101e-09, + "INS-98301_OOC_EM": [ + 2.7172539725122488e-05, + -1.9034392552127412e-05, + -2.8806647687927977e-05 + ], + "BODY501_NUT_PREC_RA": [ + 0.0, + 0.0, + 0.094, + 0.024 + ], + "BODY501_LONG_AXIS": 0.0, + "BODY501_POLE_DEC": [64.5, 0.003, 0.0], + "BODY501_PM": [200.39, 203.4889538, 0.0], + "BODY501_NUT_PREC_PM": [0.0, 0.0, -0.085, -0.022], + "BODY501_NUT_PREC_DEC": [ + 0.0, + 0.0, + 0.04, + 0.011 + ], + "BODY501_POLE_RA": [268.05, -0.009, 0.0] + }, + "detector_sample_summing": 1, + "detector_line_summing": 1, + "focal_length_model": {"focal_length": 2618.4775964615383}, + "detector_center": {"line": 0.0, "sample": 0.0}, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "focal2pixel_lines": [0.0, 0.0, 76.923076923077], + "focal2pixel_samples": [0.0, 76.923076923077, 0.0], + "optical_distortion": {"radial": {"coefficients": [0.0, 0.0, 0.0]}}, + "image_lines": 1024, + "image_samples": 1024, + "name_platform": "NEW HORIZONS", + "name_sensor": "NEW HORIZONS", + "reference_height": {"maxheight": 1000, "minheight": -1000, "unit": "m"}, + "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL", + "center_ephemeris_time": 225940527.51631695, + "radii": { + "semimajor": 1829.4, "semiminor": 1815.7, "unit": "km" + }, + "instrument_pointing": { + "time_dependent_frames": [-98000, 1], + "ck_table_start_time": 225940527.51631695, + "ck_table_end_time": 225940527.51631695, + "ck_table_original_size": 1, + "ephemeris_times": [225940527.51631695], + "quaternions": [ + [-0.040223695171375, + 0.062038072129285, + 0.97695635330468, + 0.20022391388359] + ], + "angular_velocities": [ + [1.39581813997533e-05, + -1.15948738928358e-05, + 2.21456402487273e-05] + ], + "reference_frame": 1, + "constant_frames": [-98301, -98300, -98000], + "constant_rotation": + [-0.005452680629036, + -0.99996036726125, + 0.007037910250677, + 0.002999533810427, + -0.0070543385533461, + -0.99997061912063, + 0.99998063534794, + -0.0054314099747325, + 0.0030378799858676] + }, + "body_rotation": { + "time_dependent_frames": [10023, 1], + "ck_table_start_time": 225940527.51631695, + "ck_table_end_time": 225940527.51631695, + "ck_table_original_size": 1, + "ephemeris_times": [225940527.51631695], + "quaternions": [ + [-0.57817095054415, + 0.13699803004374, + 0.1729987472005, + -0.78550704973162] + ], + "angular_velocities": [ + [-6.24011073378906e-07, + -1.76837707421929e-05, + 3.7102455825449e-05] + ], + "reference_frame": 1 + }, + "instrument_position": { + "spk_table_start_time": 225940527.51631695, + "spk_table_end_time": 225940527.51631695, + "spk_table_original_size": 1, + "ephemeris_times": [225940527.51631695], + "positions": [ + [-2390849.002579,321807.33761069,-141054.73789822] + ], + "velocities": [ + [6.3943726561674,-22.16679208555,-8.6097977343012] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 225940527.51631695, + "spk_table_end_time": 225940527.51631695, + "spk_table_original_size": 1, + "ephemeris_times": [225940527.51631695], + "positions": [ + [311036228.79889,679984041.50957,283865335.82619] + ], + "velocities": [ + [4.7547216698047,-0.80026582585286,-0.11480667580455] + ], + "reference_frame": 1 + } +} diff --git a/tests/pytests/data/isds/themisir_isd.json b/tests/pytests/data/isds/themisir_isd.json new file mode 100644 index 000000000..75b3490d8 --- /dev/null +++ b/tests/pytests/data/isds/themisir_isd.json @@ -0,0 +1,165 @@ +{ + "isis_camera_version": 1, + "naif_keywords": { + "BODY499_RADII": [ 3396.19, 3396.19, 3376.2 ], + "BODY_FRAME_CODE": 10014, + "BODY_CODE": 499, + "TKFRAME_-53031_RELATIVE": "M01_THEMIS_OPTICS", + "TKFRAME_-53031_UNITS": "DEGREES", + "INS-53031_CK_FRAME_ID": -53000, + "INS-53031_CK_TIME_BIAS": 0, + "INS-53031_ITRANSL": [ 0, 0, 20 ], + "INS-53031_ITRANSS": [ 0, 20, 0 ], + "TKFRAME_-53031_ANGLES": [ -0.1701, 90.05331, -0.6315 ], + "INS-53031_CK_TIME_TOLERANCE": 1, + "FRAME_-53031_CENTER": -53, + "FRAME_-53031_NAME": "M01_THEMIS_IR", + "TKFRAME_-53031_AXES": [ 3, 2, 3 ], + "TKFRAME_-53031_SPEC": "ANGLES", + "INS-53031_TRANSX": [ 0, 0.05, 0 ], + "INS-53031_TRANSY": [ 0, 0, 0.05 ], + "INS-53031_PLATFORM_ID": -53000, + "FRAME_-53031_CLASS_ID": -53031, + "INS-53031_CK_REFERENCE_ID": 16, + "FRAME_-53031_CLASS": 4, + "INS-53031_SPK_TIME_BIAS": 0, + "BODY499_POLE_DEC": [ 52.8865, -0.0609, 0 ], + "BODY499_POLE_RA": [ 317.68143, -0.1061, 0 ], + "BODY499_PM": [ 176.63, 350.89198226, 0 ] + }, + "detector_sample_summing": 1, + "detector_line_summing": 1, + "focal_length_model": { + "focal_length": 202.059 + }, + "detector_center": { + "line": 0, + "sample": 0 + }, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "focal2pixel_lines": [ + 0.0, + 0.0, + 20.0 + ], + "focal2pixel_samples": [ + 0.0, + 20.0, + 0.0 + ], + "optical_distortion": { + "radial": { + "coefficients": [ + 0.0, + 0.0, + 0.0 + ] + } + }, + "image_lines": 272, + "image_samples": 320, + "name_platform": "MARS_ODYSSEY", + "name_sensor": "MARS_ODYSSEY", + "reference_height": { + "maxheight": 1000, + "minheight": -1000, + "unit": "m" + }, + "name_model": "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL", + "interpolation_method": "lagrange", + "line_scan_rate": [ + [ + 0.5, + -4.5270456075668335, + 0.0332871 + ] + ], + "starting_ephemeris_time": 589445676.9899044, + "center_ephemeris_time": 589445681.51695, + "radii": { + "semimajor": 3396.19, + "semiminor": 3376.2, + "unit": "km" + }, + "instrument_pointing": { + "time_dependent_frames": [ -53000, 16, 1 ], + "ck_table_start_time": 589445676.9899044, + "ck_table_end_time": 589445686.0439956, + "ck_table_original_size": 4, + "ephemeris_times": [ 589445676.9899044, 589445680.0079348, 589445683.0259652, 589445686.0439956 ], + "quaternions": [ + [ 0.38598147685908185, -0.5607948046031743, -0.6866376818635513, -0.2550611309016295 ], + [ 0.38562579307122824, -0.5617138648879078, -0.6858904675855092, -0.25558667450829115 ], + [ 0.38527060742872654, -0.5626353429020607, -0.6851390429149169, -0.25611037043160223 ], + [ 0.3849151928868023, -0.563557151464003, -0.6843852032119891, -0.25663305504782297 ] + ], + "angular_velocities": [ + [ 0.0007324350225698707, -0.00006952577687208014, -0.0005029467858822215 ], + [ 0.0007335508142603166, -0.0000691981129943357, -0.0005044432717278556 ], + [ 0.0007368387903980461, -0.0000332990142650248, -0.0004221206727530788 ], + [ 0.0007393253232865181, -0.0000072290602625411406, -0.0003625424840601517 ] + ], + "constant_frames": [ -53031, -53030, -53000 ], + "constant_rotation": [ + 0.0013835021734054376, + 0.01152997618685378, + 0.9999325705120657, + 0.2881133069543266, + 0.9575279926584919, + -0.011439651709813592, + -0.957595325948064, + 0.288109706404575, + -0.0019971975093594496 + ], + "reference_frame": 1 + }, + "body_rotation": { + "time_dependent_frames": [ 10014, 1 ], + "ck_table_start_time": 589445676.9899044, + "ck_table_end_time": 589445686.0439956, + "ck_table_original_size": 4, + "ephemeris_times": [ 589445676.9899044, 589445680.0079348, 589445683.0259652, 589445686.0439956 ], + "quaternions": [ + [ -0.5408451126894908, 0.31557698159693326, -0.04183520300757272, 0.7785547819873538 ], + [ -0.5407618335951139, 0.3155725050030793, -0.041868957604701294, 0.7786126275639432 ], + [ -0.5406785483110855, 0.3155680247986294, -0.04190271172395818, 0.7786704642344462 ], + [ -0.5405952568468566, 0.31556354098409234, -0.04193646536151294, 0.7787282919923001 ] + ], + "angular_velocities": [ + [ 0.00003162303650185794, -0.000028813502069024346, 0.00005651591926299394 ], + [ 0.000031623036501849386, -0.000028813502069119034, 0.00005651591926295044 ], + [ 0.00003162303650184082, -0.000028813502069213752, 0.000056515919262906996 ], + [ 0.00003162303650183226, -0.000028813502069308437, 0.000056515919262863486 ] + ], + "reference_frame": 1 + }, + "instrument_position": { + "spk_table_start_time": 589445676.9899044, + "spk_table_end_time": 589445686.0439956, + "spk_table_original_size": 4, + "ephemeris_times": [ 589445676.9899044, 589445680.0079348, 589445683.0259652, 589445686.0439956 ], + "positions": [ + [ -883.3647639832787, 3235.9253823963995, -1734.2678063014955 ], + [ -878.0820172062348, 3241.143181714679, -1727.2955108387216 ], + [ -872.7929026970128, 3246.3375924365314, -1720.3106940936013 ], + [ -867.4974605099152, 3251.5085747718745, -1713.3134080300226 ] + ], + "velocities": [ + [ 1.7493370110442228, 1.7327474299014805, 2.308134335038546 ], + [ 1.7514526413807416, 1.7250030655476496, 2.312291077819496 ], + [ 1.7535556099591456, 1.7172463879119024, 2.316431067882768 ], + [ 1.7556459015231667, 1.7094774543366804, 2.3205542750988553 ] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 589445681.51695, + "spk_table_end_time": 589445681.51695, + "spk_table_original_size": 1, + "ephemeris_times": [ 589445681.51695 ], + "positions": [ [ -177834612.75017235, 94014077.38389017, 47921572.85876171 ] ], + "velocities": [ [ -13.267042406345718, -20.96669045246765, -9.258799613448325 ] ], + "reference_frame": 1 + } +} diff --git a/tests/pytests/data/isds/themisvis_isd.json b/tests/pytests/data/isds/themisvis_isd.json new file mode 100644 index 000000000..8b50140d9 --- /dev/null +++ b/tests/pytests/data/isds/themisvis_isd.json @@ -0,0 +1,190 @@ +{ + "isis_camera_version": 1, + "naif_keywords": { + "BODY499_RADII": [ 3396.19, 3396.19, 3376.2 ], + "BODY_FRAME_CODE": 10014, + "BODY_CODE": 499, + "INS-53032_TRANSX": [ 0, 0.009, 0 ], + "INS-53032_TRANSY": [ 0, 0, -0.009 ], + "FRAME_-53032_CLASS_ID": -53032, + "INS-53032_CK_TIME_BIAS": 0, + "INS-53032_CK_FRAME_ID": -53000, + "TKFRAME_-53032_RELATIVE": "M01_THEMIS_OPTICS", + "FRAME_-53032_NAME": "M01_THEMIS_VIS", + "TKFRAME_-53032_AXES": [ 1, 2, 3 ], + "TKFRAME_-53032_SPEC": "ANGLES", + "INS-53032_CK_TIME_TOLERANCE": 1, + "FRAME_-53032_CLASS": 4, + "INS-53032_PLATFORM_ID": -53000, + "INS-53032_ITRANSL": [ 0, 0, -111.11111111 ], + "INS-53032_SPK_TIME_BIAS": 0, + "INS-53032_ITRANSS": [ 0, 111.11111111, 0 ], + "TKFRAME_-53032_ANGLES": [ 0, 90, -0.25 ], + "FRAME_-53032_CENTER": -53, + "INS-53032_CK_REFERENCE_ID": 16, + "TKFRAME_-53032_UNITS": "DEGREES", + "BODY499_POLE_DEC": [ 52.8865, -0.0609, 0 ], + "BODY499_POLE_RA": [ 317.68143, -0.1061, 0 ], + "BODY499_PM": [ 176.63, 350.89198226, 0 ] + }, + "detector_sample_summing": 1, + "detector_line_summing": 1, + "focal_length_model": { + "focal_length": 202.059 + }, + "detector_center": { + "line": 0, + "sample": 0 + }, + "starting_detector_line": 0, + "starting_detector_sample": 0, + "focal2pixel_lines": [ + 0.0, + 0.0, + -111.11111111 + ], + "focal2pixel_samples": [ + 0.0, + 111.11111111, + 0.0 + ], + "optical_distortion": { + "radial": { + "coefficients": [0.0, 0.0, 0.0] + } + }, + "image_lines": 400, + "image_samples": 1024, + "name_platform": "MARS_ODYSSEY", + "name_sensor": "MARS_ODYSSEY", + "reference_height": { + "maxheight": 1000, + "minheight": -1000, + "unit": "m" + }, + "name_model": "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL", + "interpolation_method": "lagrange", + "line_scan_rate": [ + [0.5, -0.9599999785423279, 0.0048] + ], + "starting_ephemeris_time": 392211095.6197291, + "center_ephemeris_time": 392211096.5797291, + "radii": { + "semimajor": 3396.19, + "semiminor": 3376.2, + "unit": "km" + }, + "instrument_pointing": { + "time_dependent_frames": [ -53000, 16, 1 ], + "ck_table_start_time": 392211095.6197291, + "ck_table_end_time": 392211097.5397291, + "ck_table_original_size": 6, + "ephemeris_times": [ + 392211095.6197291, + 392211096.0037291, + 392211096.3877291, + 392211096.7717291, + 392211097.1557291, + 392211097.5397291 + ], + "quaternions": [ + [ 0.622044822044232, 0.2555212953329484, 0.5142689567685136, -0.5322560916547194 ], + [ 0.6219555566538323, 0.2556095368638264, 0.5142243466922363, -0.532361128821991 ], + [ 0.6218662733649556, 0.25569777103883873, 0.5141797218177431, -0.532466150669111 ], + [ 0.6217764034754604, 0.25578530978663744, 0.514134694883009, -0.5325725254798925 ], + [ 0.6216862534405807, 0.25587252406502475, 0.5140894745361436, -0.5326795151709507 ], + [ 0.6215960852368998, 0.2559597308655292, 0.5140442391649964, -0.5327864892944326 ] + ], + "angular_velocities": [ + [ -0.0008105492062180801, -0.00019831431313117837, 0.0002945565809147707 ], + [ -0.0008108026806805358, -0.0001980750326173721, 0.00029502731883054514 ], + [ -0.0008114627704207764, -0.00019745190628475147, 0.0002962531988088855 ], + [ -0.0008119328383766381, -0.00019701160233906684, 0.0002972128619119053 ], + [ -0.0008120105314920341, -0.0001969488072413385, 0.00029762281538913397 ], + [ -0.0008119477826533893, -0.00019702113314222383, 0.0002978360123824115 ] + ], + "constant_frames": [ -53032, -53030, -53000 ], + "constant_rotation": [ + 0.0003684744441107557, + 0.004882317815721682, + 0.9999880135278275, + 0.29095386119307015, + 0.9567251530513545, + -0.004778302596747774, + -0.9567370144838278, + 0.2909521343651026, + -0.0010680004511185448 + ], + "reference_frame": 1 + }, + "body_rotation": { + "time_dependent_frames": [ 10014, 1 ], + "ck_table_start_time": 392211095.6197291, + "ck_table_end_time": 392211097.5397291, + "ck_table_original_size": 6, + "ephemeris_times": [ + 392211095.6197291, + 392211096.0037291, + 392211096.3877291, + 392211096.7717291, + 392211097.1557291, + 392211097.5397291 + ], + "quaternions": [ + [ -0.6613202993937386, 0.31813079098385316, 0.010572073619126085, 0.6792175591790568 ], + [ -0.661311055603654, 0.31813093483380667, 0.0105677440557396, 0.6792265592743864 ], + [ -0.6613018116910848, 0.31813107862483736, 0.010563414490395608, 0.6792355592439125 ], + [ -0.6612925676560322, 0.3181312223569454, 0.010559084923095426, 0.6792445590876345 ], + [ -0.6612833234984982, 0.31813136603013065, 0.01055475535383936, 0.6792535588055496 ], + [ -0.6612740792172486, 0.3181315096444124, 0.010550425782049904, 0.67926255839886 ] + ], + "angular_velocities": [ + [ 0.000031623595509944944, -0.000028807313539993838, 0.00005651876115812607 ], + [ 0.00003162359550994386, -0.0000288073135400059, 0.00005651876115812055 ], + [ 0.00003162359550994274, -0.00002880731354001798, 0.00005651876115811503 ], + [ 0.000031623595509941664, -0.000028807313540030006, 0.000056518761158109486 ], + [ 0.00003162359550994056, -0.000028807313540042064, 0.00005651876115810396 ], + [ 0.00003162359550993948, -0.000028807313540054092, 0.00005651876115809842 ] + ], + "reference_frame": 1 + }, + "instrument_position": { + "spk_table_start_time": 392211095.6197291, + "spk_table_end_time": 392211097.5397291, + "spk_table_original_size": 6, + "ephemeris_times": [ + 392211095.6197291, + 392211096.0037291, + 392211096.3877291, + 392211096.7717291, + 392211097.1557291, + 392211097.5397291 + ], + "positions": [ + [ 87.5466120113472, 3034.785875639327, 2293.0758126687438 ], + [ 87.03005208648025, 3035.4979563295706, 2292.1348624958596 ], + [ 86.5134824945184, 3036.209687378141, 2291.1936480294244 ], + [ 85.99690275864972, 3036.921069649284, 2290.2521700219877 ], + [ 85.48031228284398, 3037.6321040072453, 2289.3104292410007 ], + [ 84.96371228899615, 3038.3427884701114, 2288.3684244645356 ] + ], + "velocities": [ + [ -1.345193813965703, 1.8548292421158314, -2.450048685058793 ], + [ -1.3452205668195178, 1.8539213021825771, -2.450735403178137 ], + [ -1.3452471645308965, 1.8530131393894345, -2.4514218450552074 ], + [ -1.345273607089621, 1.8521047539790478, -2.452108010497707 ], + [ -1.3452998944856378, 1.8511961461942064, -2.4527938993135434 ], + [ -1.3453260267206557, 1.8502873158548383, -2.4534795116298573 ] + ], + "reference_frame": 1 + }, + "sun_position": { + "spk_table_start_time": 392211096.5797291, + "spk_table_end_time": 392211096.5797291, + "spk_table_original_size": 1, + "ephemeris_times": [ 392211096.5797291 ], + "positions": [ [ 216567462.79095057, 97116302.56258373, 38695487.929268934 ] ], + "velocities": [ [ -11.437813079573214, 17.847439745021983, 8.495028880862519 ] ], + "reference_frame": 1 + } +} diff --git a/tests/pytests/test_cassis_drivers.py b/tests/pytests/test_cassis_drivers.py index f290eb7f4..b83a3be1c 100644 --- a/tests/pytests/test_cassis_drivers.py +++ b/tests/pytests/test_cassis_drivers.py @@ -5,260 +5,14 @@ import numpy as np from ale.formatters.isis_formatter import to_isis +from ale.formatters.formatter import to_isd from ale.base.data_isis import IsisSpice +from ale.drivers.tgo_drivers import TGOCassisIsisLabelNaifSpiceDriver + import unittest from unittest.mock import patch -from conftest import get_image_label, get_image_kernels, convert_kernels, compare_dicts - -from ale.drivers.tgo_drivers import TGOCassisIsisLabelNaifSpiceDriver -from conftest import get_image_kernels, convert_kernels, get_image_label - -@pytest.fixture() -def isis_compare_dict(): - return { - "CameraVersion": 1, - "NaifKeywords": { - "BODY499_RADII": [3396.19, 3396.19, 3376.2], - "BODY_FRAME_CODE": 10014, - "BODY_CODE": 499, - "INS-143400_FOV_ANGLE_UNITS": "DEGREES", - "INS-143400_OD_A3_DIST": [ - 1.78250771483506e-05, - 4.24592743471094e-06, - 9.51220699036653e-06, - 0.00215158425420738, - -0.0066835595774833, - 0.573741540971609 - ], - "TKFRAME_-143400_ANGLES": [0.021, 0.12, -179.881], - "FRAME_-143400_CENTER": -143.0, - "INS-143400_FOV_CLASS_SPEC": "ANGLES", - "INS-143400_OD_A3_CORR": [ - -3.13320167004204e-05, - -7.35655125749807e-06, - -1.57664245066771e-05, - 0.00373549465439151, - -0.0141671946930935, - 1.0 - ], - "INS-143400_FOV_REF_VECTOR": [1.0, 0.0, 0.0], - "TKFRAME_-143400_AXES": [1.0, 2.0, 3.0], - "TKFRAME_-143400_SPEC": "ANGLES", - "INS-143400_OD_A2_DIST": [ - -5.69725741015406e-05, - 0.00215155905679149, - -0.00716392991767185, - 0.000124152787728634, - 0.576459544392426, - 0.010576940564854 - ], - "FRAME_-143400_NAME": "TGO_CASSIS_CRU", - "INS-143400_BORESIGHT": [0.0, 0.0, 1.0], - "INS-143400_ITRANSL": [0.0, 0.0, 100.0], - "TKFRAME_-143400_RELATIVE": "TGO_SPACECRAFT", - "INS-143400_ITRANSS": [0.0, 100.0, 0.0], - "INS-143400_FOV_CROSS_ANGLE": 0.67057, - "INS-143400_BORESIGHT_LINE": 1024.5, - "INS-143400_OD_A2_CORR": [ - 9.9842559363676e-05, - 0.00373543707958162, - -0.0133299918873929, - -0.000215311328389359, - 0.995296015537294, - -0.0183542717710778 - ], - "INS-143400_SWAP_OBSERVER_TARGET": "TRUE", - "FRAME_-143400_CLASS_ID": -143400.0, - "INS-143400_LIGHTTIME_CORRECTION": "LT+S", - "INS-143400_BORESIGHT_SAMPLE": 1024.5, - "INS-143400_PIXEL_PITCH": 0.01, - "INS-143400_FOV_REF_ANGLE": 0.67057, - "INS-143400_FOV_SHAPE": "RECTANGLE", - "INS-143400_OD_A1_DIST": [ - 0.00213658795560622, - -0.00711785765064197, - 1.10355974742147e-05, - 0.573607182625377, - 0.000250884350194894, - 0.000550623913037132 - ], - "INS-143400_FILTER_SAMPLES": 2048.0, - "INS-143400_FILTER_LINES": 2048.0, - "INS-143400_OD_A1_CORR": [ - 0.00376130530948266, - -0.0134154156065812, - -1.86749521007237e-05, - 1.00021352681836, - -0.000432362371703953, - -0.000948065735350123 - ], - "INS-143400_FOV_FRAME": "TGO_CASSIS_FSA", - "INS-143400_LT_SURFACE_CORRECT": "TRUE", - "INS-143400_NAME": "TGO_CASSIS", - "INS-143400_FOCAL_LENGTH": 874.9, - "FRAME_-143400_CLASS": 4.0, - "INS-143400_TRANSX": [0.0, 0.01, 0.0], - "INS-143400_TRANSY": [0.0, 0.0, 0.01], - "TKFRAME_-143400_UNITS": "DEGREES", - "FRAME_1503499_CLASS": 4.0, - "FRAME_1500499_SEC_FRAME": "J2000", - "FRAME_1500499_DEF_STYLE": "PARAMETERIZED", - "TKFRAME_1503499_SPEC": "MATRIX", - "FRAME_1500499_PRI_AXIS": "Z", - "BODY499_POLE_DEC": [52.8865, -0.0609, 0.0], - "FRAME_1502499_PRI_TARGET": "SUN", - "FRAME_1502499_CENTER": 499.0, - "FRAME_1501499_ANGLE_1_COEFFS": [-47.68143, 3.362106117068471e-11], - "FRAME_1502499_FAMILY": "TWO-VECTOR", - "FRAME_1503499_NAME": "MME2000", - "FRAME_1502499_SEC_TARGET": "SUN", - "FRAME_1501499_EPOCH": 0.0, - "FRAME_1500499_SEC_SPEC": "RECTANGULAR", - "FRAME_1501499_UNITS": "DEGREES", - "FRAME_1500499_CENTER": 499.0, - "FRAME_1502499_PRI_OBSERVER": "MARS", - "FRAME_1500499_FAMILY": "TWO-VECTOR", - "FRAME_1502499_SEC_VECTOR_DEF": "OBSERVER_TARGET_VELOCITY", - "FRAME_1500499_CLASS": 5.0, - "FRAME_1500499_SEC_VECTOR_DEF": "CONSTANT", - "FRAME_1501499_ANGLE_2_COEFFS": [-37.1135, -1.929804547874363e-11], - "FRAME_1500499_PRI_SPEC": "RECTANGULAR", - "BODY499_POLE_RA": [317.68143, -0.1061, 0.0], - "FRAME_1500499_PRI_VECTOR": [0.0, 0.0, 1.0], - "FRAME_1502499_PRI_VECTOR_DEF": "OBSERVER_TARGET_POSITION", - "TKFRAME_1503499_RELATIVE": "J2000", - "FRAME_1500499_NAME": "MME", - "FRAME_1500499_PRI_VECTOR_DEF": "CONSTANT", - "FRAME_1500499_SEC_VECTOR": [0.0, 0.0, 1.0], - "BODY499_PM": [176.63, 350.89198226, 0.0], - "FRAME_1502499_SEC_FRAME": "J2000", - "FRAME_1502499_PRI_ABCORR": "NONE", - "FRAME_1503499_CENTER": 499.0, - "FRAME_1502499_DEF_STYLE": "PARAMETERIZED", - "FRAME_1503499_CLASS_ID": 1503499.0, - "FRAME_1502499_RELATIVE": "J2000", - "FRAME_1502499_SEC_ABCORR": "NONE", - "FRAME_1501499_CLASS": 5.0, - "TKFRAME_1503499_MATRIX": [ - 0.6732521982472339, - 0.7394129276360181, - 0.0, - -0.589638760543004, - 0.536879430789133, - 0.6033958972853946, - 0.4461587269353556, - -0.4062376142607541, - 0.7974417791532832 - ], - "FRAME_1502499_CLASS_ID": 1502499.0, - "FRAME_1501499_ANGLE_3_COEFFS": 0.0, - "FRAME_1501499_RELATIVE": "J2000", - "FRAME_1501499_NAME": "MME_IAU2000", - "FRAME_1501499_CENTER": 499.0, - "FRAME_1501499_CLASS_ID": 1501499.0, - "FRAME_1500499_RELATIVE": "J2000", - "FRAME_1501499_FAMILY": "EULER", - "FRAME_1502499_SEC_AXIS": "Y", - "FRAME_1502499_CLASS": 5.0, - "FRAME_1501499_DEF_STYLE": "PARAMETERIZED", - "FRAME_1500499_CLASS_ID": 1500499.0, - "FRAME_1500499_PRI_FRAME": "IAU_MARS", - "BODY499_GM": 42828.314, - "FRAME_1502499_PRI_AXIS": "X", - "FRAME_1502499_SEC_OBSERVER": "MARS", - "FRAME_1502499_NAME": "MSO", - "FRAME_1501499_AXES": [3.0, 1.0, 3.0], - "FRAME_1500499_SEC_AXIS": "Y" - }, - "InstrumentPointing": { - "TimeDependentFrames": [-143410, -143400, -143000, 1], - "ConstantFrames" : [-143420, -143410], - "CkTableStartTime": 533471602.76595, - "CkTableEndTime": 533471602.76595, - "CkTableOriginalSize": 1, - "EphemerisTimes": [533471602.76595], - "Quaternions": [ - [-0.38852078202718, - -0.53534661398878, - -0.74986993015978, - 0.012275694110544 - ] - ], - "AngularVelocity": [ - [-5.18973909108511e-04, - -2.78782123621868e-04, - 2.84462861654798e-04 - ] - ], - "ConstantRotation": [ - 0.0021039880161896, - -5.08910327554815e-04, - 0.99999765711961, - 0.98482103650022, - 0.17356149021485, - -0.0019837290716917, - -0.17356007404082, - 0.98482290292452, - 8.66356891752243e-04 - ] - }, - "BodyRotation": { - "TimeDependentFrames": [10014, 1], - "CkTableStartTime": 533471602.76595, - "CkTableEndTime": 533471602.76595, - "CkTableOriginalSize": 1, - "EphemerisTimes": [533471602.76595], - "Quaternions": [ - [-0.84364286886959, - 0.083472339272581, - 0.30718999789287, - -0.43235793455935 - ] - ], - "AngularVelocity": [ - [3.16231952619494e-05, - -2.8811745785852e-05, - 5.6516725802331e-05 - ] - ] - }, - "InstrumentPosition": { - "SpkTableStartTime": 533471602.76595, - "SpkTableEndTime": 533471602.76595, - "SpkTableOriginalSize": 1, - "EphemerisTimes": [533471602.76595], - "Positions": [ - [-2707.0266303122, - 2307.373459613, - 2074.8887762465] - ], - "Velocities": [ - [-1.6101681507607, - -4.1440662687653, - -0.48379032129765 - ] - ] - }, - "SunPosition": { - "SpkTableStartTime": 533471602.76595, - "SpkTableEndTime": 533471602.76595, - "SpkTableOriginalSize": 1, - "EphemerisTimes": [533471602.76595], - "Positions": [ - [-206349081.4204, - 17157784.002827, - 13440194.20453 - ] - ], - "Velocities": [ - [-3.3908615862221, - -23.832213042409, - -10.839726759899 - ] - ] - } -} +from conftest import get_image_label, get_image_kernels, convert_kernels, compare_dicts, get_isd @pytest.fixture() @@ -270,11 +24,13 @@ def test_kernels(scope="module"): os.remove(kern) @pytest.mark.xfail -def test_cassis_load(test_kernels, isis_compare_dict): +def test_cassis_load(test_kernels): label_file = get_image_label("CAS-MCO-2016-11-26T22.32.14.582-RED-01000-B1", "isis") - isis_isd = ale.load(label_file, props={'kernels': test_kernels}, formatter="isis") - - assert compare_dicts(isis_isd, isis_compare_dict) == [] + isd_str = ale.loads(label_file, props={'kernels': test_kernels}) + isd_obj = json.loads(isd_str) + compare_dict = get_isd('cassis') + print(json.dumps(isd_obj, indent=2)) + assert compare_dicts(isd_obj, compare_dict) == [] # ========= Test cassis ISIS label and naifspice driver ========= class test_cassis_isis_naif(unittest.TestCase): diff --git a/tests/pytests/test_formatter.py b/tests/pytests/test_formatter.py index 7d6d8f7df..64a80541b 100644 --- a/tests/pytests/test_formatter.py +++ b/tests/pytests/test_formatter.py @@ -9,7 +9,7 @@ from ale.base.data_naif import NaifSpice from ale.rotation import ConstantRotation, TimeDependentRotation -class TestDriver(Driver, NaifSpice): +class DummyNaifSpiceDriver(Driver, NaifSpice): """ Test Driver implementation with dummy values """ @@ -129,7 +129,7 @@ def target_name(self): return 'Test Target' -class TestLineScanner(LineScanner, TestDriver): +class DummyLineScannerDriver(LineScanner, DummyNaifSpiceDriver): """ Test class for overriding properties from the LineScanner class. """ @@ -172,10 +172,10 @@ def exposure_duration(self): @pytest.fixture def driver(): - return TestFramer('') + return DummyFramerDriver('') -class TestFramer(Framer, TestDriver): +class DummyFramerDriver(Framer, DummyNaifSpiceDriver): """ Test class for overriding properties from the Framer class """ @@ -208,11 +208,11 @@ def image_lines(self): @pytest.fixture def test_line_scan_driver(): - return TestLineScanner("") + return DummyLineScannerDriver("") @pytest.fixture def test_frame_driver(): - return TestFramer("") + return DummyFramerDriver("") def test_frame_name_model(test_frame_driver): isd = formatter.to_isd(test_frame_driver) diff --git a/tests/pytests/test_hayabusa2_drivers.py b/tests/pytests/test_hayabusa2_drivers.py index a3d04d8df..1301c2564 100644 --- a/tests/pytests/test_hayabusa2_drivers.py +++ b/tests/pytests/test_hayabusa2_drivers.py @@ -8,177 +8,24 @@ import spiceypy as spice import ale +from ale.formatters.formatter import to_isd -from conftest import get_image_kernels, convert_kernels, get_image_label, compare_dicts - - -image_dict = { - 'hyb2_onc_20151203_084458_w2f_l2a' : { - 'isis' : { - 'CameraVersion': 1, - 'NaifKeywords': { - "BODY399_RADII": [ - 6378.1366, - 6378.1366, - 6356.7519 - ], - "BODY_FRAME_CODE": 10013, - "BODY_CODE": 399, - "INS-37120_BORESIGHT_SAMPLE": 512.5, - "INS-37120_FOCAL_LENGTH": 10.44, - "INS-37120_FOV_CROSS_ANGLE": 32.62, - "FRAME_-37120_CLASS_ID": -37120.0, - "INS-37120_OD_K": [ - 1.014, - 2.9329999999999996e-07, - -1.3839999999999997e-13 - ], - "INS-37120_FOV_REF_ANGLE": 32.62, - "INS-37120_BORESIGHT": [ - 0.0, - 0.0, - 10.44 - ], - "INS-37120_FILTER_BANDWIDTH": 170.0, - "INS-37120_PIXEL_LINES": 1024.0, - "FRAME_-37120_CLASS": 4.0, - "TKFRAME_-37120_RELATIVE": "HAYABUSA2_SC_BUS_PRIME", - "TKFRAME_-37120_ANGLES": [ - -270.0, - -121.0, - 0.0 - ], - "INS-37120_FOV_SHAPE": "RECTANGLE", - "FRAME_-37120_CENTER": -37.0, - "INS-37120_IFOV": 0.00124521, - "INS-37120_FILTER_TRANSMITTANCE": 0.25, - "INS-37120_FOV_FRAME": "HAYABUSA2_ONC-W2", - "INS-37120_ITRANSL": [ - 0.0, - 0.0, - 76.923076923077 - ], - "INS-37120_ITRANSS": [ - 0.0, - 76.923076923077, - 0.0 - ], - "INS-37120_TRANSX": [ - 0.0, - 0.013, - 0.0 - ], - "TKFRAME_-37120_UNITS": "DEGREES", - "INS-37120_TRANSY": [ - 0.0, - 0.0, - 0.013 - ], - "INS-37120_PIXEL_SAMPLES": 1024.0, - "INS-37120_FOV_CLASS_SPEC": "ANGLES", - "INS-37120_FOV_REF_VECTOR": [ - 0.0, - 1.0, - 0.0 - ], - "INS-37120_PIXEL_PITCH": 0.013, - "INS-37120_PIXEL_SIZE": [ - 0.013, - 0.013 - ], - "FRAME_-37120_NAME": "HAYABUSA2_ONC-W2", - "INS-37120_FOV_ANGLE_UNITS": "DEGREES", - "TKFRAME_-37120_AXES": [ - 3.0, - 2.0, - 1.0 - ], - "TKFRAME_-37120_SPEC": "ANGLES", - "INS-37120_BORESIGHT_LINE": 512.5, - "INS-37120_FILTER_QE": 0.7, - "INS-37120_FILTER_BANDCENTER": 570.0, - "INS-37120_CCD_CENTER": [ - 512.5, - 512.5 - ], - "INS-37120_F/RATIO": 9.6, - "BODY399_N_GEOMAG_CTR_DIPOLE_LAT": 80.13, - "BODY399_POLE_RA": [ - 0.0, - -0.641, - 0.0 - ], - "BODY399_POLE_DEC": [ - 90.0, - -0.557, - 0.0 - ], - "BODY399_N_GEOMAG_CTR_DIPOLE_LON": 287.62, - "BODY399_LONG_AXIS": 0.0, - "BODY399_PM": [ - 190.147, - 360.9856235, - 0.0 - ] - }, - 'InstrumentPointing': {'TimeDependentFrames': [-37000, 1], - 'ConstantFrames': [-37120, -37000], - 'ConstantRotation': [9.46109594816419e-17, 0.51503807491005, -0.85716730070211, - 1.0, -1.83697019872103e-16, 0.0, - -1.57459078670793e-16, -0.85716730070211, -0.51503807491005], - 'CkTableStartTime': 502404366.34876, - 'CkTableEndTime': 502404366.34876, - 'CkTableOriginalSize': 1, - 'EphemerisTimes': [502404366.34876287], - 'Quaternions': [[-0.5013652613006103, 0.83203136256, 0.04949957619999998, -0.2321776872]], - 'AngularVelocity' : [[-3.3566444941696236e-05, 3.30201152018665e-05, 2.987092640139532e-06]]}, - 'BodyRotation': {'TimeDependentFrames': [10013, 1], - 'CkTableStartTime': 502404366.34876, - 'CkTableEndTime': 502404366.34876, - 'CkTableOriginalSize': 1, - 'EphemerisTimes': [502404366.34876287], - 'Quaternions': [[-0.1979938370409085, -0.0007582477662989689, 0.00015456662316054356, -0.9802029594238645]], - 'AngularVelocity' : [[1.128586084254313e-07, -1.9793051740218293e-10, 7.292106285199177e-05]]}, - 'InstrumentPosition': {'SpkTableStartTime': 502404366.34876, - 'SpkTableEndTime': 502404366.34876, - 'SpkTableOriginalSize': 1, - 'EphemerisTimes': [502404366.34876287], - 'Positions': [[30.15558294075686, -21415.864299596455, 29138.041066520385]], - 'Velocities': [[1.5409457644671734, 5.3312261011154565, -3.5389092329306164]]}, - 'SunPosition': {'SpkTableStartTime': 502404366.34876, - 'SpkTableEndTime': 502404366.34876, - 'SpkTableOriginalSize': 1, - 'EphemerisTimes': [502404366.34876287], - 'Positions': [[-48916727.046504386, -127647230.31032252, -55336271.675298646]], - 'Velocities': [[28.58340952406857, -8.972886737522412, -3.888902421092297]]} - } - } -} - +from conftest import get_image_kernels, convert_kernels, get_image_label, compare_dicts, get_isd @pytest.fixture(scope='module') def test_kernels(): - updated_kernels = {} - binary_kernels = {} - for image in image_dict.keys(): - kernels = get_image_kernels(image) - updated_kernels[image], binary_kernels[image] = convert_kernels(kernels) - yield updated_kernels - for kern_list in binary_kernels.values(): - for kern in kern_list: - os.remove(kern) - + kernels = get_image_kernels('hyb2_onc_20151203_084458_w2f_l2a') + updated_kernels, binary_kernels = convert_kernels(kernels) + yield updated_kernels + for kern in binary_kernels: + os.remove(kern) @pytest.mark.xfail @pytest.mark.parametrize("label_type", ['isis3']) -@pytest.mark.parametrize("formatter", ['isis']) -@pytest.mark.parametrize("image", image_dict.keys()) -def test_hayabusa_load(test_kernels, label_type, formatter, image): - label_file = get_image_label(image, label_type) - - usgscsm_isd_str = ale.loads(label_file, props={'kernels': test_kernels[image]}, - formatter=formatter, verbose=False) - usgscsm_isd_obj = json.loads(usgscsm_isd_str) - print(json.dumps(usgscsm_isd_obj, indent=2)) - - assert compare_dicts(usgscsm_isd_obj, image_dict[image][formatter]) == [] +def test_hayabusa_load(test_kernels, label_type): + label_file = get_image_label('hyb2_onc_20151203_084458_w2f_l2a', label_type) + isd_str = ale.loads(label_file, props={'kernels': test_kernels}, verbose=False) + isd_obj = json.loads(isd_str) + compare_dict = get_isd('hayabusa2') + print(json.dumps(isd_obj, indent=2)) + assert compare_dicts(isd_obj, compare_dict) == [] diff --git a/tests/pytests/test_juno_drivers.py b/tests/pytests/test_juno_drivers.py index 75eef1a42..01aa8271e 100644 --- a/tests/pytests/test_juno_drivers.py +++ b/tests/pytests/test_juno_drivers.py @@ -11,107 +11,7 @@ from ale.drivers.juno_drivers import JunoJunoCamIsisLabelNaifSpiceDriver from ale.base.data_naif import NaifSpice -from conftest import get_image_kernels, convert_kernels, get_image_label, compare_dicts - -@pytest.fixture() -def isis_compare_dict(): - return { - 'CameraVersion': 1, - 'NaifKeywords': {'BODY599_RADII': np.array([71492., 71492., 66854.]), - 'BODY_FRAME_CODE': 10015, - 'BODY_CODE': 599, - 'INS-61500_ITRANSS': np.array([ 0. , 135.1351, 0. ]), - 'INS-61500_DISTORTION_K1': -5.962420945566733e-08, - 'INS-61500_DISTORTION_K2': 2.738191004225615e-14, - 'FRAME_-61500_CLASS_ID': -61500.0, - 'INS-61500_BORESIGHT': np.array([0., 0., 1.]), - 'TKFRAME_-61500_RELATIVE': 'JUNO_JUNOCAM_CUBE', - 'INS-61500_BORESIGHT_SAMPLE': 814.21, - 'INS-61500_FOV_SHAPE': 'POLYGON', - 'INS-61500_FILTER_OFFSET': 1.0, - 'INS-61500_SWAP_OBSERVER_TARGET': 'TRUE', - 'INS-61500_LIGHTTIME_CORRECTION': 'NONE', - 'INS-61500_FOV_BOUNDARY_CORNERS': np.array([-0.47351727, -0.18862601, 0.86034971, -0.47852984, -0.11376363, - 0.87067045, -0.47934991, -0.09577177, 0.87238262, -0.48125208]), - 'INS-61500_PIXEL_PITCH': 0.0074, - 'INS-61500_FOV_FRAME': 'JUNO_JUNOCAM', - 'TKFRAME_-61500_ANGLES': np.array([ 0.69 , -0.469, 0.583]), - 'FRAME_-61500_CENTER': -61.0, - 'FRAME_-61500_CLASS': 4.0, - 'FRAME_-61500_NAME': 'JUNO_JUNOCAM', - 'INS-61500_LT_SURFACE_CORRECT': 'FALSE', - 'TKFRAME_-61500_AXES': np.array([3., 2., 1.]), - 'INS-61500_PIXEL_SIZE': 0.0074, - 'TKFRAME_-61500_SPEC': 'ANGLES', - 'INS-61500_DISTORTION_X': 814.21, - 'INS-61500_DISTORTION_Y': 78.48, - 'INS-61500_BORESIGHT_LINE': 600.0, - 'INS-61500_FILTER_LINES': 1200.0, - 'INS-61500_INTERFRAME_DELTA': 0.001, - 'INS-61500_FILTER_NAME': 'FULLCCD', - 'INS-61500_TRANSX': np.array([0. , 0.0074, 0. ]), - 'INS-61500_TRANSY': np.array([0. , 0. , 0.0074]), - 'TKFRAME_-61500_UNITS': 'DEGREES', - 'INS-61500_ITRANSL': np.array([ 0. , 0. , 135.1351]), - 'INS-61500_START_TIME_BIAS': 0.06188, - 'INS-61500_FOCAL_LENGTH': 10.95637, - 'INS-61500_FILTER_SAMPLES': 1648.0, - 'BODY599_PM': np.array([284.95 , 870.536, 0. ]), - 'BODY599_LONG_AXIS': 0.0, - 'BODY599_NUT_PREC_DEC': np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]), - 'BODY599_NUT_PREC_PM': np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]), - 'BODY599_POLE_RA': np.array([ 2.68056595e+02, -6.49900000e-03, 0.00000000e+00]), - 'BODY599_POLE_DEC': np.array([6.4495303e+01, 2.4130000e-03, 0.0000000e+00]), - 'BODY599_NUT_PREC_RA': np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]), - 'INS-61504_DISTORTION_K1': -5.962420945566733e-08, - 'INS-61504_DISTORTION_K2': 2.738191004225615e-14, - 'INS-61504_START_TIME_BIAS': 0.06188, - 'INS-61504_FOV_FRAME': 'JUNO_JUNOCAM', - 'INS-61504_FILTER_OFFSET': 284.52, - 'INS-61504_FILTER_NAME': 'METHANE', - 'INS-61504_FOV_BOUNDARY_CORNERS': np.array([-0.47351727, -0.18862601, 0.86034971, -0.47852984, -0.11376363, - 0.87067045, 0.49067337, -0.11299511, 0.86398596, 0.48553839]), - 'INS-61504_INTERFRAME_DELTA': 0.001, - 'INS-61504_FILTER_SAMPLES': 1648.0, - 'INS-61504_DISTORTION_X': 814.21, - 'INS-61504_DISTORTION_Y': 315.48, - 'INS-61504_PIXEL_SIZE': 0.0074, - 'INS-61504_FILTER_LINES': 128.0, - 'INS-61504_BORESIGHT': np.array([ 0.00854687, -0.16805056, 0.98574133]), - 'INS-61504_FOCAL_LENGTH': 10.95637, - 'INS-61504_FOV_SHAPE': 'RECTANGLE'}, - 'InstrumentPointing': {'TimeDependentFrames': [-61000, 1], - 'CkTableStartTime': 525560475.1286545, - 'CkTableEndTime': 525560475.1286545, - 'CkTableOriginalSize': 1, - 'EphemerisTimes': np.array([5.25560475e+08]), - 'Quaternions': np.array([[-0.42623555, -0.55051779, 0.46456631, -0.5472034 ]]), - 'AngularVelocity': np.array([[ 0.204182 , -0.00811453, -0.00786116]]), - 'ConstantFrames': [-61500, -61505, -61000], - 'ConstantRotation': np.array([ 0.0022409695777088, -0.002220557600931, - -0.99999502357726, 0.012486301868467, - -0.99991951530675, 0.0022483714915059, - -0.99991953192294, -0.012491278263463, - -0.0022130626614382])}, - 'BodyRotation': {'TimeDependentFrames': [10015, 1], - 'CkTableStartTime': 525560475.1286545, - 'CkTableEndTime': 525560475.1286545, - 'CkTableOriginalSize': 1, - 'EphemerisTimes': np.array([5.25560475e+08]), - 'Quaternions': np.array([[-0.89966963, 0.20059167, -0.09209383, 0.37666467]]), - 'AngularVelocity': np.array([[-2.56683271e-06, -7.56713067e-05, 1.58718697e-04]])}, - 'InstrumentPosition': {'SpkTableStartTime': 525560475.1286545, - 'SpkTableEndTime': 525560475.1286545, - 'SpkTableOriginalSize': 1, - 'EphemerisTimes': [525560475.1286545], - 'Positions': np.array([[ -7197.04131196, -382913.71404775, 145608.88474678]]), - 'Velocities': np.array([[ 0.39087306, 24.13639337, 2.15702628]])}, - 'SunPosition': {'SpkTableStartTime': 525560475.0262545, - 'SpkTableEndTime': 525560475.0262545, - 'SpkTableOriginalSize': 1, - 'EphemerisTimes': np.array([5.25560475e+08]), - 'Positions': np.array([[814823700.57661,22018509.45354,-10399060.67075]]), - 'Velocities': np.array([[-0.10070347311145,11.449085311077,4.9098525890309]])}} +from conftest import get_image_kernels, convert_kernels, get_image_label, compare_dicts, get_isd @pytest.fixture(scope='module') def test_kernels(): @@ -123,15 +23,13 @@ def test_kernels(): @pytest.mark.xfail @pytest.mark.parametrize("label_type", ['isis3']) -@pytest.mark.parametrize("formatter", ['isis']) -def test_mro_load(test_kernels, label_type, formatter, isis_compare_dict): +def test_mro_load(test_kernels, label_type): label_file = get_image_label('JNCR_2016240_01M06152_V01', label_type) - - usgscsm_isd_str = ale.loads(label_file, props={'kernels': test_kernels}, formatter=formatter) - usgscsm_isd_obj = json.loads(usgscsm_isd_str) - print(json.dumps(usgscsm_isd_obj, indent=4)) - - assert compare_dicts(usgscsm_isd_obj, isis_compare_dict) == [] + isd_str = ale.loads(label_file, props={'kernels': test_kernels}) + isd_obj = json.loads(isd_str) + compare_dict = get_isd('juno') + print(json.dumps(isd_obj, indent=2)) + assert compare_dicts(isd_obj, compare_dict) == [] # ========= Test isislabel and naifspice driver ========= class test_isis_naif(unittest.TestCase): diff --git a/tests/pytests/test_mdis_drivers.py b/tests/pytests/test_mdis_drivers.py index 20d1b648f..5932326ab 100644 --- a/tests/pytests/test_mdis_drivers.py +++ b/tests/pytests/test_mdis_drivers.py @@ -21,18 +21,17 @@ def test_kernels(): os.remove(kern) image_dict = { - 'EN1072174528M': get_isd("messmdis")} + 'EN1072174528M': get_isd("messmdis") +} @pytest.mark.parametrize("label_type", ["pds3", "isis3"]) @pytest.mark.parametrize("image", image_dict.keys()) def test_load(test_kernels, label_type, image): label_file = get_image_label(image, label_type) - print(test_kernels) - usgscsm_isd_str = ale.loads(label_file, props={'kernels': test_kernels}, verbose=True) - usgscsm_isd_obj = json.loads(usgscsm_isd_str) - print(json.dumps(usgscsm_isd_obj, indent=2)) - - assert compare_dicts(usgscsm_isd_obj, image_dict[image]) == [] + isd_str = ale.loads(label_file, props={'kernels': test_kernels}) + isd_obj = json.loads(isd_str) + print(json.dumps(isd_obj, indent=2)) + assert compare_dicts(isd_obj, image_dict[image]) == [] # ========= Test Pds3 Label and NAIF Spice driver ========= class test_pds3_naif(unittest.TestCase): diff --git a/tests/pytests/test_newhorizons_drivers.py b/tests/pytests/test_newhorizons_drivers.py index 5b2acb34a..fcb9c6527 100644 --- a/tests/pytests/test_newhorizons_drivers.py +++ b/tests/pytests/test_newhorizons_drivers.py @@ -7,217 +7,15 @@ import numpy as np from ale.drivers import co_drivers from ale.formatters.isis_formatter import to_isis +from ale.formatters.formatter import to_isd from ale.base.data_isis import IsisSpice -import unittest +import unittest from unittest.mock import patch from conftest import get_image_label, get_image_kernels, convert_kernels, compare_dicts from ale.drivers.nh_drivers import NewHorizonsLorriIsisLabelNaifSpiceDriver -from conftest import get_image_kernels, convert_kernels, get_image_label - -@pytest.fixture() -def isis_compare_dict(): - return { - "CameraVersion": 2, - "NaifKeywords": { - "BODY501_RADII": [1829.4, 1819.4, 1815.7], - "BODY_FRAME_CODE": 10023, - "BODY_CODE": 501, - "INS-98301_SIP_B_1_1": 3.7063022991452e-07, - "INS-98301_SIP_B_1_2": 3.6773991492864e-13, - "INS-98301_SIP_A_2_0": 3.7132883452972e-07, - "INS-98301_SIP_A_2_1": 3.6773993329229e-13, - "INS-98301_FOCAL_LENGTH_UNITS": "mm", - "INS-98301_OOC_KMAT": - [76.94085558205741, - 0.0, - 0.0, - 76.94085558205741], - "INS-98301_SIP_BP_0_2": -2.4738992578302e-07, - "INS-98301_SIP_BP_0_3": 4.5900372459772e-09, - "INS-98301_SIP_B_2_0": -2.5764535470748e-10, - "INS-98301_SIP_B_2_1": -4.550504716094301e-09, - "INS-98301_BORESIGHT": [0.0, 0.0, -1.0], - "INS-98301_SIP_A_3_0": -4.5683524653106e-09, - "INS-98301_SIP_BP_1_1": -3.7439988768003e-07, - "INS-98301_REFERENCE_VECTOR": [1.0, 0.0, 0.0], - "INS-98301_SIP_B_ORDER": 3.0, - "INS-98301_OOC_EM_SIGMA": [1.6e-07, 8.3e-07, 8e-07], - "INS-98301_SIP_B_3_0": -4.8263374371619e-16, - "INS-98301_APERTURE_DIAM_UNITS": "mm", - "FRAME_-98301_NAME": "NH_LORRI_1X1", - "INS-98301_SIP_BP_2_1": 4.5900372459772e-09, - "INS-98301_SIP_AP_ORDER": 3.0, - "INS-98301_FOV_REF_ANGLE": 0.14560853, - "INS-98301_APERTURE_DIAMETER": 208.0, - "INS-98301_FOV_SHAPE": "RECTANGLE", - "TKFRAME_-98301_SPEC": "MATRIX", - "FRAME_-98301_CLASS_ID": -98301.0, - "INS-98301_OOC_FOCAL_LENGTH_SIGMA": 0.02, - "INS-98301_ITRANSL": [ - 0.0, - 0.0, - 76.923076923077 - ], - "INS-98301_ITRANSS": [ - 0.0, - 76.923076923077, - 0.0 - ], - "INS-98301_SIP_AP_1_1": -2.4738992578302e-07, - "INS-98301_SIP_AP_1_2": 4.5900372459772e-09, - "INS-98301_FOV_CLASS_SPEC": "ANGLES", - "INS-98301_PIXEL_LINES": 1024.0, - "INS-98301_SIP_AP_2_0": -3.7439988768003e-07, - "INS-98301_SIP_A_ORDER": 3.0, - "FRAME_-98301_CENTER": -98.0, - "INS-98301_FOV_REF_VECTOR": [ - 1.0, - 0.0, - 0.0 - ], - "TKFRAME_-98301_RELATIVE": "NH_LORRI", - "INS-98301_SIP_BP_ORDER": 3.0, - "INS-98301_FOV_FRAME": "NH_LORRI_1X1", - "INS-98301_FOV_ANGLE_UNITS": "DEGREES", - "INS-98301_SIP_AP_3_0": 4.5900372459772e-09, - "INS-98301_PLATFORM_ID": -98000.0, - "TKFRAME_-98301_MATRIX": [ - 1.0, - 0.0, - 0.0, - 0.0, - 1.0, - 0.0, - 0.0, - 0.0, - 1.0 - ], - "FRAME_-98301_CLASS": 4.0, - "INS-98301_PIXEL_SIZE": 12.997, - "INS-98301_FOCAL_LENGTH": 2618.4775964615383, - "INS-98301_F/NUMBER": 12.59, - "INS-98301_OOC_FOCAL_LENGTH": 2618.4775964615383, - "INS-98301_TRANSX": [ - 0.0, - 0.013, - 0.0 - ], - "INS-98301_TRANSY": [ - 0.0, - 0.0, - 0.013 - ], - "INS-98301_PIXEL_SAMPLES": 1024.0, - "INS-98301_FOV_CROSS_ANGLE": 0.14560853, - "INS-98301_SIP_A_0_2": -3.8995992016686996e-10, - "INS-98301_SIP_A_0_3": -4.826382722745001e-16, - "INS-98301_OOC_CCD_CENTER": [511.5, 511.5], - "INS-98301_IFOV": 4.963571, - "INS-98301_CCD_CENTER": [511.5, 511.5], - "INS-98301_SIP_B_0_2": 2.4536068067188e-07, - "INS-98301_SIP_B_0_3": -4.5685088916275e-09, - "INS-98301_SIP_A_1_1": 2.4489911491959e-07, - "INS-98301_SIP_A_1_2": -4.550660817442101e-09, - "INS-98301_OOC_EM": [ - 2.7172539725122488e-05, - -1.9034392552127412e-05, - -2.8806647687927977e-05 - ], - "BODY501_NUT_PREC_RA": [ - 0.0, - 0.0, - 0.094, - 0.024 - ], - "BODY501_LONG_AXIS": 0.0, - "BODY501_POLE_DEC": [64.5, 0.003, 0.0], - "BODY501_PM": [200.39, 203.4889538, 0.0], - "BODY501_NUT_PREC_PM": [0.0, 0.0, -0.085, -0.022], - "BODY501_NUT_PREC_DEC": [ - 0.0, - 0.0, - 0.04, - 0.011 - ], - "BODY501_POLE_RA": [268.05, -0.009, 0.0] - }, - "InstrumentPointing": { - "TimeDependentFrames": [-98000, 1], - "CkTableStartTime": 225940527.51631695, - "CkTableEndTime": 225940527.51631695, - "CkTableOriginalSize": 1, - "EphemerisTimes": [225940527.51631695], - "Quaternions": [ - [-0.040223695171375, - 0.062038072129285, - 0.97695635330468, - 0.20022391388359] - ], - "AngularVelocity": [ - [1.39581813997533e-05, - -1.15948738928358e-05, - 2.21456402487273e-05] - ], - "ConstantFrames": [-98301, -98300, -98000], - "ConstantRotation": - [-0.005452680629036, - -0.99996036726125, - 0.007037910250677, - 0.002999533810427, - -0.0070543385533461, - -0.99997061912063, - 0.99998063534794, - -0.0054314099747325, - 0.0030378799858676] - }, - "BodyRotation": { - "TimeDependentFrames": [10023, 1], - "CkTableStartTime": 225940527.51631695, - "CkTableEndTime": 225940527.51631695, - "CkTableOriginalSize": 1, - "EphemerisTimes": [225940527.51631695], - "Quaternions": [ - [-0.57817095054415, - 0.13699803004374, - 0.1729987472005, - -0.78550704973162] - ], - "AngularVelocity": [ - [-6.24011073378906e-07, - -1.76837707421929e-05, - 3.7102455825449e-05] - ] - }, - "InstrumentPosition": { - "SpkTableStartTime": 225940527.51631695, - "SpkTableEndTime": 225940527.51631695, - "SpkTableOriginalSize": 1, - "EphemerisTimes": [225940527.51631695], - "Positions": [ - [-2390849.002579,321807.33761069,-141054.73789822] - ], - "Velocities": [ - [6.3943726561674,-22.16679208555,-8.6097977343012] - ] - }, - "SunPosition": { - "SpkTableStartTime": 225940527.51631695, - "SpkTableEndTime": 225940527.51631695, - "SpkTableOriginalSize": 1, - "EphemerisTimes": [225940527.51631695], - "Positions": [ - [311036228.79889,679984041.50957,283865335.82619 - ] - ], - "Velocities": [ - [ - 4.7547216698047,-0.80026582585286,-0.11480667580455 - ] - ] - } -} +from conftest import get_image_kernels, convert_kernels, get_image_label, get_isd @pytest.fixture() def test_kernels(scope="module"): @@ -227,8 +25,10 @@ def test_kernels(scope="module"): for kern in binary_kernels: os.remove(kern) -def test_newhorizons_load(test_kernels, isis_compare_dict): +def test_newhorizons_load(test_kernels): label_file = get_image_label("lor_0034974380_0x630_sci_1", "isis") - isis_isd = ale.load(label_file, props={'kernels': test_kernels}, formatter="isis") - assert compare_dicts(isis_isd, isis_compare_dict) == [] - + isd_str = ale.loads(label_file, props={'kernels': test_kernels}) + isd_obj = json.loads(isd_str) + compare_dict = get_isd('newhorizons') + print(json.dumps(isd_obj, indent=2)) + assert compare_dicts(isd_obj, compare_dict) == [] diff --git a/tests/pytests/test_themis_drivers.py b/tests/pytests/test_themis_drivers.py index 5b0b66c5c..195b244ea 100644 --- a/tests/pytests/test_themis_drivers.py +++ b/tests/pytests/test_themis_drivers.py @@ -8,261 +8,15 @@ import ale from ale import util +from ale.formatters.formatter import to_isd from ale.drivers.ody_drivers import OdyThemisVisIsisLabelNaifSpiceDriver, OdyThemisIrIsisLabelNaifSpiceDriver -from conftest import get_image_label, get_image_kernels, convert_kernels, compare_dicts +from conftest import get_image_label, get_image_kernels, convert_kernels, compare_dicts, get_isd image_dict = { - "V46475015EDR": { - "isis": { - "CameraVersion": 1, - "NaifKeywords": { - "BODY499_RADII": [ 3396.19, 3396.19, 3376.2 ], - "BODY_FRAME_CODE": 10014, - "BODY_CODE": 499, - "INS-53032_TRANSX": [ 0, 0.009, 0 ], - "INS-53032_TRANSY": [ 0, 0, -0.009 ], - "FRAME_-53032_CLASS_ID": -53032, - "INS-53032_CK_TIME_BIAS": 0, - "INS-53032_CK_FRAME_ID": -53000, - "TKFRAME_-53032_RELATIVE": "M01_THEMIS_OPTICS", - "FRAME_-53032_NAME": "M01_THEMIS_VIS", - "TKFRAME_-53032_AXES": [ 1, 2, 3 ], - "TKFRAME_-53032_SPEC": "ANGLES", - "INS-53032_CK_TIME_TOLERANCE": 1, - "FRAME_-53032_CLASS": 4, - "INS-53032_PLATFORM_ID": -53000, - "INS-53032_ITRANSL": [ 0, 0, -111.11111111 ], - "INS-53032_SPK_TIME_BIAS": 0, - "INS-53032_ITRANSS": [ 0, 111.11111111, 0 ], - "TKFRAME_-53032_ANGLES": [ 0, 90, -0.25 ], - "FRAME_-53032_CENTER": -53, - "INS-53032_CK_REFERENCE_ID": 16, - "TKFRAME_-53032_UNITS": "DEGREES", - "BODY499_POLE_DEC": [ 52.8865, -0.0609, 0 ], - "BODY499_POLE_RA": [ 317.68143, -0.1061, 0 ], - "BODY499_PM": [ 176.63, 350.89198226, 0 ] - }, - "InstrumentPointing": { - "TimeDependentFrames": [ -53000, 16, 1 ], - "CkTableStartTime": 392211095.6197291, - "CkTableEndTime": 392211097.5397291, - "CkTableOriginalSize": 6, - "EphemerisTimes": [ - 392211095.6197291, - 392211096.0037291, - 392211096.3877291, - 392211096.7717291, - 392211097.1557291, - 392211097.5397291 - ], - "Quaternions": [ - [ 0.622044822044232, 0.2555212953329484, 0.5142689567685136, -0.5322560916547194 ], - [ 0.6219555566538323, 0.2556095368638264, 0.5142243466922363, -0.532361128821991 ], - [ 0.6218662733649556, 0.25569777103883873, 0.5141797218177431, -0.532466150669111 ], - [ 0.6217764034754604, 0.25578530978663744, 0.514134694883009, -0.5325725254798925 ], - [ 0.6216862534405807, 0.25587252406502475, 0.5140894745361436, -0.5326795151709507 ], - [ 0.6215960852368998, 0.2559597308655292, 0.5140442391649964, -0.5327864892944326 ] - ], - "AngularVelocity": [ - [ -0.0008105492062180801, -0.00019831431313117837, 0.0002945565809147707 ], - [ -0.0008108026806805358, -0.0001980750326173721, 0.00029502731883054514 ], - [ -0.0008114627704207764, -0.00019745190628475147, 0.0002962531988088855 ], - [ -0.0008119328383766381, -0.00019701160233906684, 0.0002972128619119053 ], - [ -0.0008120105314920341, -0.0001969488072413385, 0.00029762281538913397 ], - [ -0.0008119477826533893, -0.00019702113314222383, 0.0002978360123824115 ] - ], - "ConstantFrames": [ -53032, -53030, -53000 ], - "ConstantRotation": [ - 0.0003684744441107557, - 0.004882317815721682, - 0.9999880135278275, - 0.29095386119307015, - 0.9567251530513545, - -0.004778302596747774, - -0.9567370144838278, - 0.2909521343651026, - -0.0010680004511185448 - ] - }, - "BodyRotation": { - "TimeDependentFrames": [ 10014, 1 ], - "CkTableStartTime": 392211095.6197291, - "CkTableEndTime": 392211097.5397291, - "CkTableOriginalSize": 6, - "EphemerisTimes": [ - 392211095.6197291, - 392211096.0037291, - 392211096.3877291, - 392211096.7717291, - 392211097.1557291, - 392211097.5397291 - ], - "Quaternions": [ - [ -0.6613202993937386, 0.31813079098385316, 0.010572073619126085, 0.6792175591790568 ], - [ -0.661311055603654, 0.31813093483380667, 0.0105677440557396, 0.6792265592743864 ], - [ -0.6613018116910848, 0.31813107862483736, 0.010563414490395608, 0.6792355592439125 ], - [ -0.6612925676560322, 0.3181312223569454, 0.010559084923095426, 0.6792445590876345 ], - [ -0.6612833234984982, 0.31813136603013065, 0.01055475535383936, 0.6792535588055496 ], - [ -0.6612740792172486, 0.3181315096444124, 0.010550425782049904, 0.67926255839886 ] - ], - "AngularVelocity": [ - [ 0.000031623595509944944, -0.000028807313539993838, 0.00005651876115812607 ], - [ 0.00003162359550994386, -0.0000288073135400059, 0.00005651876115812055 ], - [ 0.00003162359550994274, -0.00002880731354001798, 0.00005651876115811503 ], - [ 0.000031623595509941664, -0.000028807313540030006, 0.000056518761158109486 ], - [ 0.00003162359550994056, -0.000028807313540042064, 0.00005651876115810396 ], - [ 0.00003162359550993948, -0.000028807313540054092, 0.00005651876115809842 ] - ] - }, - "InstrumentPosition": { - "SpkTableStartTime": 392211095.6197291, - "SpkTableEndTime": 392211097.5397291, - "SpkTableOriginalSize": 6, - "EphemerisTimes": [ - 392211095.6197291, - 392211096.0037291, - 392211096.3877291, - 392211096.7717291, - 392211097.1557291, - 392211097.5397291 - ], - "Positions": [ - [ 87.5466120113472, 3034.785875639327, 2293.0758126687438 ], - [ 87.03005208648025, 3035.4979563295706, 2292.1348624958596 ], - [ 86.5134824945184, 3036.209687378141, 2291.1936480294244 ], - [ 85.99690275864972, 3036.921069649284, 2290.2521700219877 ], - [ 85.48031228284398, 3037.6321040072453, 2289.3104292410007 ], - [ 84.96371228899615, 3038.3427884701114, 2288.3684244645356 ] - ], - "Velocities": [ - [ -1.345193813965703, 1.8548292421158314, -2.450048685058793 ], - [ -1.3452205668195178, 1.8539213021825771, -2.450735403178137 ], - [ -1.3452471645308965, 1.8530131393894345, -2.4514218450552074 ], - [ -1.345273607089621, 1.8521047539790478, -2.452108010497707 ], - [ -1.3452998944856378, 1.8511961461942064, -2.4527938993135434 ], - [ -1.3453260267206557, 1.8502873158548383, -2.4534795116298573 ] - ] - }, - "SunPosition": { - "SpkTableStartTime": 392211096.5797291, - "SpkTableEndTime": 392211096.5797291, - "SpkTableOriginalSize": 1, - "EphemerisTimes": [ 392211096.5797291 ], - "Positions": [ [ 216567462.79095057, 97116302.56258373, 38695487.929268934 ] ], - "Velocities": [ [ -11.437813079573214, 17.847439745021983, 8.495028880862519 ] ] - } - } - }, - "I74199019RDR": { - "isis": { - "CameraVersion": 1, - "NaifKeywords": { - "BODY499_RADII": [ 3396.19, 3396.19, 3376.2 ], - "BODY_FRAME_CODE": 10014, - "BODY_CODE": 499, - "TKFRAME_-53031_RELATIVE": "M01_THEMIS_OPTICS", - "TKFRAME_-53031_UNITS": "DEGREES", - "INS-53031_CK_FRAME_ID": -53000, - "INS-53031_CK_TIME_BIAS": 0, - "INS-53031_ITRANSL": [ 0, 0, 20 ], - "INS-53031_ITRANSS": [ 0, 20, 0 ], - "TKFRAME_-53031_ANGLES": [ -0.1701, 90.05331, -0.6315 ], - "INS-53031_CK_TIME_TOLERANCE": 1, - "FRAME_-53031_CENTER": -53, - "FRAME_-53031_NAME": "M01_THEMIS_IR", - "TKFRAME_-53031_AXES": [ 3, 2, 3 ], - "TKFRAME_-53031_SPEC": "ANGLES", - "INS-53031_TRANSX": [ 0, 0.05, 0 ], - "INS-53031_TRANSY": [ 0, 0, 0.05 ], - "INS-53031_PLATFORM_ID": -53000, - "FRAME_-53031_CLASS_ID": -53031, - "INS-53031_CK_REFERENCE_ID": 16, - "FRAME_-53031_CLASS": 4, - "INS-53031_SPK_TIME_BIAS": 0, - "BODY499_POLE_DEC": [ 52.8865, -0.0609, 0 ], - "BODY499_POLE_RA": [ 317.68143, -0.1061, 0 ], - "BODY499_PM": [ 176.63, 350.89198226, 0 ] - }, - "InstrumentPointing": { - "TimeDependentFrames": [ -53000, 16, 1 ], - "CkTableStartTime": 589445676.9899044, - "CkTableEndTime": 589445686.0439956, - "CkTableOriginalSize": 4, - "EphemerisTimes": [ 589445676.9899044, 589445680.0079348, 589445683.0259652, 589445686.0439956 ], - "Quaternions": [ - [ 0.38598147685908185, -0.5607948046031743, -0.6866376818635513, -0.2550611309016295 ], - [ 0.38562579307122824, -0.5617138648879078, -0.6858904675855092, -0.25558667450829115 ], - [ 0.38527060742872654, -0.5626353429020607, -0.6851390429149169, -0.25611037043160223 ], - [ 0.3849151928868023, -0.563557151464003, -0.6843852032119891, -0.25663305504782297 ] - ], - "AngularVelocity": [ - [ 0.0007324350225698707, -0.00006952577687208014, -0.0005029467858822215 ], - [ 0.0007335508142603166, -0.0000691981129943357, -0.0005044432717278556 ], - [ 0.0007368387903980461, -0.0000332990142650248, -0.0004221206727530788 ], - [ 0.0007393253232865181, -0.0000072290602625411406, -0.0003625424840601517 ] - ], - "ConstantFrames": [ -53031, -53030, -53000 ], - "ConstantRotation": [ - 0.0013835021734054376, - 0.01152997618685378, - 0.9999325705120657, - 0.2881133069543266, - 0.9575279926584919, - -0.011439651709813592, - -0.957595325948064, - 0.288109706404575, - -0.0019971975093594496 - ] - }, - "BodyRotation": { - "TimeDependentFrames": [ 10014, 1 ], - "CkTableStartTime": 589445676.9899044, - "CkTableEndTime": 589445686.0439956, - "CkTableOriginalSize": 4, - "EphemerisTimes": [ 589445676.9899044, 589445680.0079348, 589445683.0259652, 589445686.0439956 ], - "Quaternions": [ - [ -0.5408451126894908, 0.31557698159693326, -0.04183520300757272, 0.7785547819873538 ], - [ -0.5407618335951139, 0.3155725050030793, -0.041868957604701294, 0.7786126275639432 ], - [ -0.5406785483110855, 0.3155680247986294, -0.04190271172395818, 0.7786704642344462 ], - [ -0.5405952568468566, 0.31556354098409234, -0.04193646536151294, 0.7787282919923001 ] - ], - "AngularVelocity": [ - [ 0.00003162303650185794, -0.000028813502069024346, 0.00005651591926299394 ], - [ 0.000031623036501849386, -0.000028813502069119034, 0.00005651591926295044 ], - [ 0.00003162303650184082, -0.000028813502069213752, 0.000056515919262906996 ], - [ 0.00003162303650183226, -0.000028813502069308437, 0.000056515919262863486 ] - ] - }, - "InstrumentPosition": { - "SpkTableStartTime": 589445676.9899044, - "SpkTableEndTime": 589445686.0439956, - "SpkTableOriginalSize": 4, - "EphemerisTimes": [ 589445676.9899044, 589445680.0079348, 589445683.0259652, 589445686.0439956 ], - "Positions": [ - [ -883.3647639832787, 3235.9253823963995, -1734.2678063014955 ], - [ -878.0820172062348, 3241.143181714679, -1727.2955108387216 ], - [ -872.7929026970128, 3246.3375924365314, -1720.3106940936013 ], - [ -867.4974605099152, 3251.5085747718745, -1713.3134080300226 ] - ], - "Velocities": [ - [ 1.7493370110442228, 1.7327474299014805, 2.308134335038546 ], - [ 1.7514526413807416, 1.7250030655476496, 2.312291077819496 ], - [ 1.7535556099591456, 1.7172463879119024, 2.316431067882768 ], - [ 1.7556459015231667, 1.7094774543366804, 2.3205542750988553 ] - ] - }, - "SunPosition": { - "SpkTableStartTime": 589445681.51695, - "SpkTableEndTime": 589445681.51695, - "SpkTableOriginalSize": 1, - "EphemerisTimes": [ 589445681.51695 ], - "Positions": [ [ -177834612.75017235, 94014077.38389017, 47921572.85876171 ] ], - "Velocities": [ [ -13.267042406345718, -20.96669045246765, -9.258799613448325 ] ] - } - } - } + "V46475015EDR": get_isd("themisvis"), + "I74199019RDR": get_isd("themisir") } @pytest.fixture(scope='module') @@ -279,15 +33,14 @@ def test_kernels(): @pytest.mark.xfail @pytest.mark.parametrize("label_type", ['isis3']) -@pytest.mark.parametrize("formatter", ['isis']) @pytest.mark.parametrize("image", image_dict.keys()) -def test_load(test_kernels, label_type, formatter, image): +def test_load(test_kernels, label_type, image): label_file = get_image_label(image, label_type) - usgscsm_isd_str = ale.loads(label_file, props={'kernels': test_kernels[image]}, formatter=formatter) - usgscsm_isd_obj = json.loads(usgscsm_isd_str) - print(json.dumps(usgscsm_isd_obj, indent=4)) - - assert compare_dicts(usgscsm_isd_obj, image_dict[image][formatter]) == [] + isd_str = ale.loads(label_file, props={'kernels': test_kernels[image]}) + isd_obj = json.loads(isd_str) + compare_dict = image_dict[image] + print(json.dumps(isd_obj, indent=2)) + assert compare_dicts(isd_obj, compare_dict) == [] class test_themisir_isis_naif(unittest.TestCase): def setUp(self):