Commit dedfd07a authored by Kaitlyn Lee's avatar Kaitlyn Lee Committed by acpaquette
Browse files

Adding summing mode logic to mdis driver (#234)

* Added lro lroc nac notebook.

* Adding summing mode logic to the mdis naif driver
parent 1c7979b4
Loading
Loading
Loading
Loading
+27 −8
Original line number Diff line number Diff line
@@ -93,6 +93,25 @@ class MessengerMdisPds3NaifSpiceDriver(Pds3Label, NaifSpice, Framer, Driver):
        """
        return ID_LOOKUP[super().instrument_id]
        
    @property
    def sampling_factor(self):
        """
        Returns the summing factor from the PDS3 label. For example a return value of 2
        indicates that 2 lines and 2 samples (4 pixels) were summed and divided by 4
        to produce the output pixel value.
        
        NOTE: This is overwritten for the messenger driver as the value is stored in "MESS:PIXELBIN" 

        Returns
        -------
        : int
          Number of samples and lines combined from the original data to produce a single pixel in this image
        """
        pixel_bin = self.label['MESS:PIXELBIN']
        if pixel_bin == 0:
            pixel_bin = 1
        return pixel_bin * 2

    @property
    def focal_length(self):
        """
@@ -151,15 +170,15 @@ class MessengerMdisPds3NaifSpiceDriver(Pds3Label, NaifSpice, Framer, Driver):
        Expects ikid to be defined. This should be the integer Naid ID code for
        the instrument.
        
        We subtract 0.5 from the ISIS center sample because ISIS detector
        coordinates are 0.5 based.
        NOTE: This value is defined in an ISIS iak as 512.5, but we subtract 0.5 from the 
        ISIS center sample because ISIS detector coordinates are 0.5 based.

        Returns
        -------
        : float
          center detector sample
        """
        return float(spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 3)[0]) - 0.5
        return 512

    @property
    def detector_center_line(self):
@@ -168,15 +187,15 @@ class MessengerMdisPds3NaifSpiceDriver(Pds3Label, NaifSpice, Framer, Driver):
        Expects ikid to be defined. This should be the integer Naid ID code for
        the instrument.
        
        We subtract 0.5 from the ISIS center line because ISIS detector
        coordinates are 0.5 based.
        NOTE: This value is defined in an ISIS iak as 512.5, but we subtract 0.5 from the 
        ISIS center sample because ISIS detector coordinates are 0.5 based.

        Returns
        -------
        : float
          center detector line
        """
        return float(spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 3)[1]) - 0.5
        return 512

    @property
    def sensor_model_version(self):
+2 −2
Original line number Diff line number Diff line
@@ -61,11 +61,11 @@ def test_detector_start_line_pds3(Pds3Driver):

@patch('ale.base.data_naif.NaifSpice.ikid', 123)
def test_detector_center_sample_pds3(Pds3Driver):
    assert Pds3Driver.detector_center_sample == 0.5
    assert Pds3Driver.detector_center_sample == 512

@patch('ale.base.data_naif.NaifSpice.ikid', 123)
def test_detector_center_line_pds3(Pds3Driver):
    assert Pds3Driver.detector_center_line == 0.5
    assert Pds3Driver.detector_center_line == 512

def test_sensor_model_version_pds3(Pds3Driver):
    assert Pds3Driver.sensor_model_version == 2