diff --git a/ale/drivers/lro_drivers.py b/ale/drivers/lro_drivers.py index c49c7e7c985565ae7795d9f607ca84415328c55c..a52eecd0cb91bedbc8c6e0968f2910571d0fba93 100644 --- a/ale/drivers/lro_drivers.py +++ b/ale/drivers/lro_drivers.py @@ -137,3 +137,77 @@ class LroLrocPds3LabelNaifSpiceDriver(NaifSpice, Pds3Label, LineScanner, Driver) for the different options available. """ return 'NONE' + + @property + def ephemeris_start_time(self): + """ + The starting ephemeris time for LRO is computed by taking the + LRO:SPACECRAFT_CLOCK_PREROLL_COUNT, as defined in the label, and + adding offsets that were taken from an IAK. + ------- + : double + Starting ephemeris time of the image + """ + start_time = spice.scs2e(self.spacecraft_id, self.label['LRO:SPACECRAFT_CLOCK_PREROLL_COUNT']) + return start_time + self.constant_time_offset + self.additional_preroll * self.exposure_duration + + @property + def exposure_duration(self): + """ + Takes the exposure_duration defined in a parent class and adds + offsets taken from an IAK. + + Returns + ------- + : float + Returns the exposure duration in seconds. + """ + return super().exposure_duration * (1 + self.multiplicative_line_error) + self.additive_line_error + + @property + def multiplicative_line_error(self): + """ + Returns the multiplicative line error defined in an IAK. + + Returns + ------- + : float + Returns the multiplicative line error. + """ + return 0.0045 + + @property + def additive_line_error(self): + """ + Returns the additive line error defined in an IAK. + + Returns + ------- + : float + Returns the additive line error. + """ + return 0.0 + + @property + def constant_time_offset(self): + """ + Returns the constant time offset defined in an IAK. + + Returns + ------- + : float + Returns the constant time offset. + """ + return 0.0 + + @property + def additional_preroll(self): + """ + Returns the addition preroll defined in an IAK. + + Returns + ------- + : float + Returns the additionl preroll. + """ + return 1024.0 diff --git a/tests/pytests/test_lro_drivers.py b/tests/pytests/test_lro_drivers.py index 6ce68dac40b703f95137f0a6b28f22c3d4b8b978..5a39108365a21d89539cdeafcc94caf1fb29aeec 100644 --- a/tests/pytests/test_lro_drivers.py +++ b/tests/pytests/test_lro_drivers.py @@ -54,3 +54,13 @@ def test_odtk(driver): def test_usgscsm_distortion_model(driver): distortion_model = driver.usgscsm_distortion_model assert distortion_model['lrolrocnac']['coefficients'] == [1.0] + +@patch('ale.base.label_pds3.Pds3Label.instrument_host_id', 'LRO') +@patch('ale.drivers.lro_drivers.LroLrocPds3LabelNaifSpiceDriver.exposure_duration', 1) +def test_ephemeris_start_time(driver): + with patch.dict(driver.label, {'LRO:SPACECRAFT_CLOCK_PREROLL_COUNT':'1'}) as f: + assert driver.ephemeris_start_time == 1024.1 + +@patch('ale.base.label_pds3.Pds3Label.exposure_duration', 1) +def test_exposure_duration(driver): + assert driver.exposure_duration == 1.0045