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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@ 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)
- 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

### Fixed
+0 −1
Original line number Diff line number Diff line
@@ -359,7 +359,6 @@ class Driver():
              self._projection = "" 
        return self._projection
    

    @property 
    def geotransform(self):
        if not hasattr(self, "_geotransform"): 
+16 −1
Original line number Diff line number Diff line
@@ -428,7 +428,8 @@ class NaifSpice():
                                                      target_frame=self.target_frame_id,
                                                      center_ephemeris_time=self.center_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:
                # Logic for nadir calculation was taken from ISIS3
@@ -589,3 +590,17 @@ class NaifSpice():
                pass

        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
+28 −0
Original line number Diff line number Diff line
@@ -130,6 +130,20 @@ class MgsMocNarrowAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, Na
        """
        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):
    """
    Driver for reading MGS MOC WA ISIS labels.
@@ -268,3 +282,17 @@ class MgsMocWideAngleCameraIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, Naif
            return [0, -.007, .007]
        else:
            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
+7 −6
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ class FrameChain(nx.DiGraph):
                     of frame rotations in the frame chain
    """
    @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()
        sensor_times = []
        # Default assume one time
@@ -106,7 +106,7 @@ class FrameChain(nx.DiGraph):

        if exact_ck_times and len(ephemeris_times) > 1 and not nadir:
            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:
                pass

@@ -123,8 +123,8 @@ class FrameChain(nx.DiGraph):

        constant_frames.extend(target_constant_frames)

        frame_chain.compute_time_dependent_rotiations(sensor_time_dependent_frames, sensor_times)
        frame_chain.compute_time_dependent_rotiations(target_time_dependent_frames, target_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, 0)

        for s, d in constant_frames:
            quats = np.zeros(4)
@@ -380,7 +380,7 @@ class FrameChain(nx.DiGraph):

        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
        relationships between frames as (source, destination) and a list of times to
@@ -409,5 +409,6 @@ class FrameChain(nx.DiGraph):

            if not avs:
                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)
 No newline at end of file
Loading