Skip to content

Commit

Permalink
lo medium camera driver, tests, and data (#613)
Browse files Browse the repository at this point in the history
* 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: Kelvin Rodriguez <[email protected]>
  • Loading branch information
AustinSanders and Kelvinrr authored Sep 18, 2024
1 parent 8c522c6 commit 7d8a56d
Show file tree
Hide file tree
Showing 14 changed files with 371,221 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
172 changes: 170 additions & 2 deletions ale/drivers/lo_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
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
Expand Down Expand Up @@ -218,4 +219,171 @@ def naif_keywords(self):
f"INS{self.ikid}_ITRANSS": itranss,
f"INS{self.ikid}_ITRANSL": itransl}

return self._naif_keywords
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'
Loading

0 comments on commit 7d8a56d

Please sign in to comment.