Commit eefbe6b3 authored by acpaquette's avatar acpaquette Committed by Jesse Mapel
Browse files

Isis CTX Driver Fixes (#225)

* Changes to get an ISIS Ctx driver working

* Removed stop time computation from naif_data

* Added the isis camera version to the label_isis class
parent e85999e8
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -335,6 +335,20 @@ class IsisSpice():
        """
        return struct.unpack('d', bytes.fromhex(self._sclock_hex_string))[0]

    @property
    def center_ephemeris_time(self):
        """
        Returns the average of the start and stop ephemeris times. Expects
        ephemeris start and stop times to be defined. These should be double precision
        numbers containing the ephemeris start and stop times of the image.

        Returns
        -------
        : double
          Center ephemeris time for an image
        """
        return (self.ephemeris_start_time + self.ephemeris_stop_time) / 2

    @property
    def detector_center_sample(self):
        """
+0 −18
Original line number Diff line number Diff line
@@ -362,24 +362,6 @@ class NaifSpice():
        """
        return spice.scs2e(self.spacecraft_id, self.spacecraft_clock_start_count)

    @property
    def ephemeris_stop_time(self):
        """
        Returns the ephemeris stop time of the image. Expects spacecraft_id to
        be defined. This must be the integer Naif Id code for the spacecraft.
        Expects spacecraft_clock_stop_count to be defined. This must be a string
        containing the stop clock count of the spacecraft

        Returns
        -------
        : double
          Ephemeris stop time of the image
        """
        if self.spacecraft_clock_stop_count:
            return spice.scs2e(self.spacecraft_id, self.spacecraft_clock_stop_count)
        else:
            return spice.str2et(self.utc_stop_time.strftime("%Y-%m-%d %H:%M:%S"))

    @property
    def center_ephemeris_time(self):
        """
+12 −0
Original line number Diff line number Diff line
@@ -52,6 +52,18 @@ class IsisLabel():
        """
        return self.label['IsisCube']['Instrument']['InstrumentName']

    @property
    def sensor_model_version(self):
        """
        Returns the ISIS camera version

        Returns
        -------
        : int
          Camera version number
        """
        return self.label["IsisCube"]["Kernels"]["CameraVersion"]

    @property
    def image_lines(self):
        """
+9 −18
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ from ale.base.type_distortion import RadialDistortion
from ale.base.type_sensor import LineScanner


class MroCtxIsisLabelIsisSpiceDriver(Driver, IsisSpice, LineScanner, RadialDistortion):
class MroCtxIsisLabelIsisSpiceDriver(IsisLabel, IsisSpice, LineScanner, RadialDistortion, Driver):

    @property
    def instrument_id(self):
@@ -29,7 +29,10 @@ class MroCtxIsisLabelIsisSpiceDriver(Driver, IsisSpice, LineScanner, RadialDisto
        : str
          instrument id
        """
        return "N/A"
        id_lookup = {
        "CTX" : "MRO_CTX"
        }
        return id_lookup[super().instrument_id]

    @property
    def spacecraft_id(self):
@@ -39,27 +42,15 @@ class MroCtxIsisLabelIsisSpiceDriver(Driver, IsisSpice, LineScanner, RadialDisto
        : int
          Naif ID code for the spacecraft
        """
        return "N/A"
        return "-74"

    @property
    def ikid(self):
    def sensor_name(self):
        """
        Returns
        -------
        : int
          Naif ID code for the instrument
        ISIS doesn't propergate this to the ingested cube label, so hard-code it.
        """
        return int(self.label["IsisCube"]["Kernels"]["NaifFrameCode"])
        return "CONTEXT CAMERA"

    @property
    def line_exposure_duration(self):
        """
        Returns
        -------
        : float
          Line exposure duration in seconds
        """
        return self.label["IsisCube"]["Instrument"]["LineExposureDuration"].value * 0.001 # Scale to seconds

class MroCtxIsisLabelNaifSpiceDriver(IsisLabel, NaifSpice, LineScanner, RadialDistortion, Driver):
    """