Unverified Commit 71990f46 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Exact Instrument Pointing Data Extraction (#478)

* Adds exact ck timing for sensor orientations, also updates all tests

* Finished fixing the new horizons tests/data

* Forced test kernels to load in a specific order

* Tried fixing tests by ordering the kernels after they have been globbed

* Addressed review comments
parent e3b40c4a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -423,11 +423,12 @@ class NaifSpice():
    def frame_chain(self):
        if not hasattr(self, '_frame_chain'):
            nadir = self._props.get('nadir', False)
            exact_ck_times = self._props.get('exact_ck_times', True)
            self._frame_chain = FrameChain.from_spice(sensor_frame=self.sensor_frame_id,
                                                      target_frame=self.target_frame_id,
                                                      center_ephemeris_time=self.center_ephemeris_time,
                                                      ephemeris_times=self.ephemeris_time,
                                                      nadir=nadir)
                                                      nadir=nadir, exact_ck_times=exact_ck_times)

            if nadir:
                # Logic for nadir calculation was taken from ISIS3
+5 −3
Original line number Diff line number Diff line
@@ -280,7 +280,8 @@ class CassiniIssIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, RadialDis
                self._frame_chain = FrameChain.from_spice(sensor_frame=self._original_naif_sensor_frame_id,
                                                          target_frame=self.target_frame_id,
                                                          center_ephemeris_time=self.center_ephemeris_time,
                                                          ephemeris_times=self.ephemeris_time,)
                                                          ephemeris_times=self.ephemeris_time,
                                                          exact_ck_times=True)

                rotation = ConstantRotation([[0, 0, 1, 0]], self.sensor_frame_id, self._original_naif_sensor_frame_id)

@@ -502,13 +503,14 @@ class CassiniIssPds3LabelNaifSpiceDriver(Framer, Pds3Label, NaifSpice, RadialDis
            try:
                # Call frinfo to check if the ISIS iak has been loaded with the
                # additional reference frame. Otherwise, Fail and add it manually
                spice.frinfo(self.sensor_frame_id)
                _ = spice.frinfo(self.sensor_frame_id)
                self._frame_chain = super().frame_chain
            except spice.utils.exceptions.NotFoundError as e:
                self._frame_chain = FrameChain.from_spice(sensor_frame=self._original_naif_sensor_frame_id,
                                                          target_frame=self.target_frame_id,
                                                          center_ephemeris_time=self.center_ephemeris_time,
                                                          ephemeris_times=self.ephemeris_time,)
                                                          ephemeris_times=self.ephemeris_time,
                                                          exact_ck_times=True)

                rotation = ConstantRotation([[0, 0, 1, 0]], self.sensor_frame_id, self._original_naif_sensor_frame_id)

+7 −1
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ class NewHorizonsLorriIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoD
        }
        return id_lookup[super().instrument_id]

    @property
    def ephemeris_stop_time(self):
        return super().ephemeris_start_time

    @property
    def ikid(self):
@@ -67,6 +70,10 @@ class NewHorizonsLorriIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoD
    def sensor_name(self):
        return self.label['IsisCube']['Instrument']['SpacecraftName']

    @property
    def frame_chain(self):
        self._props['exact_ck_times'] = False
        return super().frame_chain

class NewHorizonsLeisaIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, NoDistortion, Driver):
    """
@@ -104,7 +111,6 @@ class NewHorizonsLeisaIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice
        """
        return self.label['IsisCube']['Kernels']['NaifFrameCode'][0]


    @property
    def ephemeris_start_time(self):
        """
+36 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ alt_id_lookup = {
    'VIKING ORBITER 2':-30999
}

class VikingIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver):
class VikingIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver):



@@ -119,6 +119,41 @@ class VikingIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver):

        return ephemeris_start_time + offset1 + offset2

    @property
    def focal_length(self):
        """
        Override the focal length attribute to return the appropriate viking
        focal length. Values and logic based on ISIS viking camera model.

        Returns
        -------
        : float
          Focal length of viking instrument
        """
        if not hasattr(self, "_focal_length"):
            if (self.spacecraft_name == "VIKING ORBITER 1"):
                if (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A"):
                    self._focal_length = 474.398
                elif (self.sensor_name ==  "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B"):
                    self._focal_length = 474.448
            elif (self.spacecraft_name == "VIKING ORBITER 2"):
                if (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A"):
                    self._focal_length = 474.610
                elif (self.sensor_name ==  "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B"):
                    self._focal_length = 474.101
            else:
                raise Exception(f"Unknown viking instrument to get focal length: {self.spacecraft_name}, {self.sensor_name}")

    @property
    def detector_center_line(self):
        return 0

    @property
    def detector_center_sample(self):
        return 0



class VikingIsisLabelIsisSpiceDriver(Framer, IsisLabel, IsisSpice, NoDistortion, Driver):

    @property
+14 −1
Original line number Diff line number Diff line
@@ -4,9 +4,10 @@ import ale
from ale.base.data_naif import NaifSpice
from ale.base.label_isis import IsisLabel
from ale.base.type_sensor import Framer
from ale.base.type_distortion import NoDistortion
from ale.base.base import Driver

class VoyagerCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver):
class VoyagerCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver):

    @property
    def instrument_id(self):
@@ -20,6 +21,18 @@ class VoyagerCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, Driver
        }
        return sc_lookup[super().spacecraft_name] + '_' + sensor_lookup[super().instrument_id]

    @property
    def sensor_name(self):
        """
        Returns the name of the instrument

        Returns
        -------
        : str
          Name of the sensor
        """
        return self.label['IsisCube']['Instrument']['InstrumentId']

    @property
    def sensor_model_version(self):
        return 1
Loading