Unverified Commit 82b3d45b authored by Anton Hibl's avatar Anton Hibl Committed by GitHub
Browse files

Adding Ale dawn framing camera driver for ISIS3 Labels (#567)



* added dawn driver, tests need to be adjusted to use pds and isis driver

* updating tests for isis3label driver

* updated import dependencies

* updated import dependencies again

* updated ephemeris timings

* updating tests a bit more

* adding a test label for isis3 driver tests

* fixes to exposure duration references

* adding isis label ISD

* test data updates

* testing changes

* Fixed pds3 load test truth data

* Updated needed transfer kernels

* Removed unnecessary kernels

* Adds fail state to instrument_id property

* adding changelog comments for addition of isis dawnfc driver

---------

Co-authored-by: default avataracpaquette <acp263@nau.edu>
parent a06a2788
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -37,6 +37,11 @@ release.


### Added
### Added
- Mariner10 IsisLabelNaifSpice driver, tests, and test data [#547](https://github.com/DOI-USGS/ale/pull/547)
- Mariner10 IsisLabelNaifSpice driver, tests, and test data [#547](https://github.com/DOI-USGS/ale/pull/547)
- DawnFC IsisLabelNaifSpice driver, tests, and test data [#567](https://github.com/DOI-USGS/ale/pull/567)

### Fixed
- Fixed LRO MiniRF drivers naif keywords focal to pixel and pixel to focal translations to be correct. [#563](https://github.com/DOI-USGS/ale/pull/563)



## [0.9.1] - 2023-06-05
## [0.9.1] - 2023-06-05


+194 −0
Original line number Original line Diff line number Diff line
@@ -6,8 +6,10 @@ from glob import glob


import ale
import ale
from ale.base import Driver
from ale.base import Driver
from ale.base.label_isis import IsisLabel
from ale.base.data_naif import NaifSpice
from ale.base.data_naif import NaifSpice
from ale.base.label_pds3 import Pds3Label
from ale.base.label_pds3 import Pds3Label
from ale.base.type_distortion import NoDistortion
from ale.base.type_sensor import Framer
from ale.base.type_sensor import Framer


ID_LOOKUP = {
ID_LOOKUP = {
@@ -199,3 +201,195 @@ class DawnFcPds3NaifSpiceDriver(Framer, Pds3Label, NaifSpice, Driver):
          center detector line
          center detector line
        """
        """
        return float(spice.gdpool('INS{}_CCD_CENTER'.format(self.ikid), 0, 2)[1]) + 0.5
        return float(spice.gdpool('INS{}_CCD_CENTER'.format(self.ikid), 0, 2)[1]) + 0.5

class DawnFcIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, NoDistortion, Driver):
    """
    Driver for reading Dawn ISIS3 Labels. These are Labels that have been ingested
    into ISIS from PDS EDR images but have not been spiceinit'd yet.
    """

    @property
    def instrument_id(self):
        """
        Returns an instrument id for uniquely identifying the instrument,
        but often also used to be piped into Spice Kernels to acquire
        IKIDS. Therefor they are the same ID that Spice expects in bods2c
        calls. Expect instrument_id to be defined in the IsisLabel mixin.
        This should be a string of the form

        Returns
        -------
        : str
          instrument id
        """
        if not hasattr(self, "_instrument_id"):
          instrument_id = super().instrument_id
          filter_number = self.filter_number
          self._instrument_id = "{}_FILTER_{}".format(ID_LOOKUP[instrument_id], filter_number)

        return self._instrument_id
    
    @property
    def filter_number(self):
        """
        Returns the instrument filter number from the ISIS bandbin group.
        This filter number is used in the instrument id to identify
        which filter was used when aquiring the data.

        Returns
        -------
         : int
           The filter number from the instrument
        """
        return self.label["IsisCube"]["BandBin"]["FilterNumber"]

    @property
    def spacecraft_name(self):
        """
        Returns the name of the spacecraft

        Returns
        -------
        : str
          spacecraft name
        """
        return self.label["IsisCube"]["Instrument"]["SpacecraftName"]

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

        Returns
        -------
        : str
          sensor name
        """
        return self.instrument_id

    @property
    def sensor_model_version(self):
        """
        Returns ISIS sensor model version

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

    @property
    def ikid(self):
        """
        Overridden to grab the ikid from the Isis Cube since there is no way to
        obtain this value with a spice bods2c call. Isis sets this value during
        ingestion, based on the original fits file.

        Returns
        -------
        : int
          Naif ID used to for identifying the instrument in Spice kernels
        """
        return self.label["IsisCube"]["Kernels"]["NaifFrameCode"]

    def filter_name(self):
        """
        Returns the filter used to identify the image

        Returns
        -------
        : str
          filter name
        """
        return self.label["IsisCube"]["BandBin"]["FilterName"]

    @property
    def detector_center_sample(self):
        """
        Returns center detector sample acquired from Spice Kernels.
        Expects ikid to be defined. This should be the integer Naif ID code for
        the instrument.

        We have to add 0.5 to the CCD Center because the Dawn IK defines the
        detector pixels as 0.0 being the center of the first pixel so they are
        -0.5 based.

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

    @property
    def detector_center_line(self):
        """
        Returns center detector line acquired from Spice Kernels.
        Expects ikid to be defined. This should be the integer Naif ID code for
        the instrument.

        We have to add 0.5 to the CCD Center because the Dawn IK defines the
        detector pixels as 0.0 being the center of the first pixel so they are
        -0.5 based.

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

    @property
    def ephemeris_start_time(self):
        """
        Compute the starting ephemeris time for a Dawn Frame camera. This is done
        via a spice call but 193 ms needs to be added to
        account for the CCD being discharged or cleared.

        Returns
        -------
        : float
          ephemeris start time
        """
        if not hasattr(self, '_ephemeris_start_time'):
            sclock = self.spacecraft_clock_start_count
            self._ephemeris_start_time = spice.scs2e(self.spacecraft_id, sclock)
            self._ephemeris_start_time += 193.0 / 1000.0
        return self._ephemeris_start_time

    @property
    def exposure_duration_ms(self):
        """
        Return the exposure duration in ms for a Dawn Frame camera.

        Returns
        -------
        : float
          exposure duration
        """
        return self.exposure_duration / 1000

    @property
    def ephemeris_stop_time(self):
        """
        Compute the ephemeris stop time for a Dawn Frame camera

        Returns
        -------
        : float
          ephemeris stop time
        """
        return self.ephemeris_start_time + self.exposure_duration_ms

    @property
    def ephemeris_center_time(self):
        """
        Compute the center ephemeris time for a Dawn Frame camera.

        Returns
        -------
        : float
          center ephemeris time
        """
        return self.ephemeris_start_time + (self.exposure_duration_ms / 2.0)
+0 −0

File mode changed from 100644 to 100755.

+372 −0
Original line number Original line Diff line number Diff line
Object = IsisCube
  Object = Core
    StartByte   = 65537
    Format      = Tile
    TileSamples = 512
    TileLines   = 512

    Group = Dimensions
      Samples = 1024
      Lines   = 1024
      Bands   = 1
    End_Group

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

  Group = Instrument
    SpacecraftName            = DAWN
    InstrumentId              = FC2
    SpacecraftClockStartCount = 488002612:246
    SpacecraftClockStopCount  = 488002614:244
    StartTime                 = 2015-170T16:15:46.345
    StopTime                  = 2015-170T16:15:48.337
    ExposureDuration          = 1800.000 <millisecond>
    PixelAveragingWidth       = 1
    PixelAveragingHeight      = 1
    TargetName                = CERES
    OriginalTargetName        = "1 CERES"
    OrbitNumber               = 0
    FirstLine                 = 17
    FirstLineSample           = 35
  End_Group

  Group = Archive
    FileName                = FC21A0038582_15170161546F6G.IMG
    SoftwareName            = TRAP
    SoftwareVersionId       = "Trap v4.16"
    DataSetName             = "DAWN FC2 RAW (EDR) CERES IMAGES V1.0"
    DataSetId               = DAWN-A-FC2-2-EDR-CERES-IMAGES-V1.0
    ProductId               = 0038582
    ProductType             = DATA
    StandardDataProductId   = FC_IMAGE
    ObservationId           = FC2_CSS_C5NadirSouthColor_001
    ProducerFullName        = "PABLO GUTIERREZ-MARQUES"
    ProducerInstitutionName = "MAX PLANCK INSTITUT FUER SONNENSYSTEMFORSCHUNG"
    ProductCreationTime     = 2017-11-25T21:56:50.000
    ProductVersionId        = G
    ReleaseId               = N/A
  End_Group

  Group = BandBin
    FilterNumber = 6
    Center       = 829
    Width        = 33
    FilterName   = NIR_F6
  End_Group

  Group = Kernels
    NaifFrameCode             = -203126
    LeapSecond                = $base/kernels/lsk/naif0012.tls
    TargetAttitudeShape       = ($base/kernels/pck/pck00009.tpc,
                                 $dawn/kernels/pck/dawn_ceres_SPG20160107.tpc,
                                 $dawn/kernels/pck/dawn_ceres_v00.tf)
    TargetPosition            = (Table, $dawn/kernels/tspk/de421.bsp,
                                 $dawn/kernels/tspk/sb_ceres_140724.bsp)
    InstrumentPointing        = (Table,
                                 $dawn/kernels/ck/dawn_sc_150615_150621.bc,
                                 $dawn/kernels/fk/dawn_v15.tf,
                                 $dawn/kernels/fk/dawn_fc_v3.bc)
    Instrument                = $dawn/kernels/ik/dawn_fc_v10.ti
    SpacecraftClock           = $dawn/kernels/sclk/DAWN_203_SCLKSCET.00091.tsc
    InstrumentPosition        = (Table,
                                 $dawn/kernels/spk/dawn_rec_150509-150630_1507-
                                 30_v1.bsp)
    InstrumentAddendum        = $dawn/kernels/iak/dawnfcAddendum002.ti
    ShapeModel                = $base/dems/Ceres_Dawn_FC_HAMO_DTM_DLR_Global_-
                                60ppd_Oct2016_prep.cub
    InstrumentPositionQuality = Reconstructed
    InstrumentPointingQuality = Reconstructed
    CameraVersion             = 2
    Source                    = isis
  End_Group
End_Object

Object = Label
  Bytes = 65536
End_Object

Object = Table
  Name                = InstrumentPointing
  StartByte           = 4272584
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (-203120, -203000, 1)
  ConstantFrames      = (-203126, -203120)
  ConstantRotation    = (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
  CkTableStartTime    = 488002614.62294
  CkTableEndTime      = 488002614.62294
  CkTableOriginalSize = 1
  FrameTypeCode       = 3
  Description         = "Created by spiceinit"
  Kernels             = ($dawn/kernels/ck/dawn_sc_150615_150621.bc,
                         $dawn/kernels/fk/dawn_v15.tf,
                         $dawn/kernels/fk/dawn_fc_v3.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            = 4272648
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = 488002614.62294
  SpkTableEndTime      = 488002614.62294
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = $dawn/kernels/spk/dawn_rec_150509-150630_150730_v1.b-
                         sp

  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           = 4272704
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (2000001, 1)
  CkTableStartTime    = 488002614.62294
  CkTableEndTime      = 488002614.62294
  CkTableOriginalSize = 1
  FrameTypeCode       = 2
  PoleRa              = (291.431, 0.0, 0.0)
  PoleDec             = (66.761, 0.0, 0.0)
  PrimeMeridian       = (170.488, 952.15323, 0.0)
  Description         = "Created by spiceinit"
  Kernels             = ($dawn/kernels/tspk/de421.bsp,
                         $dawn/kernels/tspk/sb_ceres_140724.bsp,
                         $base/kernels/pck/pck00009.tpc,
                         $dawn/kernels/pck/dawn_ceres_SPG20160107.tpc,
                         $dawn/kernels/pck/dawn_ceres_v00.tf)
  SolarLongitude      = 83.441085180005

  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            = 4272768
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = 488002614.62294
  SpkTableEndTime      = 488002614.62294
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = ($dawn/kernels/tspk/de421.bsp,
                          $dawn/kernels/tspk/sb_ceres_140724.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 = 4272824
  Bytes     = 2010
End_Object

Object = OriginalLabel
  Name      = IsisCube
  StartByte = 4259841
  Bytes     = 11656
End_Object

Object = NaifKeywords
  BODY_CODE                            = 2000001
  BODY2000001_RADII                    = (482.0, 482.0, 446.0)
  BODY_FRAME_CODE                      = 2000001
  INS-203126_FOCAL_LENGTH              = 150.08
  INS-203126_PIXEL_SIZE                = (14.004, 13.995)
  INS-203126_TRANSX                    = (0.0, 0.0140088, 0.0)
  INS-203126_TRANSY                    = (0.0, 0.0, 0.014)
  INS-203126_ITRANSS                   = (0.0, 71.383701673234, 0.0)
  INS-203126_ITRANSL                   = (0.0, 0.0, 71.428571428571)
  INS-203126_CCD_CENTER                = (511.5, 511.5)
  INS-203126_RAD_DIST_COEFF            = 9.2e-06
  CLOCK_ET_-203_488002612:246_COMPUTED = 76aa87355416bd41
End_Object
End
+122 −0
Original line number Original line Diff line number Diff line
KPL/PCK

Asteroid Ceres SPICE PCK file, DAWN SPG 2016-01-07 Solution
===========================================================================


Pedigree and Intended Usage
--------------------------------------------------------

     This PCK file contains Ceres rotation values that were determined
     during the stereo photogrammetric analysis of Dawn images during
     the creation of the HAMO DTM (see [1]). Users of this DTM should
     also use this planetary constants kernel for SPICE based image
     processing.


Organization
--------------------------------------------------------

     The sections of this file are as follows.

     Introductory Information:

         --   Version description

         --   Disclaimer

         --   Sources

     Pck Data:

         --   Orientation constants for asteroid Ceres

         --   Radii for asteroid Ceres

         --   GM for asteroid Ceres


Version Description
--------------------------------------------------------


     Version 1.0 -- August 29, 2016  -- Steve Joy, IGPP/UCLA
                                        Boris Semenov, NAIF/JPL

        Initial version.


Disclaimer
--------------------------------------------------------

     This constants file may not contain the parameter values that you
     prefer. Note that this file may be readily modified by you or
     anyone else. NAIF suggests that you inspect this file visually
     before proceeding with any critical or extended data processing.

     NAIF requests that you update the ``Version Description'' section
     if you modify the file.


Sources
--------------------------------------------------------

     The sources for the constants listed in this are:

        1) ``Dawn at Ceres - Shape Model and Rotational State'',
            Frank Preusker, et al., Lunar and Planet. Sci.
            Conf. abs. 1954, 2016.

        2) Official DAWN project PCK ``dawn_ceres_v05.tpc''


Orientation constants for asteroid Ceres
--------------------------------------------------------

     The inertial reference frame for Ceres constants is J2000; this is
     the default reference frame for PCK orientation data.

     The epoch of the constants is J2000; this is Julian ephemeris date
     (JED) 2451545.0.

     The NAIF integer code for Ceres is 2000001. See the NAIF_IDs
     required reading for further information on NAIF integer codes.

     The Ceres rotation constants provided below are from [1].

     \begindata

        BODY2000001_POLE_RA    = ( 291.431     0.0          0.0 )
        BODY2000001_POLE_DEC   = (  66.761     0.0          0.0 )
        BODY2000001_PM         = ( 170.488    952.15323     0.0 )

     \begintext


Radii for asteroid Ceres
--------------------------------------------------------

     The Ceres radii values provided below are from [2]. They are
     included in this PCK for completeness.

     \begindata

        BODY2000001_RADII      = ( 482     482     446    )

     \begintext


GM for asteroid Ceres
--------------------------------------------------------

     The Ceres GM value provided below is from [2]. It is included in
     this PCK for completeness.

     \begindata

        BODY2000001_GM         = ( 62.6325 )

     \begintext


End of PCK file.
Loading