Unverified Commit 7d8a56d1 authored by Austin Sanders's avatar Austin Sanders Committed by GitHub
Browse files

lo medium camera driver, tests, and data (#613)



* lo medium camera driver, tests, and data

* Updated docstrings

* Updated spk for testing

* Updated incorrect ISD path for lo medium test

* Updated changelog

---------

Co-authored-by: default avatarKelvin Rodriguez <krodriguez@usgs.gov>
parent 8c522c6d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ release.
- Apollo Metric drivers, tests, and data [#533](https://github.com/DOI-USGS/ale/pull/533)
- Rosetta Virtis drivers, tests, and data [#520](https://github.com/DOI-USGS/ale/pull/520)
- Added compress and decompress ISD functions and added --compress flag to isd_generate[#604](https://github.com/DOI-USGS/ale/issues/604)
- LO Medium Camera drivers, tests, and data [#613](https://github.com/DOI-USGS/ale/issues/613)
- Added the ability to generate ISDs with no velocities specified for instrument/sun position [#614](https://github.com/DOI-USGS/ale/issues/614)

### Changed
+170 −2
Original line number Diff line number Diff line
@@ -3,9 +3,10 @@ import numpy as np
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 LoDistortion
from ale.base.type_distortion import LoDistortion, NoDistortion
from ale.base.base import Driver


class LoHighCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, LoDistortion, Driver):

    @property
@@ -219,3 +220,170 @@ class LoHighCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, LoDisto
                f"INS{self.ikid}_ITRANSL": itransl}

        return self._naif_keywords


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

    @property
    def lo_detector_map(self):
        return {'Lunar Orbiter 1': {'name':'LO1_MEDIUM_RESOLUTION_CAMERA', 'id':-531002},
                'Lunar Orbiter 2': {'name':'LO2_MEDIUM_RESOLUTION_CAMERA', 'id':-532002},
                'Lunar Orbiter 3': {'name':'LO3_MEDIUM_RESOLUTION_CAMERA', 'id':-533002},
                'Lunar Orbiter 4': {'name':'LO4_MEDIUM_RESOLUTION_CAMERA', 'id':-534002},
                'Lunar Orbiter 5': {'name':'LO5_MEDIUM_RESOLUTION_CAMERA', 'id':-535002}}

    @property
    def instrument_id(self):
        """
        Returns the ID of the instrument.

        Returns
        -------
        : str
          Name of the instrument
        """
        lookup_table = {'Medium Resolution Camera': self.lo_detector_map[self.spacecraft_name]['name']}
        return lookup_table[super().instrument_id]

    @property
    def ikid(self):
        """
        Returns the Naif ID code for the instrument
        Expects the spacecraft name to be defined.

        Returns
        -------
        : int
          Naif ID used to for identifying the instrument in Spice kernels
        """
        return self.lo_detector_map[self.spacecraft_name]['id']

    @property
    def sensor_model_version(self):
        """
        The ISIS Sensor model number. This is likely just 1

        Returns
        -------
        : int
          ISIS sensor model version
        """
        return 1

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

        Returns
        -------
        : str
          Name of the sensor
        """
        return self.instrument_id
    
    @property
    def ephemeris_start_time(self):
        """
        Returns the ephemeris time of the image.
        Expects the utc_start_time for the image to be defined.

        Returns
        -------
        : float
          ephemeris time of the image
        """
        
        return spice.utc2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f"))
    
    @property
    def ephemeris_stop_time(self):
        """
        Returns the ephemeris time of the image.
        This matches the ephemeris start time of the image, so it expects
        ephemeris_start_time to be defined.

        Returns
        -------
        : float
          ephemeris time of the image
        """
        
        return self.ephemeris_start_time
  
    @property
    def detector_center_line(self):
        """
        The center line of the image formatted in pixels.
        For LO Medium Resolution Camera, this information is embedded directly
        in the image label.

        Returns
        -------
        list :
            The center line of the image formatted in pixels.
        """
        return self.label['IsisCube']['Instrument']['BoresightLine']
    

    @property
    def detector_center_sample(self):
        """
        The center sample of the image formatted in pixels.
        For LO Medium Resolution Camera, this information is embedded directly
        in the image label.

        Returns
        -------
        list :
            The center sample of the image formatted in pixels.
        """
        return self.label['IsisCube']['Instrument']['BoresightSample']


    @property
    def focal2pixel_samples(self):
        """
        The transformation from focal plane coordinates to detector samples.
        To transform the coordinate (x,y) to detector samples do the following:

        samples = focal2pixel_samples[0] + x * focal2pixel_samples[1] + y * focal2pixel_samples[2]

        Returns
        -------
        : list<double>
          focal plane to detector samples transform
        """
        return self.naif_keywords[f"INS{self.ikid}_ITRANSS"]

    @property
    def focal2pixel_lines(self):
        """
        The transformation from focal plane coordinates to detector lines.
        To transform the coordinate (x,y) to detector lines do the following:

        lines = focal2pixel_lines[0] + x * focal2pixel_lines[1] + y * focal2pixel_lines[2]

        Returns
        -------
        : list<double>
          focal plane to detector lines transform
        """
        return self.naif_keywords[f"INS{self.ikid}_ITRANSL"]
    
    @property
    def light_time_correction(self):
        """
        Returns the type of light time correction and abberation correction to
        use in NAIF calls.

        ISIS has set this to NONE for all Lunar Orbitor data

        Returns
        -------
        : str
          The light time and abberation correction string for use in NAIF calls.
          See https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/abcorr.html
          for the different options available.
        """
        return 'NONE'
 No newline at end of file
+335 −0
Original line number Diff line number Diff line
Object = IsisCube
  Object = Core
    StartByte   = 65537
    Format      = Tile
    TileSamples = 1475
    TileLines   = 1750

    Group = Dimensions
      Samples = 11800
      Lines   = 8750
      Bands   = 1
    End_Group

    Group = Pixels
      Type       = UnsignedByte
      ByteOrder  = Lsb
      Base       = 0.0
      Multiplier = 1.0
    End_Group
  End_Object

  Group = Instrument
    TargetName      = Moon
    SpacecraftName  = "Lunar Orbiter 3"
    StartTime       = 1967-02-20T08:14:28.610
    InstrumentId    = "Medium Resolution Camera"
    FrameNumber     = 3133
    BoresightSample = 5624.274
    BoresightLine   = 4543.709
    SubFrame        = 4570
  End_Group

  Group = Kernels
    NaifFrameCode             = -533002
    LeapSecond                = $base/kernels/lsk/naif0012.tls
    TargetAttitudeShape       = ($base/kernels/pck/pck00009.tpc,
                                 $base/kernels/pck/lunar_de403_1950-2199_pa.bp-
                                 c, $base/kernels/fk/lunarMeanEarth001.tf)
    TargetPosition            = (Table, $base/kernels/spk/de430.bsp)
    InstrumentPointing        = (Table,
                                 $lo/kernels/ck/lo3_photo_support_ME.bc)
    Instrument                = $lo/kernels/ik/lo02.ti
    SpacecraftClock           = $lo/kernels/sclk/lo_fict.tsc
    InstrumentPosition        = (Table,
                                 $lo/kernels/spk/lo3_photo_support_ME.bsp)
    InstrumentAddendum        = $lo/kernels/iak/lunarOrbiterAddendum002.ti
    ShapeModel                = $base/dems/ldem_128ppd_Mar2011_clon180_radius-
                                _pad.cub
    InstrumentPositionQuality = Reconstructed
    InstrumentPointingQuality = Reconstructed
    CameraVersion             = 1
    Source                    = isis
  End_Group
End_Object

Object = Label
  Bytes = 65536
End_Object

Object = Table
  Name                = InstrumentPointing
  StartByte           = 103321521
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (-533000, 1)
  ConstantFrames      = (-533002, -533000)
  ConstantRotation    = (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
  CkTableStartTime    = -1037072690.2048
  CkTableEndTime      = -1037072690.2048
  CkTableOriginalSize = 1
  FrameTypeCode       = 3
  Description         = "Created by spiceinit"
  Kernels             = $lo/kernels/ck/lo3_photo_support_ME.bc

  Group = Field
    Name = J2000Q0
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = Table
  Name                 = InstrumentPosition
  StartByte            = 103321585
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = -1037072690.2048
  SpkTableEndTime      = -1037072690.2048
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = $lo/kernels/spk/lo3_photo_support_ME.bsp

  Group = Field
    Name = J2000X
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Y
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Z
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000XV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000YV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000ZV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = Table
  Name                = BodyRotation
  StartByte           = 103321641
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (310002, 1)
  ConstantFrames      = (310001, 310003, 310000, 310002)
  ConstantRotation    = (0.99999987852709, -3.09789127116553e-04,
                         3.83375135592436e-04, 3.09789421617701e-04,
                         0.999999952015, -7.08797549693787e-07,
                         -3.83374897618408e-04, 8.27563025111877e-07,
                         0.9999999265115)
  CkTableStartTime    = -1037072690.2048
  CkTableEndTime      = -1037072690.2048
  CkTableOriginalSize = 1
  FrameTypeCode       = 6
  Description         = "Created by spiceinit"
  Kernels             = ($base/kernels/spk/de430.bsp,
                         $base/kernels/pck/pck00009.tpc,
                         $base/kernels/pck/lunar_de403_1950-2199_pa.bpc,
                         $base/kernels/fk/lunarMeanEarth001.tf)
  SolarLongitude      = 285.94120301014

  Group = Field
    Name = J2000Q0
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = Table
  Name                 = SunPosition
  StartByte            = 103321705
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = -1037072690.2048
  SpkTableEndTime      = -1037072690.2048
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = $base/kernels/spk/de430.bsp

  Group = Field
    Name = J2000X
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Y
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Z
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000XV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000YV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000ZV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = History
  Name      = IsisCube
  StartByte = 103321761
  Bytes     = 1328
End_Object

Object = OriginalLabel
  Name      = IsisCube
  StartByte = 103315992
  Bytes     = 5529
End_Object

Object = NaifKeywords
  BODY_CODE                    = 301
  BODY301_RADII                = (1737.4, 1737.4, 1737.4)
  BODY_FRAME_CODE              = 310001
  INS-533002_FOCAL_LENGTH      = 79.833
  INS-533002_PIXEL_PITCH       = 0.006944444
  INS-533002_TRANSX            = (0.0, -0.006944444, 0.0)
  INS-533002_TRANSY            = (0.0, 0.0, 0.006944444)
  INS-533002_ITRANSS           = (0.0, -144.0, 0.0)
  INS-533002_ITRANSL           = (0.0, 0.0, 144.0)
  INS-533002_POINT_OF_SYMMETRY = (4.608, -4.608)
  INS-533002_OD_K              = (23.3145, 0.9998, -17.4798)
End_Object
End
+270 −0
Original line number Diff line number Diff line
DAFETF NAIF DAF ENCODED TRANSFER FILE
'DAF/SPK '
'2'
'6'
'SPKMERGE                                                    '
BEGIN_ARRAY 1 45
'DE-0430LE-0430                          '
'-3DD07B4E346BD4^8'
'-3DD078BA346BD2^8'
'12D'
'3'
'1'
'2'
45
'-3DCF9BC^8'
'2A3^5'
'-118249D11AE115^5'
'-287F11E7EDF348^5'
'104044E87CAE72^4'
'65F522D16620EC^3'
'12DD12B131D6BF^2'
'-522D558CE6C7F^1'
'-6A53C4D9B006FC^0'
'-F61E01B10C6EE^-2'
'A224D37E5FB4B^-2'
'D12857E061B308^-3'
'-28702292E4112C^-4'
'-1AEE7B3D2C0873^-4'
'-1BFB6DE39FDAC4^-5'
'4A59AA6B9DA3D^5'
'-B686C8ADE8609^4'
'-451E7F2C5A5398^4'
'A9597A7C252DB^2'
'5BE641FD625DF8^2'
'32BB939FBF489C^1'
'-299B7B22ED219^0'
'-819450B582CB4^-1'
'-54437842EFE0B^-2'
'7DDF30CB8DA00C^-3'
'124DDFAEE15D94^-3'
'79EC50E5A4E8DC^-5'
'-1999EDA7E95AB5^-5'
'27852BBC8BB66^5'
'-34DDE4F294245^4'
'-24D15BDFB2C784^4'
'-1262A97D21E4DD^2'
'2E71025AB49706^2'
'1FA445EF189746^1'
'-EC261F25A9C85^-1'
'-4229FF5C48D36C^-1'
'-36145D766ECDA6^-2'
'33C512248FE8C2^-3'
'9A5520D332F808^-4'
'5ADA3BFAA089C8^-5'
'-B774E6085608^-6'
'-3DD23EC^8'
'546^5'
'29^2'
'1^1'
END_ARRAY 1 45
BEGIN_ARRAY 2 39
'DE-0430LE-0430                          '
'-3DD07B4E346BD4^8'
'-3DD078BA346BD2^8'
'A'
'0'
'1'
'2'
39
'-3DCCF8C^8'
'A8C^5'
'3F395F08B4390E^5'
'1D2E510C23301A^4'
'-AC93F97570D68^1'
'-400AA415BCAFE4^0'
'3540071D7D307^-1'
'51A33305906664^-2'
'-1CC0FCB53BAEA4^-2'
'C952D005A974^-4'
'B146F01F80FFA^-4'
'-1660B33E93E028^-4'
'-2D86B534802CF6^-5'
'-6AD7C83432046C^5'
'9E415BD6796^3'
'165133C6AE4648^2'
'-E5931CF35FD31^-1'
'-3687A2930455FE^-1'
'997E3B0859D7D8^-2'
'21E876648D24F4^-3'
'-4104FAB7B6F394^-3'
'579BE3A97BA4^-4'
'146759598FAD4B^-4'
'-4849E6CF563C1^-5'
'-2DFFA6A96BD68E^5'
'39E99FB2918E44^3'
'9CC8E1FCC222^1'
'-336D6FF5A0CCFE^-1'
'-21FFAB3D083738^-1'
'49E1F549470AD8^-2'
'41DA072C52BED4^-3'
'-24090F88C85AF^-3'
'1C63F985C7E90A^-4'
'D389514B82366^-5'
'-21E258C8CEBDB6^-5'
'-3DD784C^8'
'1518^6'
'23^2'
'1^1'
END_ARRAY 2 39
BEGIN_ARRAY 3 45
'DE-0430LE-0430                          '
'-3DD07B4E346BD4^8'
'-3DD078BA346BD2^8'
'3'
'0'
'1'
'2'
45
'-3DCCF8C^8'
'A8C^5'
'-7E2772EFDF093^7'
'-8DB4DE1F55ED98^6'
'9EB0649B5DEA9^5'
'1B511A2B7E6A^4'
'-11B084649C178B^3'
'-147157DD06FBE5^1'
'103BD82DE37C09^0'
'E631283212E328^-3'
'-759D4A75EBA474^-3'
'-1CD7C038E41E47^-3'
'3ECEFA00914374^-4'
'2626F16A10684A^-4'
'-40832CE5A97B88^-6'
'37C903C0526A^7'
'-103C5E8F1A22DD^7'
'-4693984561D958^5'
'37465C180D19BE^4'
'666FBC23B1EA44^2'
'-40542B7870DCCC^1'
'-1CDED70491B2B^-1'
'1B34B3B3B27768^-2'
'-1BE5DA0305894C^-3'
'14D0DC752C502F^-3'
'3770E41B3050E4^-4'
'-FF66B721B2143^-5'
'-5BCFA4AC71B708^-5'
'1830F6C3A8D1C1^7'
'-70A702E3EF5B^6'
'-1E9A936BB91C1A^5'
'17F84146EA32C2^4'
'2C6AF2B9A89B3A^2'
'-1BE5FE8ACC5468^1'
'-BEDC353A67F978^-2'
'D0AFA73210D8A8^-3'
'-17729646272E45^-3'
'6DF34BB796AF64^-4'
'20E636EE7157AC^-4'
'-3ADB3BEB3E8D3^-5'
'-2BFA40959FBD7A^-5'
'-3DD784C^8'
'1518^6'
'29^2'
'1^1'
END_ARRAY 3 45
BEGIN_ARRAY 4 72
'LO3_DE403ME_2010JAN                     '
'-3DD07B4E346BD4^8'
'-3DD078BA346BD2^8'
'-215'
'12D'
'1'
'9'
72
'-152B6F18D02C5D^3'
'-645D52D8321F68^3'
'-2B5BDF5315B88C^3'
'1C1D0181BF21D8^1'
'-CEC0A3AA5B4F28^-1'
'-BC388EA8B04068^0'
'-14F5245483FD07^3'
'-645F7D1F5D617^3'
'-2B7136FDCAD34C^3'
'1C1E3BF5C2AB5F^1'
'-C7C67236FD09B8^-1'
'-BC0C301D0D6048^0'
'-14B9D63AE7C7D2^3'
'-646079EFAEB118^3'
'-2B8B5AB8E55C52^3'
'258E70EC094A0A^-1'
'-24E53ED41F01B^-3'
'-EC5DCB80B868D8^-2'
'-DC0673EDB0C0A8^2'
'-64669165B3FE9^3'
'-2E46D8CFD3BA86^3'
'2A0169166FE0E^-1'
'B251EA0B363EB8^-4'
'-1076D445A7F0F5^-1'
'-CA9492506C6258^2'
'-645E562A308138^3'
'-2EB48F99E6DB88^3'
'1C9A558D090007^1'
'EBA6FFE12FE0D^-1'
'-B1A103D1059018^0'
'-B8CED43035F458^2'
'-64546F0BCF3AA8^3'
'-2F218D76292B06^3'
'1CD767D6AF4569^1'
'11444D6E60157F^0'
'-AEB2555FFABC4^0'
'-A6B575F7BAF9D^2'
'-6448DC69E2DB6C^3'
'-2F8DD700DEAA2^3'
'-F2E8ABAB088FE8^-2'
'-9D29DCA13084D^-3'
'5A0BC871BC636^-2'
'-E7143DEEF24328^2'
'-64725F19CBB53^3'
'-2E0F1C2CA13AD6^3'
'-10D8CA37971351^-1'
'-BE159CCABA5EE^-3'
'61725EB7DFA248^-2'
'-10D60B6E4832A8^3'
'-649143307A7DA8^3'
'-2D3BF964A4C926^3'
'-B0789A5690226^-2'
'-9F3E004E2C94B8^-3'
'3B2DD474CAA1AE^-2'
'-108B6BFEB17AE3^3'
'-6490B8F676C2F8^3'
'-2D5AA4129A79A8^3'
'1C0F57D71E4305^1'
'3E02DC2E7737FA^-1'
'-B83449699AFBB8^0'
'-3DD0AA5C865788^8'
'-3DD0AA5A8138D^8'
'-3DD0AA587C1A16^8'
'-3DD0793C0138A^8'
'-3DD07932346BD2^8'
'-3DD079284E056C^8'
'-3DD0791E4E056C^8'
'-3DD04864813872^8'
'-3DD0179C398A2E^8'
'-3DD0179990946C^8'
'5^1'
'A^1'
END_ARRAY 4 72
TOTAL_ARRAYS 4
 ~NAIF/SPC BEGIN COMMENTS~
; /Users/arsanders/data/lo/ale_0.bsp LOG FILE

; Created 2024-09-11/11:48:27.00.
;
; BEGIN SPKMERGE COMMANDS

LEAPSECONDS_KERNEL   = /Volumes/drive/data/base/kernels/lsk/naif0012.tls

SPK_KERNEL           = /Users/arsanders/data/lo/ale_0.bsp
  SOURCE_SPK_KERNEL  = /Volumes/drive/data/base/kernels/spk/de430.bsp
    INCLUDE_COMMENTS = NO
    BODIES           = 3, 10, 301
    BEGIN_TIME       = 1967 FEB 20 08:05:28.610
    END_TIME         = 1967 FEB 20 08:16:28.610
SOURCE_SPK_KERNEL = /Volumes/drive/data/lo/kernels/spk/lo3_photo_support_ME.bsp
    INCLUDE_COMMENTS = NO
    BODIES           = -533
    BEGIN_TIME       = 1967 FEB 20 08:05:28.610
    END_TIME         = 1967 FEB 20 08:16:28.610

; END SPKMERGE COMMANDS
 ~NAIF/SPC END COMMENTS~
+255 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading