Skip to content

Commit

Permalink
Small fixes (#583)
Browse files Browse the repository at this point in the history
* Added missing camera version to lorri driver

* Minor fixes for ores drivers

* Minor fixes for viking drivers

* Cleaned up msi imports

* Removed drivers from disabled list that no longer need to be disabled

* Reverted enabling drivers for another PR

* Fixed orex tests

* Added changelog entries

* Added missing property tests for new horizons and viking

* Updated viking load tests failing to compare focal lengths

* Moved changelog entries to correct place

* Fixed small changelog typo
  • Loading branch information
acpaquette authored Mar 5, 2024
1 parent 6618a19 commit 54c3e7b
Show file tree
Hide file tree
Showing 13 changed files with 454 additions and 35 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ release.
- Fixed landed sensors to correctly project locally [#590](https://github.com/DOI-USGS/ale/pull/590)
- Fixed Hayabusa amica center time computation to match ISIS [#592](https://github.com/DOI-USGS/ale/pull/592)
- Set Lunar Oribter abberation correction to None as it is in ISIS [#593](https://github.com/DOI-USGS/ale/pull/593)
- Fixed missing sensor_model_version attribute on NewHorizonsLorriIsisLabelNaifSpiceDriver [#583](https://github.com/DOI-USGS/ale/pull/583)
- Fixed missing sensor_model_version attribute on VikingIsisLabelNaifSpiceDriver [#583](https://github.com/DOI-USGS/ale/pull/583)
- Fixed incorrect distortion look up in Orex camera when working with PolyCam images [#583](https://github.com/DOI-USGS/ale/pull/583)

## [0.10.0] - 2024-01-08

Expand Down
11 changes: 1 addition & 10 deletions ale/drivers/msi_drivers.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import os
import spiceypy as spice
import json
import numpy as np
import pvl

import ale
from ale.base import Driver
from ale.base.label_isis import IsisLabel
from ale.base.data_naif import NaifSpice
from ale.base.type_distortion import RadialDistortion, NoDistortion
from ale.base.type_sensor import Framer, LineScanner
from ale.util import generate_kernels_from_cube
from ale.base.type_distortion import NoDistortion
from ale.base.type_sensor import Framer
from ale.base.type_distortion import NoDistortion

Expand Down
4 changes: 4 additions & 0 deletions ale/drivers/nh_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def sensor_name(self):
def frame_chain(self):
self._props['exact_ck_times'] = False
return super().frame_chain

@property
def sensor_model_version(self):
return 2

class NewHorizonsLeisaIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, NoDistortion, Driver):
"""
Expand Down
60 changes: 45 additions & 15 deletions ale/drivers/osirisrex_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from ale.base.base import Driver
from ale.base.type_distortion import RadialDistortion

from ale import util

class OsirisRexCameraIsisLabelNaifSpiceDriver(Framer, IsisLabel, NaifSpice, RadialDistortion, Driver):
@property
def instrument_id(self):
Expand All @@ -26,6 +28,22 @@ def instrument_id(self):
"SamCam" : "SAMCAM"
}
return 'ORX_OCAMS_' + sensor_lookup[super().instrument_id]

@property
def polyCamFocusPositionNaifId(self):
"""
Returns the focal length specific Naif ID for USGS Astro
IAK distortion model look ups.
Returns
-------
: int
Special focal length specific Naif ID
"""
if self.instrument_id == "ORX_OCAMS_POLYCAM":
return self.label['IsisCube']['Instrument']['PolyCamFocusPositionNaifId']
else:
return None

@property
def sensor_name(self):
Expand All @@ -52,21 +70,6 @@ def exposure_duration(self):
"""
return self.label['IsisCube']['Instrument']['ExposureDuration'].value * 0.001


@property
def sensor_frame_id(self):
"""
Returns the Naif ID code for the sensor reference frame.
This is the frame of the OsirisRex instrument itself, and is not dependent on filter.
Returns
-------
: int
Naif ID code for the sensor frame
"""
return -64000


@property
def detector_center_line(self):
"""
Expand Down Expand Up @@ -120,4 +123,31 @@ def odtk(self):
if self.filter_name == "UNKNOWN":
return spice.gdpool('INS{}_OD_K'.format(self.ikid),0, 3).tolist()
else:
if self.polyCamFocusPositionNaifId != None:
return spice.gdpool('INS{focusId}_OD_K_{filter}'.format(focusId = self.polyCamFocusPositionNaifId, filter = self.filter_name),0, 3).tolist()
return spice.gdpool('INS{ikid}_OD_K_{filter}'.format(ikid = self.ikid, filter = self.filter_name),0, 3).tolist()

@property
def naif_keywords(self):
"""
Gets all default naif keywords as well as any naif keywords that
contain the special focal length specific Naif ID
Returns
-------
: dict
Dictionary of keywords and values that ISIS creates and attaches to the label
"""
return {**super().naif_keywords, **util.query_kernel_pool(f"*{self.polyCamFocusPositionNaifId}*")}

@property
def sensor_model_version(self):
"""
Returns the ISIS camera version
Returns
-------
: int
Camera version number
"""
return 1
22 changes: 18 additions & 4 deletions ale/drivers/viking_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,20 @@ def focal_length(self):
"""
if not hasattr(self, "_focal_length"):
if (self.spacecraft_name == "VIKING ORBITER 1"):
if (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A"):
if (self.sensor_name == "Visual Imaging Subsystem Camera A"):
self._focal_length = 474.398
elif (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B"):
elif (self.sensor_name == "Visual Imaging Subsystem Camera B"):
self._focal_length = 474.448
print("Setting focal")
elif (self.spacecraft_name == "VIKING ORBITER 2"):
if (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_A"):
if (self.sensor_name == "Visual Imaging Subsystem Camera A"):
self._focal_length = 474.610
elif (self.sensor_name == "VISUAL_IMAGING_SUBSYSTEM_CAMERA_B"):
elif (self.sensor_name == "Visual Imaging Subsystem Camera B"):
self._focal_length = 474.101
else:
raise Exception(f"Unknown viking instrument to get focal length: {self.spacecraft_name}, {self.sensor_name}")

return self._focal_length

@property
def detector_center_line(self):
Expand All @@ -152,6 +155,17 @@ def detector_center_line(self):
def detector_center_sample(self):
return 0

@property
def sensor_model_version(self):
"""
Returns the ISIS camera version
Returns
-------
: int
Camera version number
"""
return 1


class VikingIsisLabelIsisSpiceDriver(Framer, IsisLabel, IsisSpice, NoDistortion, Driver):
Expand Down
2 changes: 1 addition & 1 deletion tests/pytests/data/isds/f004a47_isd.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": null
"focal_length": 474.398
},
"detector_center": {
"line": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/pytests/data/isds/f004b65_isd.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": null
"focal_length": 474.61
},
"detector_center": {
"line": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/pytests/data/isds/f704b28_isd.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": null
"focal_length": 474.101
},
"detector_center": {
"line": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/pytests/data/isds/f735a00_isd.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"detector_sample_summing": 1,
"detector_line_summing": 1,
"focal_length_model": {
"focal_length": null
"focal_length": 474.448
},
"detector_center": {
"line": 0,
Expand Down
Loading

0 comments on commit 54c3e7b

Please sign in to comment.