Skip to content
Snippets Groups Projects
Commit 1cb73043 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files

updated tests to enforce required keys

parent bf88b625
No related branches found
No related tags found
No related merge requests found
...@@ -111,6 +111,10 @@ class PDS3(): ...@@ -111,6 +111,10 @@ class PDS3():
self._sensor_velocity = eph_rates self._sensor_velocity = eph_rates
self._sensor_position = eph self._sensor_position = eph
@property
def focal_plane_tempature(self):
return self.label['FOCAL_PLANE_TEMPERATURE'].value
@property @property
def label(self): def label(self):
if not hasattr(self, "_label"): if not hasattr(self, "_label"):
...@@ -159,6 +163,10 @@ class PDS3(): ...@@ -159,6 +163,10 @@ class PDS3():
def _target_id(self): def _target_id(self):
return spice.bodn2c(self.label['TARGET_NAME']) return spice.bodn2c(self.label['TARGET_NAME'])
@property
def focal_epsilon(self):
return float(spice.gdpool('INS{}_FL_UNCERTAINTY'.format(self.ikid), 0, 1)[0])
@property @property
def starting_ephemeris_time(self): def starting_ephemeris_time(self):
if not hasattr(self, '_starting_ephemeris_time'): if not hasattr(self, '_starting_ephemeris_time'):
......
...@@ -30,7 +30,7 @@ class CassiniISS(Framer): ...@@ -30,7 +30,7 @@ class CassiniISS(Framer):
@property @property
def instrument_id(self): def instrument_id(self):
return self.id_lookup[self._label['INSTRUMENT_ID']] return self.id_lookup[self.label['INSTRUMENT_ID']]
@property @property
def focal_epsilon(self): def focal_epsilon(self):
...@@ -54,7 +54,7 @@ class CassiniISS(Framer): ...@@ -54,7 +54,7 @@ class CassiniISS(Framer):
@property @property
def _exposure_duration(self): def _exposure_duration(self):
# labels do not specify a unit explicitly # labels do not specify a unit explicitly
return self._label['EXPOSURE_DURATION'] * 0.001 # Scale to seconds return self.label['EXPOSURE_DURATION'] * 0.001 # Scale to seconds
@property @property
def odtk(self): def odtk(self):
......
base = { base = {
'name_model' 'name_model',
'center_ephemeris_time', 'center_ephemeris_time',
'detector_center', 'detector_center',
'detector_line_summing', 'detector_line_summing',
'detector_sample_summing', 'detector_sample_summing',
'dt_ephemeris',
'dt_quaternion',
'ending_ephemeris_time', 'ending_ephemeris_time',
'exposure_duration', 'exposure_duration',
'focal2pixel_lines', 'focal2pixel_lines',
'focal2pixel_samples', 'focal2pixel_samples',
'focal_epsilon', 'focal_epsilon',
'focal_length', 'focal_length',
'focal_plane_tempature',
'id_lookup',
'ikid', 'ikid',
'image_lines', 'image_lines',
'image_samples', 'image_samples',
...@@ -57,6 +53,10 @@ framer = { ...@@ -57,6 +53,10 @@ framer = {
'filter_number', 'filter_number',
} }
temp_dep_focal_legth = {
'focal_plane_tempature'
}
linescanner = { linescanner = {
'line_exposure_duration', 'line_exposure_duration',
'line_scan_rate', 'line_scan_rate',
......
...@@ -11,7 +11,7 @@ from ale.drivers import keys ...@@ -11,7 +11,7 @@ from ale.drivers import keys
class LrocSpice(Spice, LineScanner): class LrocSpice(Spice, LineScanner):
required_keys = keys.base | keys.framer required_keys = keys.base | keys.linescanner
@property @property
def metakernel(self): def metakernel(self):
...@@ -31,10 +31,10 @@ class LroPds3Driver(PDS3, LrocSpice): ...@@ -31,10 +31,10 @@ class LroPds3Driver(PDS3, LrocSpice):
Ignores Wide Angle for now Ignores Wide Angle for now
""" """
instrument = self._label.get("INSTRUMENT_ID") instrument = self.label.get("INSTRUMENT_ID")
# should be left or right # should be left or right
frame_id = self._label.get("FRAME_ID") frame_id = self.label.get("FRAME_ID")
if instrument == "LROC" and frame_id == "LEFT": if instrument == "LROC" and frame_id == "LEFT":
return "LRO_LROCNACL" return "LRO_LROCNACL"
......
...@@ -18,7 +18,7 @@ class MdisSpice(Spice, Framer): ...@@ -18,7 +18,7 @@ class MdisSpice(Spice, Framer):
'MERCURY DUAL IMAGING SYSTEM WIDE ANGLE CAMERA':'MSGR_MDIS_WAC' 'MERCURY DUAL IMAGING SYSTEM WIDE ANGLE CAMERA':'MSGR_MDIS_WAC'
} }
required_keys = keys.base | keys.framer | keys.filter | keys.transverse_distortion required_keys = keys.base | keys.framer | keys.filter | keys.transverse_distortion | keys.temp_dep_focal_legth
@property @property
def metakernel(self): def metakernel(self):
...@@ -43,10 +43,6 @@ class MdisSpice(Spice, Framer): ...@@ -43,10 +43,6 @@ class MdisSpice(Spice, Framer):
# eval at the focal_plane_tempature # eval at the focal_plane_tempature
return f_t(self.focal_plane_tempature) return f_t(self.focal_plane_tempature)
@property
def focal_epsilon(self):
return float(spice.gdpool('INS{}_FL_UNCERTAINTY'.format(self.ikid), 0, 1)[0])
@property @property
def starting_detector_sample(self): def starting_detector_sample(self):
return int(spice.gdpool('INS{}_FPUBIN_START_SAMPLE'.format(self.ikid), 0, 1)[0]) return int(spice.gdpool('INS{}_FPUBIN_START_SAMPLE'.format(self.ikid), 0, 1)[0])
...@@ -59,11 +55,7 @@ class MdisSpice(Spice, Framer): ...@@ -59,11 +55,7 @@ class MdisSpice(Spice, Framer):
class MdisPDS3Driver(PDS3, MdisSpice): class MdisPDS3Driver(PDS3, MdisSpice):
@property @property
def instrument_id(self): def instrument_id(self):
return self.id_lookup[self._label['INSTRUMENT_ID']] return self.id_lookup[self.label['INSTRUMENT_ID']]
@property
def focal_plane_tempature(self):
return self._label['FOCAL_PLANE_TEMPERATURE'].value
class MdisIsis3Driver(Isis3, MdisSpice): class MdisIsis3Driver(Isis3, MdisSpice):
...@@ -79,8 +71,8 @@ class MdisIsis3Driver(Isis3, MdisSpice): ...@@ -79,8 +71,8 @@ class MdisIsis3Driver(Isis3, MdisSpice):
@property @property
def instrument_id(self): def instrument_id(self):
return self.id_lookup[self._label['IsisCube']['Instrument']['InstrumentId']] return self.id_lookup[self.label['IsisCube']['Instrument']['InstrumentId']]
@property @property
def focal_plane_tempature(self): def focal_plane_tempature(self):
return self._label['IsisCube']['Instrument']['FocalPlaneTemperature'].value return self.label['IsisCube']['Instrument']['FocalPlaneTemperature'].value
...@@ -32,15 +32,15 @@ class CtxSpice(Spice, LineScanner): ...@@ -32,15 +32,15 @@ class CtxSpice(Spice, LineScanner):
class CtxPds3Driver(PDS3, CtxSpice): class CtxPds3Driver(PDS3, CtxSpice):
@property @property
def instrument_id(self): def instrument_id(self):
return self.id_lookup[self._label['INSTRUMENT_NAME']] return self.id_lookup[self.label['INSTRUMENT_NAME']]
@property @property
def spacecraft_name(self): def spacecraft_name(self):
name_lookup = { name_lookup = {
'MARS_RECONNAISSANCE_ORBITER': 'MRO' 'MARS_RECONNAISSANCE_ORBITER': 'MRO'
} }
return name_lookup[self._label['SPACECRAFT_NAME']] return name_lookup[self.label['SPACECRAFT_NAME']]
@property @property
def instrument_id(self): def instrument_id(self):
return self.id_lookup[self._label['INSTRUMENT_NAME']] return self.id_lookup[self.label['INSTRUMENT_NAME']]
...@@ -115,3 +115,4 @@ def test_lro_creation(lro_lroclabel): ...@@ -115,3 +115,4 @@ def test_lro_creation(lro_lroclabel):
with LroPds3Driver(lro_lroclabel) as m: with LroPds3Driver(lro_lroclabel) as m:
d = m.to_dict() d = m.to_dict()
assert isinstance(d, dict) assert isinstance(d, dict)
assert(set(d.keys()) == m.required_keys)
...@@ -247,3 +247,4 @@ def test_mdis_creation(mdislabel): ...@@ -247,3 +247,4 @@ def test_mdis_creation(mdislabel):
with MdisPDS3Driver(mdislabel) as m: with MdisPDS3Driver(mdislabel) as m:
d = m.to_dict() d = m.to_dict()
assert isinstance(d, dict) assert isinstance(d, dict)
assert(set(d.keys()) == m.required_keys)
...@@ -62,7 +62,8 @@ def mroctx_label(): ...@@ -62,7 +62,8 @@ def mroctx_label():
END""" END"""
def test_get_dict(mroctx_label): def test_ctx_creation(mroctx_label):
with CtxPds3Driver(mroctx_label) as m: with CtxPds3Driver(mroctx_label) as m:
d = m.to_dict() d = m.to_dict()
assert isinstance(d, dict) assert isinstance(d, dict)
assert(set(d.keys()) == m.required_keys)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment