Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Ale dawn framing camera driver for ISIS3 Labels #567

Merged
merged 18 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ release.
## [Unreleased]

### 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

Expand Down
194 changes: 194 additions & 0 deletions ale/drivers/dawn_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

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

ID_LOOKUP = {
Expand Down Expand Up @@ -199,3 +201,195 @@ def detector_center_line(self):
center detector line
"""
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)
Empty file.
Loading
Loading