Skip to content
Snippets Groups Projects
Unverified Commit 759b3073 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Mex fixes (#541)

* Doc string typo fix

* Initial mex hrsc fixes for times

* Initial test updates to mex

* Add truth ISDs

* Made all mex drivers use the NoDistortion mixin

* Added changelog entry

* Fixed failing tests
parent 8aa3b10a
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,9 @@ release.
## [Unreleased]
### Fixed
- MexHrscIsisLabelNaifSpice and MexHrscPds3NaifSpice have had there ephemeris times changed and sampling factor updated. MexHrscIsisLabelNaifSpice has also had it's focal length, and focal plane translation updated to reflect those found in the MexHrscPds3NaifSpice driver [#541](https://github.com/DOI-USGS/ale/pull/541)
## [0.9.0] - 2023-04-19
### Fixed
......
......@@ -107,7 +107,7 @@ class IsisLabel():
@property
def sampling_factor(self):
"""
Returns the summing factor from the PDS3 label. For example a return value of 2
Returns the summing factor from the ISIS label. For example a return value of 2
indicates that 2 lines and 2 samples (4 pixels) were summed and divided by 4
to produce the output pixel value.
......
......@@ -16,7 +16,7 @@ from ale.base.label_pds3 import Pds3Label
from ale.base.label_isis import IsisLabel
from ale.base.type_sensor import LineScanner
from ale.base.type_sensor import Framer
from ale.base.type_distortion import RadialDistortion
from ale.base.type_distortion import NoDistortion
FILTER_SPECIFIC_LOOKUP = {
# This table contains the filter specific information from the ISIS iak kernel. The format is as follows:
......@@ -69,7 +69,7 @@ FILTER_SPECIFIC_LOOKUP = {
[-8569.5561557859, 0.068566503695773, 142.857126402363]],
}
class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDistortion, Driver):
class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, NoDistortion, Driver):
"""
Driver for a PDS3 Mars Express (Mex) High Resolution Stereo Camera (HRSC) images.
......@@ -90,19 +90,6 @@ class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDistor
"""
@property
def odtk(self):
"""
The coefficients for the distortion model
Returns
-------
: list
Radial distortion coefficients. There is only one coefficient for LROC NAC l/r
"""
return [0.0, 0.0, 0.0]
@property
def ikid(self):
"""
......@@ -417,8 +404,8 @@ class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDistor
with open(self._file, 'rb') as image_file:
bytes_per_record = self.label['RECORD_BYTES']
num_records = self.label['FILE_RECORDS']
img_start_record = self.label['^IMAGE']
img_start_byte = bytes_per_record * (img_start_record - 1) # Offset by one for zero-based records
img_start_record = self.label['^IMAGE'] - 1 # Offset by one for zero-based records
img_start_byte = bytes_per_record * img_start_record
num_img_records = num_records - img_start_record
image_file.seek(img_start_byte)
......@@ -436,6 +423,16 @@ class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDistor
self._binary_ephemeris_times = times
@property
def ephemeris_start_time(self):
"""
Returns
-------
: float
starting ephemeris time
"""
return self.binary_ephemeris_times[0]
@property
def ephemeris_stop_time(self):
"""
......@@ -450,6 +447,20 @@ class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDistor
"""
return self.binary_ephemeris_times[-1] + self.binary_exposure_durations[-1]
@property
def sampling_factor(self):
"""
Returns the summing factor from the PDS3 label. For example a return value of 2
indicates that 2 lines and 2 samples (4 pixels) were summed and divided by 4
to produce the output pixel value.
Returns
-------
: int
Number of samples and lines combined from the original data to produce a single pixel in this image
"""
return self.label.get('MACROPIXEL_SIZE', 1)
# TODO We need to confirm that returning nothing here does not affect
# calculations elsewhere in code. Or is there possibly just a better way of
......@@ -482,7 +493,7 @@ class MexHrscPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDistor
return 1
class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialDistortion, Driver):
class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, NoDistortion, Driver):
@property
def instrument_id(self):
......@@ -526,7 +537,6 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
"""
return 0.0
@property
def detector_center_sample(self):
"""
......@@ -576,7 +586,11 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
list of lines, list of ephemeris times, and list of exposure
times
"""
return self.times_table['LineStart'], self.times_table['EphemerisTime'], self.times_table['ExposureTime']
times = self.times_table['EphemerisTime']
times = [time - self.center_ephemeris_time for time in times]
start_lines = self.times_table['LineStart']
start_lines = [line - .5 for line in start_lines]
return start_lines, times, self.times_table['ExposureTime']
@property
def ephemeris_start_time(self):
......@@ -613,7 +627,6 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
"""
return spice.bods2c("MEX_HRSC_HEAD")
@property
def fikid(self):
"""
......@@ -631,9 +644,29 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
"""
return spice.bods2c(self.instrument_id)
@property
def focal_length(self):
"""
Returns the focal length of the filter-specific sensor
Expects fikid to be defined. This must be the integer Naif id code of
the filter-specific instrument.
NOTE: These values are pulled from ISIS iak kernels.
Returns
-------
: float
focal length
"""
return FILTER_SPECIFIC_LOOKUP[self.fikid][0]
@property
def focal2pixel_lines(self):
"""
Expects fikid to be defined. This must be the integer Naif id code of
the filter-specific instrument.
NOTE: These values are pulled from ISIS iak kernels.
Returns
......@@ -641,12 +674,15 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
: list<double>
focal plane to detector lines
"""
return [0.0, 0.0, 111.111111111111]
return FILTER_SPECIFIC_LOOKUP[self.fikid][4]
@property
def focal2pixel_samples(self):
"""
Expects fikid to be defined. This must be the integer Naif id code of
the filter-specific instrument.
NOTE: These values are pulled from ISIS iak kernels.
Returns
......@@ -654,26 +690,28 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
: list<double>
focal plane to detector samples
"""
return [0.0, 111.111111111111, 0.0]
class MexSrcPds3NaifSpiceDriver(Framer, Pds3Label, NaifSpice, RadialDistortion, Driver):
"""
Driver for a PDS3 Mars Express (Mex) High Resolution Stereo Camera (HRSC) - Super Resolution
Channel (SRC) image.
"""
return FILTER_SPECIFIC_LOOKUP[self.fikid][3]
@property
def odtk(self):
def sampling_factor(self):
"""
The coefficients for the distortion model. No distortion model, so pass in all zeroes.
Returns the summing factor from the PDS3 label. For example a return value of 2
indicates that 2 lines and 2 samples (4 pixels) were summed and divided by 4
to produce the output pixel value.
Returns
-------
: list
Radial distortion coefficients.
: int
Number of samples and lines combined from the original data to produce a single pixel in this image
"""
return [0.0, 0.0, 0.0]
summing = self.label['IsisCube']['Instrument'].get("Summing", 1)
return summing
class MexSrcPds3NaifSpiceDriver(Framer, Pds3Label, NaifSpice, NoDistortion, Driver):
"""
Driver for a PDS3 Mars Express (Mex) High Resolution Stereo Camera (HRSC) - Super Resolution
Channel (SRC) image.
"""
@property
def ikid(self):
......
......@@ -115,147 +115,6 @@ RADIANCE_OFFSET = 0.0 <W*m**-2*sr**-1>
RADIANCE_SCALING_FACTOR = 0.0169353 <W*m**-2*sr**-1>
REFLECTANCE_SCALING_FACTOR = 0.00215382
/* DATA OBJECT DEFINITIONS */
Object = IMAGE
INTERCHANGE_FORMAT = BINARY
LINES = 400
LINE_PREFIX_BYTES = 68
LINE_SAMPLES = 1288
SAMPLE_TYPE = MSB_INTEGER
SAMPLE_BITS = 16
BANDS = 1
BAND_STORAGE_TYPE = BAND_SEQUENTIAL
MAXIMUM = 136
MEAN = 72.9682
MINIMUM = 29
STANDARD_DEVIATION = 17.629
End_Object
/* IMAGE HEADER DATA ELEMENTS */
Object = IMAGE_HEADER
HEADER_TYPE = VICAR2
INTERCHANGE_FORMAT = ASCII
BYTES = 7932
^DESCRIPTION = VICAR2.TXT
End_Object
End
PDS_VERSION_ID = PDS3
/* FILE DATA ELEMENTS */
RECORD_TYPE = FIXED_LENGTH
RECORD_BYTES = 2644
FILE_RECORDS = 15095
LABEL_RECORDS = 4
/* POINTERS TO DATA OBJECTS */
^IMAGE_HEADER = 5
^IMAGE = 8
/* IDENTIFICATION DATA ELEMENTS */
FILE_NAME = H5270_0000_IR2.IMG
DATA_SET_ID = MEX-M-HRSC-3-RDR-V2.0
DETECTOR_ID = MEX_HRSC_IR
EVENT_TYPE = MARS-REGIONAL-MAPPING-Vo-Te-Im
INSTRUMENT_HOST_ID = MEX
INSTRUMENT_HOST_NAME = "MARS EXPRESS"
INSTRUMENT_ID = HRSC
INSTRUMENT_NAME = "HIGH RESOLUTION STEREO CAMERA"
MISSION_NAME = "MARS EXPRESS"
MISSION_PHASE_NAME = ME_Phase_11
PROCESSING_LEVEL_ID = 2
PRODUCT_CREATION_TIME = 2009-04-30T15:19:42.000Z
PRODUCT_ID = H5270_0000_IR2.IMG
RELEASE_ID = 0062
REVISION_ID = 0000
/* TIME DATA ELEMENTS */
SPACECRAFT_CLOCK_START_COUNT = 1/0150552525.07284
SPACECRAFT_CLOCK_STOP_COUNT = 1/0150552792.64947
START_TIME = 2008-02-08T12:08:53.843Z
STOP_TIME = 2008-02-08T12:12:10.561Z
/* ORBITAL DATA ELEMENTS */
ASCENDING_NODE_LONGITUDE = 118.52
MAXIMUM_RESOLUTION = 55.3 <m/pixel>
FOOTPRINT_POINT_LATITUDE = (25.9975, 25.9916, 25.9739, 25.85, 25.599,
25.351, 25.2208, 24.5915, 24.4629, 24.0857,
23.9617, 22.7055, 22.577, 20.2998, 17.6826,
17.4193, 17.1598, 13.0429, 13.0429, 13.0427,
13.0427, 13.0425, 13.0425, 13.0423, 13.0423,
13.0421, 13.0421, 13.042, 13.042, 13.0418,
13.0416, 13.0415, 13.0411, 13.0409, 13.0406,
13.0404, 13.04, 13.0396, 13.0392, 13.0388,
13.0381, 13.0377, 13.0372, 13.0367, 13.0364,
13.0362, 13.0357, 13.0354, 13.0353, 13.0348,
13.0346, 13.0345, 13.0343, 13.0338, 13.0336,
13.0335, 13.0332, 13.0327, 13.0324, 13.0323,
13.032, 13.0315, 13.0312, 13.0311, 13.0308,
13.0306, 13.0314, 17.2063, 17.3388, 17.7327,
17.8665, 18.0031, 18.1342, 18.2588, 18.6486,
18.7797, 18.9094, 19.4369, 19.8287, 19.9612,
20.0923, 20.2223, 21.1159, 21.2444, 21.62,
21.7442, 21.9976, 22.1232, 22.251, 22.6309,
22.7559, 22.8791, 23.0084, 23.1362, 24.9031,
25.151, 25.4021, 25.7834, 25.9087, 25.9975)
FOOTPRINT_POINT_LONGITUDE = (78.2107, 76.9405, 76.9316, 76.9337, 76.9367,
76.9407, 76.9404, 76.9464, 76.9466, 76.95,
76.9517, 76.9613, 76.9611, 76.9667, 76.9603,
76.9585, 76.9579, 76.9246, 76.9359, 76.9483,
76.9978, 77.0101, 77.0225, 77.0349, 77.0844,
77.0968, 77.1092, 77.1216, 77.1711, 77.1835,
77.1958, 77.2578, 77.2825, 77.3444, 77.3691,
77.431, 77.4434, 77.5178, 77.5302, 77.6046,
77.617, 77.6791, 77.7039, 77.7661, 77.7785,
77.791, 77.8531, 77.8655, 77.878, 77.9277,
77.9401, 77.9526, 77.965, 78.0147, 78.0272,
78.0396, 78.0521, 78.1018, 78.1143, 78.1268,
78.1393, 78.189, 78.2015, 78.214, 78.2265,
78.2514, 78.2556, 78.2459, 78.2449, 78.2432,
78.2416, 78.2388, 78.2383, 78.2406, 78.2406,
78.2402, 78.2403, 78.2371, 78.2363, 78.2352,
78.2347, 78.2347, 78.231, 78.2298, 78.2303,
78.231, 78.2301, 78.23, 78.2291, 78.2277,
78.228, 78.229, 78.2273, 78.2263, 78.2208,
78.2219, 78.2215, 78.2186, 78.2185, 78.2107)
ORBIT_NUMBER = 5270
ORBITAL_ECCENTRICITY = 0.573
ORBITAL_INCLINATION = 86.74
ORBITAL_SEMIMAJOR_AXIS = 8712.4
PERIAPSIS_ALTITUDE = 331.9
PERIAPSIS_ARGUMENT_ANGLE = 151.2
PERIAPSIS_TIME = 2008-02-08T12:08:35.000Z
SPACECRAFT_ORIENTATION = (0.0, -1.0, 0.0)
^MEX_ORIENTATION_DESC = MEX_ORIENTATION_DESC.TXT
SPACECRAFT_POINTING_MODE = ACROSSTRACK
^MEX_POINTING_DESC = MEX_POINTING_DESC.TXT
RIGHT_ASCENSION = -1e+32
DECLINATION = -1e+32
OFFSET_ANGLE = 0.05
SPACECRAFT_SOLAR_DISTANCE = 2.42797e+08
TARGET_NAME = MARS
/* CAMERA DATA ELEMENTS */
DETECTOR_TEMPERATURE = 17.351 <degC>
FOCAL_PLANE_TEMPERATURE = 7.9716 <degC>
INST_CMPRS_NAME = "DISCRETE COSINE TRANSFORMATION (DCT)"
INST_CMPRS_RATIO = 11.2342
INST_CMPRS_QUALITY = 0
INST_CMPRS_QUANTZ_TBL_ID = 0
INSTRUMENT_TEMPERATURE = 11.0301 <degC>
LENS_TEMPERATURE = 8.1755 <degC>
MACROPIXEL_SIZE = 4
MISSING_FRAMES = 0
PIXEL_SUBSAMPLING_FLAG = N
SAMPLE_FIRST_PIXEL = 80
SIGNAL_CHAIN_ID = 2
/* RADIOMETRIC DATA ELEMENTS */
BANDWIDTH = 81.0 <nm>
CENTER_FILTER_WAVELENGTH = 955.5 <nm>
RADIANCE_OFFSET = 0.0 <W*m**-2*sr**-1>
RADIANCE_SCALING_FACTOR = 0.0169353 <W*m**-2*sr**-1>
REFLECTANCE_SCALING_FACTOR = 0.00215382
/* DATA OBJECT DEFINITIONS */
Object = IMAGE
INTERCHANGE_FORMAT = BINARY
......
{
"CameraVersion": 1,
"NaifKeywords": {
"isis_camera_version": 1,
"image_lines": 15088,
"image_samples": 1288,
"name_platform": "MARS EXPRESS",
"name_sensor": "HIGH RESOLUTION STEREO CAMERA",
"reference_height": {
"maxheight": 1000,
"minheight": -1000,
"unit": "m"
},
"name_model": "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL",
"interpolation_method": "lagrange",
"line_scan_rate": [
[
0.5,
-98.35948351025581,
0.012800790786743165
],
[
6665.5,
98.34625607728958,
0.013227428436279297
]
],
"starting_ephemeris_time": 255744599.02748165,
"center_ephemeris_time": 255744697.38696516,
"radii": {
"semimajor": 3396.19,
"semiminor": 3376.2,
"unit": "km"
},
"body_rotation": {
"time_dependent_frames": [
10014,
1
],
"ck_table_start_time": 255744599.02748165,
"ck_table_end_time": 255744684.34504557,
"ck_table_original_size": 2,
"ephemeris_times": [
255744599.02748165,
255744684.34504557
],
"quaternions": [
[
-0.6525755651775765,
-0.023151423894873242,
0.3174415084303075,
-0.6876336466682659
],
[
-0.654651809237426,
-0.02219145654977925,
0.31751006120710407,
-0.6856572824309715
]
],
"angular_velocities": [
[
3.162398161513709e-05,
-2.8803031775991535e-05,
5.6520727317788564e-05
],
[
3.162398161489585e-05,
-2.8803031778668454e-05,
5.652072731655937e-05
]
],
"reference_frame": 1
},
"instrument_pointing": {
"time_dependent_frames": [
-41001,
1
],
"ck_table_start_time": 255744599.02748165,
"ck_table_end_time": 255744684.34504557,
"ck_table_original_size": 3,
"ephemeris_times": [
255744599.02748165,
255744684.33197814,
255744684.34504557
],
"quaternions": [
[
-0.34147103254256284,
0.4600620001156389,
-0.4826410643063962,
-0.662418367068051
],
[
-0.3659838104244632,
0.44394513387664625,
-0.4497912009709326,
-0.6831225689022163
],
[
-0.3659874882249891,
0.4439426152453299,
-0.4497860930062306,
-0.6831255985322837
]
],
"angular_velocities": [
[
0.0003517633111319437,
0.001015465002260446,
0.00038771759258420565
],
[
0.00035178320677913466,
0.001008400741447663,
0.0003885676589327302
],
[
0.0003517842276725049,
0.0010084000654699077,
0.00038856810918190424
]
],
"reference_frame": 1,
"constant_frames": [
-41210,
-41200,
-41000,
-41001
],
"constant_rotation": [
-0.9999999844629888,
1.027590578527487e-06,
0.00017627525841189352,
1.2246232944813223e-16,
-0.9999830090976747,
0.00582936668603668,
0.0001762782535384808,
0.0058293665954657434,
0.9999829935609271
]
},
"naif_keywords": {
"BODY499_RADII": [
3396.19,
3396.19,
......@@ -139,177 +278,102 @@
],
"INS-41218_IFOV": 4e-05
},
"InstrumentPointing": {
"TimeDependentFrames": [
-41001,
1
],
"CkTableStartTime": 255744599.02748,
"CkTableEndTime": 255744635.91477,
"CkTableOriginalSize": 3,
"EphemerisTimes": [
255744599.02748,
255744623.61901,
255744635.91477
],
"Quaternions": [
[
-0.34147103206303764,
0.46006200041554185,
-0.48264106492774883,
-0.6624183666542334
],
[
-0.34862899148129517,
0.4555408857335137,
-0.47327265910130095,
-0.668545673735942
],
[
-0.3521802679309037,
0.45323805476596757,
-0.46855266563769715,
-0.6715673637959837
]
],
"AngularVelocity": [
[
0.00035176331113592204,
0.0010154650024473103,
0.00038771759244781866
],
[
0.00035242855802833725,
0.0010149701470475953,
0.0003878218830533074
],
[
0.0003502620823697415,
0.001017194110775444,
0.00038476436104443903
]
],
"ConstantFrames": [
-41210,
-41200,
-41000,
-41001
],
"ConstantRotation": [
-0.9999999844629888,
1.027590578527487e-06,
0.00017627525841189352,
1.2246232944813223e-16,
-0.9999830090976747,
0.00582936668603668,
0.0001762782535384808,
0.0058293665954657434,
0.9999829935609271
]
"detector_sample_summing": 4,
"detector_line_summing": 4,
"focal_length_model": {
"focal_length": 174.82
},
"BodyRotation": {
"TimeDependentFrames": [
10014,
1
],
"CkTableStartTime": 255744599.02748,
"CkTableEndTime": 255744635.91477,
"CkTableOriginalSize": 2,
"EphemerisTimes": [
255744599.02748,
255744635.91477
],
"Quaternions": [
[
-0.6525755651363003,
-0.0231514239139282,
0.3174415084289179,
-0.6876336467074378
],
[
-0.6534739684048748,
-0.022736404778153148,
0.31747150360998055,
-0.68677993048033
]
"detector_center": {
"line": 0.0,
"sample": 2592.0
},
"focal2pixel_lines": [
-7113.11359717265,
0.062856784318668,
142.857129028729
],
"AngularVelocity": [
[
3.1623981615137114e-05,
-2.8803031775991542e-05,
5.6520727317788564e-05
"focal2pixel_samples": [
-0.778052433438109,
-142.857129028729,
0.062856784318668
],
[
3.1623981615032794e-05,
-2.8803031777148914e-05,
5.6520727317257115e-05
]
"optical_distortion": {
"radial": {
"coefficients": [
0.0,
0.0,
0.0
]
}
},
"InstrumentPosition": {
"SpkTableStartTime": 255744599.02748,
"SpkTableEndTime": 255744635.91477,
"SpkTableOriginalSize": 3,
"EphemerisTimes": [
255744599.02748,
255744623.61901,
255744635.91477
],
"Positions": [
"starting_detector_line": 0,
"starting_detector_sample": 0,
"instrument_position": {
"spk_table_start_time": 255744599.02748165,
"spk_table_end_time": 255744684.34504557,
"spk_table_original_size": 3,
"ephemeris_times": [
255744599.02748165,
255744684.33197814,
255744684.34504557
],
"positions": [
[
3508.767882205483,
-1180.0905787748716,
-404.65806593586274
3508.7678823246983,
-1180.0905763309427,
-404.65807247785085
],
[
3509.6584138034805,
-1143.4324359444547,
-502.6029463187759
3504.3243485204953,
-1050.5094345826292,
-743.2474663998983
],
[
3509.443153282348,
-1124.8866548757137,
-551.4851113671583
3504.322049673533,
-1050.4890790873103,
-743.2990454930555
]
],
"Velocities": [
"velocities": [
[
0.07204008324341267,
1.4787375673363454,
-3.987265079143158
0.07204007846693458,
1.4787375689455564,
-3.9872650786018093
],
[
0.00039300972273872503,
1.5024971608516042,
-3.9781429683723304
-0.17588977444273826,
1.5577275009096896,
-3.9471504887872113
],
[
-0.03540185319107661,
1.5140837760075843,
-3.9728346759699815
]
-0.17592754964964083,
1.5577388421738825,
-3.947142539138405
]
],
"reference_frame": 1
},
"SunPosition": {
"SpkTableStartTime": 255744697.39357847,
"SpkTableEndTime": 255744697.39357847,
"SpkTableOriginalSize": 1,
"EphemerisTimes": [
255744697.39357847
],
"Positions": [
"sun_position": {
"spk_table_start_time": 255744697.38696516,
"spk_table_end_time": 255744697.38696516,
"spk_table_original_size": 1,
"ephemeris_times": [
255744697.38696516
],
"positions": [
[
97397666.49661352,
-201380879.84291452,
-94392949.82617083
99139014.67821987,
-200427816.2457205,
-94608347.52240176
]
],
"Velocities": [
"velocities": [
[
21.26085734409839,
7.173393107736484,
2.739595059792977
]
21.199131828075274,
7.3343154546823355,
2.7913498057574033
]
],
"reference_frame": 1
}
}
\ No newline at end of file
{
"isis_camera_version": 1,
"image_lines": 15088,
"image_samples": 1288,
"name_platform": "MARS EXPRESS",
"name_sensor": "MEX_HRSC_IR",
"reference_height": {
"maxheight": 1000,
"minheight": -1000,
"unit": "m"
},
"name_model": "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL",
"interpolation_method": "lagrange",
"line_scan_rate": [
[
0.5,
-98.36609682440758,
0.012800790786743165
],
[
6664.5,
-13.06160032749176,
0.012907449722290038
],
[
6665.5,
-13.048532903194427,
0.013227428436279297
]
],
"starting_ephemeris_time": 255744599.02748165,
"center_ephemeris_time": 255744697.39357847,
"radii": {
"semimajor": 3396.19,
"semiminor": 3376.2,
"unit": "km"
},
"body_rotation": {
"time_dependent_frames": [
10014,
1
],
"ck_table_start_time": 255744599.02748165,
"ck_table_end_time": 255744684.34504557,
"ck_table_original_size": 2,
"ephemeris_times": [
255744599.02748165,
255744684.34504557
],
"quaternions": [
[
-0.6525755651775765,
-0.023151423894873242,
0.3174415084303075,
-0.6876336466682659
],
[
-0.654651809237426,
-0.02219145654977925,
0.31751006120710407,
-0.6856572824309715
]
],
"angular_velocities": [
[
3.162398161513709e-05,
-2.8803031775991535e-05,
5.6520727317788564e-05
],
[
3.162398161489585e-05,
-2.8803031778668454e-05,
5.652072731655937e-05
]
],
"reference_frame": 1
},
"instrument_pointing": {
"time_dependent_frames": [
-41001,
1
],
"ck_table_start_time": 255744599.02748165,
"ck_table_end_time": 255744684.34504557,
"ck_table_original_size": 3,
"ephemeris_times": [
255744599.02748165,
255744684.33197814,
255744684.34504557
],
"quaternions": [
[
-0.34147103254256284,
0.4600620001156389,
-0.4826410643063962,
-0.662418367068051
],
[
-0.3659838104244632,
0.44394513387664625,
-0.4497912009709326,
-0.6831225689022163
],
[
-0.3659874882249891,
0.4439426152453299,
-0.4497860930062306,
-0.6831255985322837
]
],
"angular_velocities": [
[
0.0003517633111319437,
0.001015465002260446,
0.00038771759258420565
],
[
0.00035178320677913466,
0.001008400741447663,
0.0003885676589327302
],
[
0.0003517842276725049,
0.0010084000654699077,
0.00038856810918190424
]
],
"reference_frame": 1,
"constant_frames": [
-41210,
-41200,
-41000,
-41001
],
"constant_rotation": [
-0.9999999844629888,
1.027590578527487e-06,
0.00017627525841189352,
1.2246232944813223e-16,
-0.9999830090976747,
0.00582936668603668,
0.0001762782535384808,
0.0058293665954657434,
0.9999829935609271
]
},
"naif_keywords": {
"BODY499_RADII": [
3396.19,
3396.19,
3376.2
],
"BODY_FRAME_CODE": 10014,
"BODY_CODE": 499,
"INS-41210_FOV_FRAME": "MEX_HRSC_HEAD",
"FRAME_-41210_NAME": "MEX_HRSC_HEAD",
"INS-41210_CK_TIME_TOLERANCE": 1.0,
"TKFRAME_-41210_AXES": [
1.0,
2.0,
3.0
],
"TKFRAME_-41210_SPEC": "ANGLES",
"FRAME_-41210_CLASS": 4.0,
"INS-41210_FOV_ANGULAR_SIZE": [
0.2,
0.659734
],
"INS-41210_OD_K": [
0.0,
0.0,
0.0
],
"INS-41210_F/RATIO": 5.6,
"INS-41210_PLATFORM_ID": -41000.0,
"TKFRAME_-41210_ANGLES": [
-0.334,
0.0101,
0.0
],
"INS-41210_SPK_TIME_BIAS": 0.0,
"FRAME_-41210_CENTER": -41.0,
"TKFRAME_-41210_UNITS": "DEGREES",
"INS-41210_BORESIGHT": [
0.0,
0.0,
175.0
],
"INS-41210_CK_TIME_BIAS": 0.0,
"FRAME_-41210_CLASS_ID": -41210.0,
"INS-41210_IFOV": 4e-05,
"INS-41210_FOV_BOUNDARY_CORNERS": [
18.187,
60.0641,
175.0,
18.1281,
-60.0399,
175.0,
-18.1862,
-60.0435,
175.0,
-18.142
],
"INS-41210_FOV_SHAPE": "RECTANGLE",
"TKFRAME_-41210_RELATIVE": "MEX_HRSC_BASE",
"INS-41210_PIXEL_PITCH": 0.007,
"INS-41210_FOCAL_LENGTH": 175.0,
"BODY499_POLE_DEC": [
52.8865,
-0.0609,
0.0
],
"BODY499_POLE_RA": [
317.68143,
-0.1061,
0.0
],
"BODY499_PM": [
176.63,
350.89198226,
0.0
],
"INS-41218_ITRANSL": [
-7113.11359717265,
0.062856784318668,
142.857129028729
],
"INS-41218_ITRANSS": [
-0.778052433438109,
-142.857129028729,
0.062856784318668
],
"INS-41218_FOV_SHAPE": "RECTANGLE",
"INS-41218_PIXEL_SIZE": [
7.0,
7.0
],
"INS-41218_CK_REFERENCE_ID": 1.0,
"INS-41218_FOV_FRAME": "MEX_HRSC_HEAD",
"INS-41218_CCD_CENTER": [
2592.5,
0.5
],
"INS-41218_CK_FRAME_ID": -41001.0,
"INS-41218_F/RATIO": 5.6,
"INS-41218_PIXEL_SAMPLES": 5184.0,
"INS-41218_BORESIGHT_SAMPLE": 2592.5,
"INS-41218_FILTER_BANDWIDTH": 90.0,
"INS-41218_BORESIGHT_LINE": 0.0,
"INS-41218_PIXEL_LINES": 1.0,
"INS-41218_FOCAL_LENGTH": 174.82,
"INS-41218_FOV_ANGULAR_SIZE": [
0.2,
4e-05
],
"INS-41218_FILTER_BANDCENTER": 970.0,
"INS-41218_TRANSX": [
0.016461898406507,
-0.006999999322408,
3.079982431615e-06
],
"INS-41218_TRANSY": [
49.7917927568053,
3.079982431615e-06,
0.006999999322408
],
"INS-41218_FOV_BOUNDARY_CORNERS": [
18.1982,
49.9121,
175.0,
18.1982,
49.9051,
175.0,
-18.1693,
49.8901,
175.0,
-18.1693
],
"INS-41218_BORESIGHT": [
0.0151,
49.9039,
175.0
],
"INS-41218_IFOV": 4e-05
},
"detector_sample_summing": 4,
"detector_line_summing": 4,
"focal_length_model": {
"focal_length": 174.82
},
"detector_center": {
"line": 0.0,
"sample": 2592.0
},
"focal2pixel_lines": [
-7113.11359717265,
0.062856784318668,
142.857129028729
],
"focal2pixel_samples": [
-0.778052433438109,
-142.857129028729,
0.062856784318668
],
"optical_distortion": {
"radial": {
"coefficients": [
0.0,
0.0,
0.0
]
}
},
"starting_detector_line": 0,
"starting_detector_sample": 0,
"instrument_position": {
"spk_table_start_time": 255744599.02748165,
"spk_table_end_time": 255744684.34504557,
"spk_table_original_size": 3,
"ephemeris_times": [
255744599.02748165,
255744684.33197814,
255744684.34504557
],
"positions": [
[
3508.7678823246983,
-1180.0905763309427,
-404.65807247785085
],
[
3504.3243485204953,
-1050.5094345826292,
-743.2474663998983
],
[
3504.322049673533,
-1050.4890790873103,
-743.2990454930555
]
],
"velocities": [
[
0.07204007846693458,
1.4787375689455564,
-3.9872650786018093
],
[
-0.17588977444273826,
1.5577275009096896,
-3.9471504887872113
],
[
-0.17592754964964083,
1.5577388421738825,
-3.947142539138405
]
],
"reference_frame": 1
},
"sun_position": {
"spk_table_start_time": 255744697.39357847,
"spk_table_end_time": 255744697.39357847,
"spk_table_original_size": 1,
"ephemeris_times": [
255744697.39357847
],
"positions": [
[
99139014.81802115,
-200427816.19745806,
-94608347.50384377
]
],
"velocities": [
[
21.19913182204962,
7.334315465997904,
2.7913498135665433
]
],
"reference_frame": 1
}
}
\ No newline at end of file
......@@ -10,519 +10,6 @@ import ale
from ale.drivers.mex_drivers import MexHrscPds3NaifSpiceDriver, MexHrscIsisLabelNaifSpiceDriver, MexSrcPds3NaifSpiceDriver
@pytest.fixture()
def usgscsm_compare_dict():
return {
"h5270_0000_ir2" : {
"usgscsm" : {
"radii": {
"semimajor": 3396.19,
"semiminor": 3376.2,
"unit": "km"
},
"sensor_position": {
"positions": [
[
711902.968354,
3209827.60790571,
1748326.86116295
],
[
727778.89367768,
3287885.02005966,
1594882.70156054
],
[
743098.34408384,
3361360.97987664,
1439236.15929773
],
[
757817.60768561,
3430175.96634995,
1281609.7397002
],
[
771895.91691839,
3494268.82029183,
1122231.09675971
],
[
785295.6426853,
3553596.86562762,
961331.02292412
]
],
"velocities": [
[
396.19391017,
1971.70523609,
-3738.08862116
],
[
383.09225613,
1860.35892297,
-3794.8312507
],
[
368.88320115,
1746.8383078,
-3846.19171074
],
[
353.63635876,
1631.58973504,
-3892.0182367
],
[
337.42645506,
1515.06674438,
-3932.20958309
],
[
320.33289561,
1397.72243165,
-3966.71239887
]
],
"unit": "m"
},
"sun_position": {
"positions": [
[
2.05222074E+11,
1.19628335E+11,
5.02349719E+10
]
],
"velocities": [
[
8468758.54,
-14528713.8,
8703.55212
]
],
"unit": "m"
},
"sensor_orientation": {
"quaternions": [
[
-0.09146728,
-0.85085751,
0.51357522,
0.06257586
],
[
-0.09123532,
-0.83858882,
0.53326329,
0.0638371
],
[
-0.09097193,
-0.82586685,
0.55265188,
0.06514567
],
[
-0.09050679,
-0.81278131,
0.57165363,
0.06638667
],
[
-0.08988786,
-0.79935128,
0.59024631,
0.06757961
],
[
-0.08924306,
-0.78551905,
0.60849234,
0.06879366
]
]
},
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": 174.82
},
"detector_center": {
"line": 0.0,
"sample": 2592.0
},
"starting_detector_line": 0,
"starting_detector_sample": 0,
"focal2pixel_lines": [
-7113.11359717265,
0.062856784318668,
142.857129028729
],
"focal2pixel_samples": [
-0.778052433438109,
-142.857129028729,
0.062856784318668
],
"optical_distortion": {
"radial": {
"coefficients": [
0.0,
0.0,
0.0
]
}
},
"image_lines": 400,
"image_samples": 1288,
"name_platform": "MARS EXPRESS",
"name_sensor": "HIGH RESOLUTION STEREO CAMERA",
"reference_height": {
"maxheight": 1000,
"minheight": -1000,
"unit": "m"
},
"name_model": "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL",
"interpolation_method": "lagrange",
"line_scan_rate": [
[
0.5,
-94.88182842731476,
0.012800790786743165
],
[
15086.5,
101.82391116023064,
0.013227428436279297
]
],
"starting_ephemeris_time": 255744592.07217148,
"center_ephemeris_time": 255744693.90931007,
"t0_ephemeris": -101.83713859319687,
"dt_ephemeris": 40.734855437278746,
"t0_quaternion": -101.83713859319687,
"dt_quaternion": 40.734855437278746
},
"isis" :
{
"CameraVersion": 1,
"NaifKeywords": {
"BODY499_RADII": [
3396.19,
3396.19,
3376.2
],
"BODY_FRAME_CODE": 10014,
"BODY_CODE": 499,
"INS-41210_FOV_FRAME": "MEX_HRSC_HEAD",
"FRAME_-41210_NAME": "MEX_HRSC_HEAD",
"INS-41210_CK_TIME_TOLERANCE": 1.0,
"TKFRAME_-41210_AXES": [
1.0,
2.0,
3.0
],
"TKFRAME_-41210_SPEC": "ANGLES",
"FRAME_-41210_CLASS": 4.0,
"INS-41210_FOV_ANGULAR_SIZE": [
0.2,
0.659734
],
"INS-41210_OD_K": [
0.0,
0.0,
0.0
],
"INS-41210_F/RATIO": 5.6,
"INS-41210_PLATFORM_ID": -41000.0,
"TKFRAME_-41210_ANGLES": [
-0.334,
0.0101,
0.0
],
"INS-41210_SPK_TIME_BIAS": 0.0,
"FRAME_-41210_CENTER": -41.0,
"TKFRAME_-41210_UNITS": "DEGREES",
"INS-41210_BORESIGHT": [
0.0,
0.0,
175.0
],
"INS-41210_CK_TIME_BIAS": 0.0,
"FRAME_-41210_CLASS_ID": -41210.0,
"INS-41210_IFOV": 4e-05,
"INS-41210_FOV_BOUNDARY_CORNERS": [
18.187,
60.0641,
175.0,
18.1281,
-60.0399,
175.0,
-18.1862,
-60.0435,
175.0,
-18.142
],
"INS-41210_FOV_SHAPE": "RECTANGLE",
"TKFRAME_-41210_RELATIVE": "MEX_HRSC_BASE",
"INS-41210_PIXEL_PITCH": 0.007,
"INS-41210_FOCAL_LENGTH": 175.0,
"BODY499_POLE_DEC": [
52.8865,
-0.0609,
0.0
],
"BODY499_POLE_RA": [
317.68143,
-0.1061,
0.0
],
"BODY499_PM": [
176.63,
350.89198226,
0.0
],
"INS-41218_ITRANSL": [
-7113.11359717265,
0.062856784318668,
142.857129028729
],
"INS-41218_ITRANSS": [
-0.778052433438109,
-142.857129028729,
0.062856784318668
],
"INS-41218_FOV_SHAPE": "RECTANGLE",
"INS-41218_PIXEL_SIZE": [
7.0,
7.0
],
"INS-41218_CK_REFERENCE_ID": 1.0,
"INS-41218_FOV_FRAME": "MEX_HRSC_HEAD",
"INS-41218_CCD_CENTER": [
2592.5,
0.5
],
"INS-41218_CK_FRAME_ID": -41001.0,
"INS-41218_F/RATIO": 5.6,
"INS-41218_PIXEL_SAMPLES": 5184.0,
"INS-41218_BORESIGHT_SAMPLE": 2592.5,
"INS-41218_FILTER_BANDWIDTH": 90.0,
"INS-41218_BORESIGHT_LINE": 0.0,
"INS-41218_PIXEL_LINES": 1.0,
"INS-41218_FOCAL_LENGTH": 174.82,
"INS-41218_FOV_ANGULAR_SIZE": [
0.2,
4e-05
],
"INS-41218_FILTER_BANDCENTER": 970.0,
"INS-41218_TRANSX": [
0.016461898406507,
-0.006999999322408,
3.079982431615e-06
],
"INS-41218_TRANSY": [
49.7917927568053,
3.079982431615e-06,
0.006999999322408
],
"INS-41218_FOV_BOUNDARY_CORNERS": [
18.1982,
49.9121,
175.0,
18.1982,
49.9051,
175.0,
-18.1693,
49.8901,
175.0,
-18.1693
],
"INS-41218_BORESIGHT": [
0.0151,
49.9039,
175.0
],
"INS-41218_IFOV": 4e-05
},
"InstrumentPointing": {
"TimeDependentFrames": [
-41001,
1
],
"CkTableStartTime": 255744599.02748,
"CkTableEndTime": 255744635.91477,
"CkTableOriginalSize": 3,
"EphemerisTimes": [
255744599.02748,
255744623.61901,
255744635.91477
],
"Quaternions": [
[
-0.34147103206303764,
0.46006200041554185,
-0.48264106492774883,
-0.6624183666542334
],
[
-0.34862899148129517,
0.4555408857335137,
-0.47327265910130095,
-0.668545673735942
],
[
-0.3521802679309037,
0.45323805476596757,
-0.46855266563769715,
-0.6715673637959837
]
],
"AngularVelocity": [
[
0.00035176331113592204,
0.0010154650024473103,
0.00038771759244781866
],
[
0.00035242855802833725,
0.0010149701470475953,
0.0003878218830533074
],
[
0.0003502620823697415,
0.001017194110775444,
0.00038476436104443903
]
],
"ConstantFrames": [
-41210,
-41200,
-41000,
-41001
],
"ConstantRotation": [
-0.9999999844629888,
1.027590578527487e-06,
0.00017627525841189352,
1.2246232944813223e-16,
-0.9999830090976747,
0.00582936668603668,
0.0001762782535384808,
0.0058293665954657434,
0.9999829935609271
]
},
"BodyRotation": {
"TimeDependentFrames": [
10014,
1
],
"CkTableStartTime": 255744599.02748,
"CkTableEndTime": 255744635.91477,
"CkTableOriginalSize": 2,
"EphemerisTimes": [
255744599.02748,
255744635.91477
],
"Quaternions": [
[
-0.6525755651363003,
-0.0231514239139282,
0.3174415084289179,
-0.6876336467074378
],
[
-0.6534739684048748,
-0.022736404778153148,
0.31747150360998055,
-0.68677993048033
]
],
"AngularVelocity": [
[
3.1623981615137114e-05,
-2.8803031775991542e-05,
5.6520727317788564e-05
],
[
3.1623981615032794e-05,
-2.8803031777148914e-05,
5.6520727317257115e-05
]
]
},
"InstrumentPosition": {
"SpkTableStartTime": 255744599.02748,
"SpkTableEndTime": 255744635.91477,
"SpkTableOriginalSize": 3,
"EphemerisTimes": [
255744599.02748,
255744623.61901,
255744635.91477
],
"Positions": [
[
3508.767882205483,
-1180.0905787748716,
-404.65806593586274
],
[
3509.658413803481,
-1143.4324359444558,
-502.60294631877633
],
[
3509.443153282348,
-1124.8866548757137,
-551.4851113671589
]
],
"Velocities": [
[
0.07204008324341267,
1.4787375673363454,
-3.987265079143158
],
[
0.0003930097236827663,
1.5024971609204454,
-3.978142968522354
],
[
-0.03540185319249475,
1.5140837760766446,
-3.9728346761198696
]
]
},
"SunPosition": {
"SpkTableStartTime": 255744697.39357847,
"SpkTableEndTime": 255744697.39357847,
"SpkTableOriginalSize": 1,
"EphemerisTimes": [
255744697.39357847
],
"Positions": [
[
99139014.8191443,
-200427816.19676697,
-94608347.50413091
]
],
"Velocities": [
[
21.199131882686167,
7.334313602125272,
2.7913538260189816
]
]
}
}
}}
@pytest.fixture()
def test_mex_src_kernels(scope="module", autouse=True):
......@@ -552,10 +39,8 @@ def test_mex_src_load(test_mex_src_kernels):
# Eventually all label/formatter combinations should be tested. For now, isis3/usgscsm and
# pds3/isis will fail.
@pytest.mark.parametrize("label,formatter", [('isis3','isis'), ('pds3', 'usgscsm'),
pytest.param('isis3','usgscsm', marks=pytest.mark.xfail),
pytest.param('pds3','isis', marks=pytest.mark.xfail),])
def test_mex_load(test_mex_hrsc_kernels, formatter, usgscsm_compare_dict, label):
@pytest.mark.parametrize("label", [('isis3'), ('pds3')])
def test_mex_load(test_mex_hrsc_kernels, label):
label_file = get_image_label('h5270_0000_ir2', label)
with patch('ale.drivers.mex_drivers.MexHrscPds3NaifSpiceDriver.binary_ephemeris_times', \
......@@ -564,20 +49,24 @@ def test_mex_load(test_mex_hrsc_kernels, formatter, usgscsm_compare_dict, label)
new_callable=PropertyMock) as binary_exposure_durations, \
patch('ale.drivers.mex_drivers.MexHrscPds3NaifSpiceDriver.binary_lines', \
new_callable=PropertyMock) as binary_lines, \
patch('ale.drivers.mex_drivers.MexHrscIsisLabelNaifSpiceDriver.ephemeris_time', \
patch('ale.base.type_sensor.LineScanner.ephemeris_time', \
new_callable=PropertyMock) as ephemeris_time, \
patch('ale.drivers.mex_drivers.read_table_data', return_value=12345) as read_table_data, \
patch('ale.drivers.mex_drivers.parse_table', return_value={'EphemerisTime': [255744599.02748165, 255744684.33197814, 255744684.34504557], \
'ExposureTime': [0.012800790786743165, 0.012907449722290038, 0.013227428436279297], \
'LineStart': [1, 6665, 6666]}) as parse_table:
ephemeris_time.return_value = [255744599.02748, 255744623.61901, 255744635.91477]
ephemeris_time.return_value = [255744599.02748165, 255744684.33197814, 255744684.34504557]
binary_ephemeris_times.return_value = [255744599.02748165, 255744599.04028246, 255744795.73322123]
binary_exposure_durations.return_value = [0.012800790786743165, 0.012800790786743165, 0.013227428436279297]
binary_lines.return_value = [0.5, 1.5, 15086.5]
binary_lines.return_value = [0.5, 6664.5, 6665.5]
usgscsm_isd = ale.load(label_file, props={'kernels': test_mex_hrsc_kernels}, formatter=formatter)
assert compare_dicts(usgscsm_isd, usgscsm_compare_dict['h5270_0000_ir2'][formatter]) == []
usgscsm_isd = ale.load(label_file, props={'kernels': test_mex_hrsc_kernels})
if label == "isis3":
compare_isd = get_isd('mexhrsc_isis')
else:
compare_isd = get_isd('mexhrsc')
assert compare_dicts(usgscsm_isd, compare_isd) == []
# ========= Test mex pds3label and naifspice driver =========
class test_mex_pds3_naif(unittest.TestCase):
......@@ -589,9 +78,6 @@ class test_mex_pds3_naif(unittest.TestCase):
def test_short_mission_name(self):
assert self.driver.short_mission_name=='mex'
def test_odtk(self):
assert self.driver.odtk == [0.0, 0.0, 0.0]
def test_ikid(self):
with patch('ale.drivers.mex_drivers.spice.bods2c', return_value=12345) as bods2c:
assert self.driver.ikid == 12345
......@@ -726,7 +212,7 @@ class test_mex_isis3_naif(unittest.TestCase):
'ExposureTime': [0.012800790786743165, 0.012907449722290038, 0.013227428436279297], \
'LineStart': [1, 6665, 6666]}) as parse_table:
assert self.driver.line_scan_rate == ([1, 6665, 6666], [255744599.02748165, 255744684.33197814, 255744684.34504557], [0.012800790786743165, 0.012907449722290038, 0.013227428436279297])
assert self.driver.line_scan_rate == ([0.5, 6664.5, 6665.5], [-98.36609682440758, -13.06160032749176, -13.048532903194427], [0.012800790786743165, 0.012907449722290038, 0.013227428436279297])
def test_ephemeris_stop_time(self):
with patch('ale.drivers.mex_drivers.read_table_data', return_value=12345) as read_table_data, \
......@@ -757,9 +243,6 @@ class test_mex_src_pds3_naif(unittest.TestCase):
def test_short_mission_name(self):
assert self.driver.short_mission_name=='mex'
def test_odtk(self):
assert self.driver.odtk == [0.0, 0.0, 0.0]
def test_ikid(self):
with patch('ale.drivers.mex_drivers.spice.bods2c', return_value=12345) as bods2c:
assert self.driver.ikid == 12345
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment