Skip to content
Snippets Groups Projects
Commit 10d42f5b authored by acpaquette's avatar acpaquette
Browse files

Mgs time bias (#538)

* Updated disclaimer for release

* Handle MGS time bias for NAC and WAC

* Re-enabled MGS drivers

* Updated changelog
parent d76724c8
Branches
Tags
No related merge requests found
...@@ -35,6 +35,10 @@ release. ...@@ -35,6 +35,10 @@ release.
## [Unreleased] ## [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)
- MGS drivers now account for a time bias in the ephemeris data [#538](https://github.com/DOI-USGS/ale/pull/538)
## [0.9.0] - 2023-04-19 ## [0.9.0] - 2023-04-19
### Fixed ### Fixed
......
...@@ -359,7 +359,6 @@ class Driver(): ...@@ -359,7 +359,6 @@ class Driver():
self._projection = "" self._projection = ""
return self._projection return self._projection
@property @property
def geotransform(self): def geotransform(self):
if not hasattr(self, "_geotransform"): if not hasattr(self, "_geotransform"):
......
...@@ -428,7 +428,8 @@ class NaifSpice(): ...@@ -428,7 +428,8 @@ class NaifSpice():
target_frame=self.target_frame_id, target_frame=self.target_frame_id,
center_ephemeris_time=self.center_ephemeris_time, center_ephemeris_time=self.center_ephemeris_time,
ephemeris_times=self.ephemeris_time, ephemeris_times=self.ephemeris_time,
nadir=nadir, exact_ck_times=exact_ck_times) nadir=nadir, exact_ck_times=exact_ck_times,
inst_time_bias=self.instrument_time_bias)
if nadir: if nadir:
# Logic for nadir calculation was taken from ISIS3 # Logic for nadir calculation was taken from ISIS3
...@@ -589,3 +590,17 @@ class NaifSpice(): ...@@ -589,3 +590,17 @@ class NaifSpice():
pass pass
return self._naif_keywords return self._naif_keywords
@property
def instrument_time_bias(self):
"""
Time bias used for generating sensor orientations
The default is 0 for not time bias
Returns
-------
: int
Time bias in ephemeris time
"""
return 0
\ No newline at end of file
...@@ -130,6 +130,20 @@ class MgsMocNarrowAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, Na ...@@ -130,6 +130,20 @@ class MgsMocNarrowAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, Na
""" """
return [0, 0.0131240578522949, 0.0131240578522949] return [0, 0.0131240578522949, 0.0131240578522949]
@property
def instrument_time_bias(self):
"""
Defines the time bias for Mars Global Survayor instrument rotation information.
This shifts the sensor orientation window back by 1.15 seconds in ephemeris time.
Returns
-------
: int
Time bias adjustment
"""
return -1.15
class MgsMocWideAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialDistortion, Driver): class MgsMocWideAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialDistortion, Driver):
""" """
Driver for reading MGS MOC WA ISIS labels. Driver for reading MGS MOC WA ISIS labels.
...@@ -268,3 +282,17 @@ class MgsMocWideAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, Naif ...@@ -268,3 +282,17 @@ class MgsMocWideAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, Naif
return [0, -.007, .007] return [0, -.007, .007]
else: else:
return [0, .007, .007] return [0, .007, .007]
@property
def instrument_time_bias(self):
"""
Defines the time bias for Mars Global Survayor instrument rotation information.
This shifts the sensor orientation window back by 1.15 seconds in ephemeris time.
Returns
-------
: int
Time bias adjustment
"""
return -1.15
...@@ -96,7 +96,7 @@ class FrameChain(nx.DiGraph): ...@@ -96,7 +96,7 @@ class FrameChain(nx.DiGraph):
of frame rotations in the frame chain of frame rotations in the frame chain
""" """
@classmethod @classmethod
def from_spice(cls, sensor_frame, target_frame, center_ephemeris_time, ephemeris_times=[], nadir=False, exact_ck_times=False): def from_spice(cls, sensor_frame, target_frame, center_ephemeris_time, ephemeris_times=[], nadir=False, exact_ck_times=False, inst_time_bias=0):
frame_chain = cls() frame_chain = cls()
sensor_times = [] sensor_times = []
# Default assume one time # Default assume one time
...@@ -106,7 +106,7 @@ class FrameChain(nx.DiGraph): ...@@ -106,7 +106,7 @@ class FrameChain(nx.DiGraph):
if exact_ck_times and len(ephemeris_times) > 1 and not nadir: if exact_ck_times and len(ephemeris_times) > 1 and not nadir:
try: try:
sensor_times = cls.extract_exact_ck_times(ephemeris_times[0], ephemeris_times[-1], sensor_frame) sensor_times = cls.extract_exact_ck_times(ephemeris_times[0] + inst_time_bias, ephemeris_times[-1] + inst_time_bias, sensor_frame)
except Exception as e: except Exception as e:
pass pass
...@@ -123,8 +123,8 @@ class FrameChain(nx.DiGraph): ...@@ -123,8 +123,8 @@ class FrameChain(nx.DiGraph):
constant_frames.extend(target_constant_frames) constant_frames.extend(target_constant_frames)
frame_chain.compute_time_dependent_rotiations(sensor_time_dependent_frames, sensor_times) frame_chain.compute_time_dependent_rotiations(sensor_time_dependent_frames, sensor_times, inst_time_bias)
frame_chain.compute_time_dependent_rotiations(target_time_dependent_frames, target_times) frame_chain.compute_time_dependent_rotiations(target_time_dependent_frames, target_times, 0)
for s, d in constant_frames: for s, d in constant_frames:
quats = np.zeros(4) quats = np.zeros(4)
...@@ -380,7 +380,7 @@ class FrameChain(nx.DiGraph): ...@@ -380,7 +380,7 @@ class FrameChain(nx.DiGraph):
return times return times
def compute_time_dependent_rotiations(self, frames, times): def compute_time_dependent_rotiations(self, frames, times, time_bias):
""" """
Computes the time dependent rotations based on a list of tuples that define the Computes the time dependent rotations based on a list of tuples that define the
relationships between frames as (source, destination) and a list of times to relationships between frames as (source, destination) and a list of times to
...@@ -409,5 +409,6 @@ class FrameChain(nx.DiGraph): ...@@ -409,5 +409,6 @@ class FrameChain(nx.DiGraph):
if not avs: if not avs:
avs = None avs = None
rotation = TimeDependentRotation(quats, times, s, d, av=avs) biased_times = [time - time_bias for time in times]
rotation = TimeDependentRotation(quats, biased_times, s, d, av=avs)
self.add_edge(rotation=rotation) self.add_edge(rotation=rotation)
\ No newline at end of file
...@@ -70,90 +70,97 @@ ...@@ -70,90 +70,97 @@
-94000, -94000,
1 1
], ],
"ck_table_start_time": -69382819.71598774, "ck_table_start_time": -69382822.56598744,
"ck_table_end_time": -69382511.7160111, "ck_table_end_time": -69382510.5660111,
"ck_table_original_size": 78, "ck_table_original_size": 79,
"ephemeris_times": [ "ephemeris_times": [
-69382819.71598774, -69382822.56598744,
-69382815.71598805, -69382818.56598774,
-69382811.71598835, -69382814.56598805,
-69382807.71598867, -69382810.56598835,
-69382803.71598896, -69382806.56598866,
-69382799.71598926, -69382802.56598896,
-69382795.71598957, -69382798.56598926,
-69382791.71598987, -69382794.56598957,
-69382787.71599017, -69382790.56598987,
-69382783.71599048, -69382786.56599016,
-69382779.71599078, -69382782.56599048,
-69382775.7159911, -69382778.56599078,
-69382771.7159914, -69382774.56599109,
-69382767.71599169, -69382770.56599139,
-69382763.715992, -69382766.56599168,
-69382759.7159923, -69382762.565992,
-69382755.7159926, -69382758.5659923,
-69382751.71599291, -69382754.5659926,
-69382747.71599321, -69382750.5659929,
-69382743.71599352, -69382746.5659932,
-69382739.71599382, -69382742.56599352,
-69382735.71599412, -69382738.56599382,
-69382731.71599443, -69382734.56599411,
-69382727.71599473, -69382730.56599443,
-69382723.71599503, -69382726.56599472,
-69382719.71599534, -69382722.56599502,
-69382715.71599564, -69382718.56599534,
-69382711.71599595, -69382714.56599563,
-69382707.71599625, -69382710.56599595,
-69382703.71599655, -69382706.56599624,
-69382699.71599686, -69382702.56599654,
-69382695.71599716, -69382698.56599686,
-69382691.71599746, -69382694.56599715,
-69382687.71599777, -69382690.56599745,
-69382683.71599805, -69382686.56599776,
-69382679.71599837, -69382682.56599805,
-69382675.71599866, -69382678.56599836,
-69382671.71599896, -69382674.56599866,
-69382667.71599928, -69382670.56599896,
-69382663.71599957, -69382666.56599927,
-69382659.71599987, -69382662.56599957,
-69382655.71600018, -69382658.56599987,
-69382651.71600048, -69382654.56600018,
-69382647.71600078, -69382650.56600048,
-69382643.7160011, -69382646.56600077,
-69382639.71600139, -69382642.56600109,
-69382635.7160017, -69382638.56600139,
-69382631.716002, -69382634.5660017,
-69382627.7160023, -69382630.566002,
-69382623.71600261, -69382626.5660023,
-69382619.71600291, -69382622.5660026,
-69382615.71600321, -69382618.5660029,
-69382611.71600352, -69382614.5660032,
-69382607.71600382, -69382610.56600352,
-69382603.71600413, -69382606.56600381,
-69382599.71600443, -69382602.56600413,
-69382595.71600473, -69382598.56600443,
-69382591.71600504, -69382594.56600472,
-69382587.71600534, -69382590.56600504,
-69382583.71600564, -69382586.56600533,
-69382579.71600595, -69382582.56600563,
-69382575.71600625, -69382578.56600595,
-69382571.71600656, -69382574.56600624,
-69382567.71600686, -69382570.56600656,
-69382563.71600716, -69382566.56600685,
-69382559.71600747, -69382562.56600715,
-69382555.71600777, -69382558.56600747,
-69382551.71600807, -69382554.56600776,
-69382547.71600838, -69382550.56600806,
-69382543.71600868, -69382546.56600837,
-69382539.71600899, -69382542.56600867,
-69382535.71600929, -69382538.56600899,
-69382531.71600959, -69382534.56600928,
-69382527.7160099, -69382530.56600958,
-69382523.7160102, -69382526.5660099,
-69382519.7160105, -69382522.56601019,
-69382515.71601081, -69382518.56601049,
-69382511.7160111 -69382514.5660108,
-69382510.5660111
], ],
"quaternions": [ "quaternions": [
[
-0.23708037152577427,
0.06913949189951372,
0.9353535261221577,
0.2532319278209684
],
[ [
-0.23957495682735272, -0.23957495682735272,
0.06980832265124022, 0.06980832265124022,
...@@ -624,6 +631,11 @@ ...@@ -624,6 +631,11 @@
] ]
], ],
"angular_velocities": [ "angular_velocities": [
[
-1.3243650720946794e-05,
-0.001147942524828248,
-0.0006765182794334033
],
[ [
-1.4192050960089805e-05, -1.4192050960089805e-05,
-0.001149540028905371, -0.001149540028905371,
......
...@@ -140,7 +140,7 @@ class test_cassini_pds3_naif(unittest.TestCase): ...@@ -140,7 +140,7 @@ class test_cassini_pds3_naif(unittest.TestCase):
target_frame_id.return_value = -800 target_frame_id.return_value = -800
frame_chain = self.driver.frame_chain frame_chain = self.driver.frame_chain
assert len(frame_chain.nodes()) == 0 assert len(frame_chain.nodes()) == 0
from_spice.assert_called_with(center_ephemeris_time=2.4, ephemeris_times=[2.4], nadir=False, sensor_frame=14082360, target_frame=-800, exact_ck_times=True) from_spice.assert_called_with(center_ephemeris_time=2.4, ephemeris_times=[2.4], nadir=False, sensor_frame=14082360, target_frame=-800, exact_ck_times=True, inst_time_bias=0)
# ========= Test cassini isislabel and naifspice driver ========= # ========= Test cassini isislabel and naifspice driver =========
class test_cassini_isis_naif(unittest.TestCase): class test_cassini_isis_naif(unittest.TestCase):
...@@ -212,4 +212,4 @@ class test_cassini_isis_naif(unittest.TestCase): ...@@ -212,4 +212,4 @@ class test_cassini_isis_naif(unittest.TestCase):
target_frame_id.return_value = -800 target_frame_id.return_value = -800
frame_chain = self.driver.frame_chain frame_chain = self.driver.frame_chain
assert len(frame_chain.nodes()) == 0 assert len(frame_chain.nodes()) == 0
from_spice.assert_called_with(center_ephemeris_time=2.4000000000000004, ephemeris_times=[2.4000000000000004], nadir=False, sensor_frame=14082360, target_frame=-800, exact_ck_times=True) from_spice.assert_called_with(center_ephemeris_time=2.4000000000000004, ephemeris_times=[2.4000000000000004], nadir=False, sensor_frame=14082360, target_frame=-800, exact_ck_times=True, inst_time_bias=0)
...@@ -44,7 +44,6 @@ def test_wac_load(test_wac_kernels): ...@@ -44,7 +44,6 @@ def test_wac_load(test_wac_kernels):
isd_str = ale.loads(label_file, props={'kernels': test_wac_kernels}) isd_str = ale.loads(label_file, props={'kernels': test_wac_kernels})
isd_obj = json.loads(isd_str) isd_obj = json.loads(isd_str)
print(json.dumps(isd_obj, indent=2))
assert compare_dicts(isd_obj, compare_dict) == [] assert compare_dicts(isd_obj, compare_dict) == []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment