Unverified Commit 1e3fdeae authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Fixes MSI IsisLabelNaifSpice driver and adds tests (#598)

* msi ephemeris time fix

* Fixed spacing on math for center_ephemeris_time

* Updated MSI driver and added tests

* Enabled MSI driver

* Added test kernels for MSI

* Update sensor model version to 2

* Fixed truth camera version
parent 54c3e7be
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -26,8 +26,7 @@ from abc import ABC
__disabled_drivers__ = ["ody_drivers",
                        "hayabusa2_drivers",
                        "juno_drivers",
                        "tgo_drivers",
                        "msi_drivers"]
                        "tgo_drivers"]

# dynamically load drivers
__all__ = [os.path.splitext(os.path.basename(d))[0] for d in glob(os.path.join(os.path.dirname(__file__), '*_drivers.py'))]
+5 −35
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ class MsiIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Dr
        lookup_table = {"MSI": "NEAR EARTH ASTEROID RENDEZVOUS"}
        return lookup_table[super().instrument_id]
    
    @property
    def center_ephemeris_time(self):
        return self.ephemeris_start_time + self.exposure_duration / 2.0

    @property
    def sensor_name(self):
        """
@@ -52,41 +56,7 @@ class MsiIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Dr
        : int
          ISIS sensor model version
        """
        return 1

    @property
    def spacecraft_clock_start_count(self):
        """
        The spacecraft clock start count, frequently used to determine the start time
        of the image.

        Returns
        -------
        : str
          spacecraft clock start count
        """
        if "SpacecraftClockStartCount" in self.label["IsisCube"]["Instrument"]:
            return str(
                self.label["IsisCube"]["Instrument"]["SpacecraftClockStartCount"])
        else:
            return None

    @property
    def spacecraft_clock_stop_count(self):
        """
        The spacecraft clock stop count, frequently used to determine the stop time
        of the image.

        Returns
        -------
        : str
          spacecraft clock stop count
        """
        if "SpacecraftClockStopCount" in self.label["IsisCube"]["Instrument"]:
            return str(
                self.label["IsisCube"]["Instrument"]["SpacecraftClockStopCount"])
        else:
            return None
        return 2

    @property
    def ikid(self):
+262 −0
Original line number Diff line number Diff line
{
  "isis_camera_version": 2,
  "image_lines": 412,
  "image_samples": 537,
  "name_platform": "NEAR EARTH ASTEROID RENDEZVOUS",
  "name_sensor": "MULTI-SPECTRAL IMAGER",
  "reference_height": {
    "maxheight": 1000,
    "minheight": -1000,
    "unit": "m"
  },
  "name_model": "USGS_ASTRO_FRAME_SENSOR_MODEL",
  "center_ephemeris_time": 4750816.53996159,
  "radii": {
    "semimajor": 17.0,
    "semiminor": 5.5,
    "unit": "km"
  },
  "body_rotation": {
    "time_dependent_frames": [
      2000433,
      1
    ],
    "ck_table_start_time": 4750816.53996159,
    "ck_table_end_time": 4750816.53996159,
    "ck_table_original_size": 1,
    "ephemeris_times": [
      4750816.53996159
    ],
    "quaternions": [
      [
        -0.21742791831046224,
        -0.5915927720196109,
        0.04469058688780722,
        -0.7750779598704606
      ]
    ],
    "angular_velocities": [
      [
        0.00031013516468020774,
        6.225262045195156e-05,
        9.803883131191956e-05
      ]
    ],
    "reference_frame": 1
  },
  "instrument_pointing": {
    "time_dependent_frames": [
      -93000,
      1
    ],
    "ck_table_start_time": 4750816.53996159,
    "ck_table_end_time": 4750816.53996159,
    "ck_table_original_size": 1,
    "ephemeris_times": [
      4750816.53996159
    ],
    "quaternions": [
      [
        -0.6037146505713888,
        -0.2184429492380255,
        0.26555847710047836,
        0.7192287493237002
      ]
    ],
    "angular_velocities": [
      [
        -1.0366620787684243e-05,
        2.9058844213815335e-05,
        -8.620710132728253e-06
      ]
    ],
    "reference_frame": 1,
    "constant_frames": [
      -93001,
      -93000
    ],
    "constant_rotation": [
      -0.0014422521585655882,
      6.97819591591179e-07,
      0.9999989599535712,
      -0.00048384015636002327,
      -0.9999998829493447,
      0.0,
      0.9999988429030378,
      -0.00048383965314379655,
      0.0014422523273822038
    ]
  },
  "naif_keywords": {
    "BODY2000433_RADII": [
      17.0,
      5.5,
      5.5
    ],
    "BODY_FRAME_CODE": 2000433,
    "BODY_CODE": 2000433,
    "INS-93001_PIXEL_PITCH": 0.016,
    "INS-93001_LT_SURFACE_CORRECT": "FALSE",
    "INS-93001_SWAP_OBSERVER_TARGET": "TRUE",
    "INS-93001_TRANSX": [
      0.0,
      0.016,
      0.0
    ],
    "INS-93001_TRANSY": [
      0.0,
      0.0,
      -0.016
    ],
    "INS-93001_LIGHTTIME_CORRECTION": "LT+S",
    "INS-93001_FOV_BOUNDARY_CORNERS": [
      1.0,
      0.019744857140000002,
      0.02575366124,
      1.0,
      -0.019744857140000002,
      0.02575366124,
      1.0,
      -0.019744857140000002,
      -0.02575366124,
      1.0
    ],
    "TKFRAME_-93001_UNITS": "DEGREES",
    "INS-93001_FOCAL_LENGTH": 166.85,
    "INS-93001_FOV_FRAME": "NEAR_MSI",
    "FRAME_-93001_NAME": "NEAR_MSI",
    "TKFRAME_-93001_AXES": [
      2.0,
      1.0,
      2.0
    ],
    "TKFRAME_-93001_SPEC": "ANGLES",
    "INS-93001_BORESIGHT_SAMPLE": 269.0,
    "INS-93001_ITRANSL": [
      0.0,
      0.0,
      -62.5
    ],
    "INS-93001_K1": -7e-05,
    "INS-93001_ITRANSS": [
      0.0,
      62.5,
      0.0
    ],
    "FRAME_-93001_CLASS_ID": -93001.0,
    "INS-93001_PLATFORM_ID": -93000.0,
    "INS-93001_BORESIGHT_LINE": 206.5,
    "INS-93001_FRAME_ID": -93001.0,
    "TKFRAME_-93001_RELATIVE": "NEAR_SC_BUS_PRIME",
    "INS-93001_BORESIGHT": [
      1.0,
      0.0,
      0.0
    ],
    "TKFRAME_-93001_ANGLES": [
      90.0,
      -179.972278,
      -0.082635
    ],
    "FRAME_-93001_CENTER": -93.0,
    "FRAME_-93001_CLASS": 4.0,
    "INS-93001_FOV_SHAPE": "POLYGON",
    "FRAME_2000433_NAME": "EROS_FIXED",
    "FRAME_2000433_CLASS_ID": 2000433.0,
    "BODY2000433_POLE_DEC": [
      17.22,
      0.0,
      0.0
    ],
    "BODY2000433_PM": [
      326.07,
      1639.38864745,
      0.0
    ],
    "FRAME_2000433_CENTER": 2000433.0,
    "BODY2000433_LONG_AXIS": 0.0,
    "OBJECT_2000433_FRAME": "EROS_FIXED",
    "FRAME_2000433_CLASS": 2.0,
    "BODY2000433_POLE_RA": [
      11.35,
      0.0,
      0.0
    ]
  },
  "detector_sample_summing": 1,
  "detector_line_summing": 1,
  "focal_length_model": {
    "focal_length": 166.85
  },
  "detector_center": {
    "line": 206.5,
    "sample": 269.0
  },
  "focal2pixel_lines": [
    0.0,
    0.0,
    -62.5
  ],
  "focal2pixel_samples": [
    0.0,
    62.5,
    0.0
  ],
  "optical_distortion": {
    "radial": {
      "coefficients": [
        0.0,
        0.0,
        0.0
      ]
    }
  },
  "starting_detector_line": 0,
  "starting_detector_sample": 0,
  "instrument_position": {
    "spk_table_start_time": 4750816.53996159,
    "spk_table_end_time": 4750816.53996159,
    "spk_table_original_size": 1,
    "ephemeris_times": [
      4750816.53996159
    ],
    "positions": [
      [
        69.13367389282288,
        -276.40770781355167,
        222.2546049363491
      ]
    ],
    "velocities": [
      [
        0.0007228575310681364,
        -0.00018739946234992287,
        -0.0005859505443755211
      ]
    ],
    "reference_frame": 1
  },
  "sun_position": {
    "spk_table_start_time": 4750816.53996159,
    "spk_table_end_time": 4750816.53996159,
    "spk_table_original_size": 1,
    "ephemeris_times": [
      4750816.53996159
    ],
    "positions": [
      [
        122682357.26743293,
        156146522.97922137,
        110874367.26208726
      ]
    ],
    "velocities": [
      [
        -16.298773023439573,
        15.981064278673381,
        6.140837444633245
      ]
    ],
    "reference_frame": 1
  }
}
 No newline at end of file
+74 −0
Original line number Diff line number Diff line
KPL/FK

EROS Body-Fixed Frame Definition Kernel
===============================================================================

   This frame kernel contains asteroid EROS body-fixed frame definition.


Version and Date
--------------------------------------------------------

   Version 1.0 -- June 18, 2002 -- Boris Semenov

      Initial release.


References
--------------------------------------------------------

   1. ``Frames Required Reading''

   2. ``PCK Required Reading''


Contact Information
--------------------------------------------------------

   Boris V. Semenov, NAIF/JPL, (818)-354-8136, bsemenov@spice.jpl.nasa.gov


Implementation Notes
--------------------------------------------------------

   This file is used by the SPICE system as follows: programs that make
   use of this frame kernel must `load' the kernel, normally during program
   initialization. Loading the kernel associates data items with their
   names in a data structure called the `kernel pool'. The SPICELIB
   routine FURNSH loads a kernel file into the pool as shown below.

      CALL FURNSH ( frame_kernel_name )

   This file was created and may be updated with a text editor or word
   processor.


EROS Body-Fixed Frame
--------------------------------------------------------

   This kernel file defines asteroid EROS body-frame, EROS_FIXED, with the 
   frame ID code 2000433 in the same as any other PCK frame:
   
      *  +Z along asteroid's North pole;
      
      *  +X along asteroid's prime meridian;
      
      *  +Y complements to the right hand frame;
      
      *  the origin of this frame is at the center of the asteroid ellipsoid.
      
   As for any PCK frame orientation of this frame is computed by evaluating 
   corresponding rotation constants provided in a PCK file.

   \begindata

      FRAME_EROS_FIXED       =  2000433
      FRAME_2000433_NAME     = 'EROS_FIXED'
      FRAME_2000433_CLASS    =  2
      FRAME_2000433_CLASS_ID =  2000433
      FRAME_2000433_CENTER   =  2000433

      OBJECT_2000433_FRAME   = 'EROS_FIXED'

   \begintext
+360 −0
Original line number Diff line number Diff line
Object = IsisCube
  Object = Core
    StartByte   = 65537
    Format      = Tile
    TileSamples = 179
    TileLines   = 412

    Group = Dimensions
      Samples = 537
      Lines   = 412
      Bands   = 1
    End_Group

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

  Group = Instrument
    SpacecraftName                    = "NEAR EARTH ASTEROID RENDEZVOUS"
    InstrumentId                      = MSI
    TargetName                        = EROS
    StartTime                         = 2000-02-25T11:39:11.972
    StopTime                          = 2000-02-25T11:39:12.737
    SpacecraftClockStartCount         = 126888978154
    SpacecraftClockStopCount          = 126888978919
    ExposureDuration                  = 765.00 <ms>
    OriginalSpacecraftClockStartCount = 126888978.154
    OriginalSpacecraftClockStopCount  = 126888978.919
    DpuDeckTemperature                = 286.50 <K>
  End_Group

  Group = Archive
    DataSetId          = NEAR-A-MSI-2-EDR-EROS/ORBIT-V1.0
    ProducerFullName   = "Howard W. Taylor"
    ProductId          = M0126888978F7_2P.LBL
    ProductVersionId   = 1.01
    InstrumentHostName = "NEAR EARTH ASTEROID RENDEZVOUS"
    InstrumentName     = "MULTI-SPECTRAL IMAGER"
    InstrumentId       = MSI
    TargetName         = EROS
  End_Group

  Group = BandBin
    FilterNumber = 7
    Center       = 1050 <nm>
  End_Group

  Group = Kernels
    NaifFrameCode             = -93001
    LeapSecond                = $base/kernels/lsk/naif0012.tls
    TargetAttitudeShape       = $base/kernels/pck/pck00009.tpc
    TargetPosition            = (Table, $base/kernels/spk/de405.bsp,
                                 $near/kernels/tspk/erosephem_1999004_2002181.-
                                 bsp)
    InstrumentPointing        = (Table, $near/kernels/ck/near_2000056_v01.bc,
                                 $near/kernels/fk/eros_fixed.tf)
    Instrument                = $near/kernels/ik/msi15.ti
    SpacecraftClock           = $near/kernels/sclk/near_171.tsc
    InstrumentPosition        = (Table,
                                 $near/kernels/spk/near_erosorbit_nav_v1.bsp)
    InstrumentAddendum        = $near/kernels/iak/msiAddendum002.ti
    ShapeModel                = Null
    InstrumentPositionQuality = Reconstructed
    InstrumentPointingQuality = Reconstructed
    CameraVersion             = 2
    Source                    = isis
  End_Group
End_Object

Object = Label
  Bytes = 65536
End_Object

Object = Table
  Name                = InstrumentPointing
  StartByte           = 955685
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (-93000, 1)
  ConstantFrames      = (-93001, -93000)
  ConstantRotation    = (-0.0014422521585655, 6.97819591591201e-07,
                         0.99999895995357, -4.83840156360023e-04,
                         -0.99999988294934, 2.96266649392629e-20,
                         0.99999884290304, -4.83839653143796e-04,
                         0.0014422523273821)
  CkTableStartTime    = 4750816.5399616
  CkTableEndTime      = 4750816.5399616
  CkTableOriginalSize = 1
  FrameTypeCode       = 3
  Description         = "Created by spiceinit"
  Kernels             = ($near/kernels/ck/near_2000056_v01.bc,
                         $near/kernels/fk/eros_fixed.tf)

  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            = 955749
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = 4750816.5399616
  SpkTableEndTime      = 4750816.5399616
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = $near/kernels/spk/near_erosorbit_nav_v1.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           = 955805
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (2000433, 1)
  CkTableStartTime    = 4750816.5399616
  CkTableEndTime      = 4750816.5399616
  CkTableOriginalSize = 1
  FrameTypeCode       = 2
  PoleRa              = (11.35, 0.0, 0.0)
  PoleDec             = (17.22, 0.0, 0.0)
  PrimeMeridian       = (326.07, 1639.38864745, 0.0)
  Description         = "Created by spiceinit"
  Kernels             = ($base/kernels/spk/de405.bsp,
                         $near/kernels/tspk/erosephem_1999004_2002181.bsp,
                         $base/kernels/pck/pck00009.tpc)
  SolarLongitude      = 128.86157495957

  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            = 955869
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = 4750816.5399616
  SpkTableEndTime      = 4750816.5399616
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = ($base/kernels/spk/de405.bsp,
                          $near/kernels/tspk/erosephem_1999004_2002181.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 = 955925
  Bytes     = 2374
End_Object

Object = OriginalLabel
  Name      = IsisCube
  StartByte = 950513
  Bytes     = 3700
End_Object

Object = NaifKeywords
  BODY_CODE                          = 2000433
  BODY2000433_RADII                  = (17.0, 5.5, 5.5)
  BODY_FRAME_CODE                    = 2000433
  INS-93001_SWAP_OBSERVER_TARGET     = TRUE
  INS-93001_LIGHTTIME_CORRECTION     = LT+S
  INS-93001_LT_SURFACE_CORRECT       = FALSE
  INS-93001_FOCAL_LENGTH             = 166.85
  INS-93001_PIXEL_PITCH              = 0.016
  CLOCK_ET_-93_126888978154_COMPUTED = c7d9130a781f5241
  INS-93001_TRANSX                   = (0.0, 0.016, 0.0)
  INS-93001_TRANSY                   = (0.0, 0.0, -0.016)
  INS-93001_ITRANSS                  = (0.0, 62.5, 0.0)
  INS-93001_ITRANSL                  = (0.0, 0.0, -62.5)
  INS-93001_BORESIGHT_LINE           = 206.5
  INS-93001_BORESIGHT_SAMPLE         = 269.0
  INS-93001_K1                       = -7.0e-05
End_Object
End
Loading