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

Kaguyami fix (#599)

* Kaguya mi ephemeris time fix

* Removed commented out stop time

* Fixed doc string and lazy load for ephemeris_start_time

* Updated kaguya mi tests with new ephemeris times

* Added changelog entry

* Removed commented out code
parent e53abf4b
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,7 @@ release.
- Fixed missing sensor_model_version attribute on NewHorizonsLorriIsisLabelNaifSpiceDriver [#583](https://github.com/DOI-USGS/ale/pull/583)
- Fixed missing sensor_model_version attribute on VikingIsisLabelNaifSpiceDriver [#583](https://github.com/DOI-USGS/ale/pull/583)
- Fixed incorrect distortion look up in Orex camera when working with PolyCam images [#583](https://github.com/DOI-USGS/ale/pull/583)
- Brought timing in line with ISIS for the KaguyaMiIsisLabelNaifSpiceDriver [#599](https://github.com/DOI-USGS/ale/pull/599)
## [0.10.0] - 2024-01-08
......
import spiceypy as spice
from ale.base import Driver
......@@ -1154,62 +1155,21 @@ class KaguyaMiIsisLabelNaifSpiceDriver(LineScanner, NaifSpice, IsisLabel, Kaguya
"""
return 2
@property
def spacecraft_clock_start_count(self):
"""
The original SC_CLOCK_START_COUNT key is often incorrect and cannot be trusted.
Therefore we get this information from CORRECTED_SC_CLOCK_START_COUNT
Returns
-------
: float
spacecraft clock start count in seconds
"""
return self.label['IsisCube']['Instrument']['CorrectedScClockStartCount'].value
@property
def spacecraft_clock_stop_count(self):
"""
The original SC_CLOCK_START_COUNT key is often incorrect and cannot be trusted.
Therefore we get this information from CORRECTED_SC_CLOCK_STOP_COUNT
Returns
-------
: float
spacecraft clock start count in seconds
"""
return self.label['IsisCube']['Instrument']['CorrectedScClockStopCount'].value
@property
def ephemeris_start_time(self):
"""
Returns the ephemeris start time of the image. Expects spacecraft_id to
be defined. This should be the integer naif ID code of the spacecraft.
Returns the start ephemeris time for the image. Expects utc_start_time to
be defined.
Returns
-------
: float
ephemeris start time of the image
start time
"""
if not hasattr(self, "_ephemeris_start_time"):
self._ephemeris_start_time = spice.sct2e(self.spacecraft_id, self.spacecraft_clock_start_count)
self._ephemeris_start_time = spice.str2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f"))
return self._ephemeris_start_time
@property
def ephemeris_stop_time(self):
"""
Returns the ephemeris start time of the image. Expects spacecraft_id to
be defined. This should be the integer naif ID code of the spacecraft.
Returns
-------
: float
ephemeris start time of the image
"""
if not hasattr(self, "_ephemeris_stop_time"):
self._ephemeris_stop_time = spice.sct2e(self.spacecraft_id, self.spacecraft_clock_stop_count)
return self._ephemeris_stop_time
@property
def sensor_frame_id(self):
"""
......@@ -1226,7 +1186,6 @@ class KaguyaMiIsisLabelNaifSpiceDriver(LineScanner, NaifSpice, IsisLabel, Kaguya
self._sensor_frame_id = spice.namfrm(f"LISM_MI_{spectra}_HEAD")
return self._sensor_frame_id
@property
def detector_center_line(self):
"""
......
This diff is collapsed.
......@@ -134,16 +134,15 @@ class test_kaguyami_isis3_naif(unittest.TestCase):
assert self.driver.spacecraft_name == 'KAGUYA'
def test_spacecraft_clock_start_count(self):
assert self.driver.spacecraft_clock_start_count == 905631021.135959
assert self.driver.spacecraft_clock_start_count == '905631021.132'
def test_spacecraft_clock_stop_count(self):
assert self.driver.spacecraft_clock_stop_count == 905631033.576935
assert self.driver.spacecraft_clock_stop_count == '905631033.574'
def test_ephemeris_start_time(self):
with patch('ale.drivers.selene_drivers.spice.sct2e', return_value=12345) as sct2e, \
patch('ale.drivers.selene_drivers.spice.bods2c', return_value=-12345) as bods2c:
with patch('ale.drivers.selene_drivers.spice.str2et', return_value=12345) as str2et:
assert self.driver.ephemeris_start_time == 12345
sct2e.assert_called_with(-12345, 905631021.135959)
str2et.assert_called_with('2008-09-16 20:10:30.480257')
def test_detector_center_line(self):
with patch('ale.drivers.selene_drivers.spice.gdpool', return_value=np.array([54321, 12345])) as gdpool, \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment