Skip to content
Snippets Groups Projects
Commit e2c03391 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Pfeffernusse Loading Fixes (#384)

* Allow ALE to find both caps and not caps metakernels

* Label loading fix when given a PVLModule

* Remove old hard coded sensor_frame_id as kernel updates have fixed this

* Removed sensor_frame_id test as it's no longer being overwritten

* Reverted additional frame removal and updated frame chain with ISIS iak frame rotation

* Made the frame chain construct a completely different frame chain instead of using the frame chain from super

* Reverted old test and added new frame chain test

* Updated spacing and added a doc string

* Added check and test if the IAK frame is loaded
parent 1108cd9b
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,9 @@ class Pds3Label():
if not hasattr(self, "_label"):
if isinstance(self._file, pvl.PVLModule):
self._label = self._file
else:
try:
self._label = pvl.loads(self._file)
self._label = pvl.loads(self._file, strict=False)
except Exception:
self._label = pvl.load(self._file)
except:
......
......@@ -77,7 +77,6 @@ class CassiniIssPds3LabelNaifSpiceDriver(Framer, Pds3Label, NaifSpice, RadialDis
("P120","UV3"):2002.71
}
wac_filter_to_focal_length = {
("B2","CL2"):200.85,
("B2","IRP90"):200.83,
......@@ -291,11 +290,38 @@ class CassiniIssPds3LabelNaifSpiceDriver(Framer, Pds3Label, NaifSpice, RadialDis
-------
: int
NAIF's Wac sensor frame ID, or ALE's Nac sensor frame ID
"""
if self.instrument_id == "CASSINI_ISS_NAC":
return 14082360
elif self.instrument_id == "CASSINI_ISS_WAC":
return 14082361
@property
def frame_chain(self):
"""
Construct the initial frame chain using the original sensor_frame_id
obtained from the ikid. Then tack on the ISIS iak rotation.
Returns
-------
: Object
Custom Cassini ALE Frame Chain object for rotation computation and application
"""
if not hasattr(self, '_frame_chain'):
try:
# Call frinfo to check if the ISIS iak has been loaded with the
# additional reference frame. Otherwise, Fail and add it manually
spice.frinfo(self.sensor_frame_id)
self._frame_chain = super().frame_chain
except spice.utils.exceptions.NotFoundError as e:
self._frame_chain = FrameChain.from_spice(sensor_frame=self._original_naif_sensor_frame_id,
target_frame=self.target_frame_id,
center_ephemeris_time=self.center_ephemeris_time,
ephemeris_times=self.ephemeris_time,)
rotation = ConstantRotation([[0, 0, 1, 0]], self.sensor_frame_id, self._original_naif_sensor_frame_id)
self._frame_chain.add_edge(rotation=rotation)
return self._frame_chain
......@@ -5,7 +5,7 @@ import os
import numpy as np
from ale.drivers import co_drivers
import unittest
from unittest.mock import patch
from unittest.mock import PropertyMock, patch
import json
from conftest import get_image_label, get_image_kernels, get_isd, convert_kernels, compare_dicts
......@@ -88,3 +88,32 @@ class test_cassini_pds3_naif(unittest.TestCase):
def test_sensor_frame_id(self):
assert self.driver.sensor_frame_id == 14082360
@patch('ale.transformation.FrameChain.from_spice', return_value=ale.transformation.FrameChain())
def test_custom_frame_chain(self, from_spice):
with patch('ale.drivers.co_drivers.spice.bods2c', return_value=-12345) as bods2c, \
patch('ale.drivers.co_drivers.CassiniIssPds3LabelNaifSpiceDriver.target_frame_id', \
new_callable=PropertyMock) as target_frame_id, \
patch('ale.drivers.co_drivers.CassiniIssPds3LabelNaifSpiceDriver.ephemeris_start_time', \
new_callable=PropertyMock) as ephemeris_start_time:
ephemeris_start_time.return_value = .1
target_frame_id.return_value = -800
frame_chain = self.driver.frame_chain
assert len(frame_chain.nodes()) == 2
assert 14082360 in frame_chain.nodes()
assert -12345 in frame_chain.nodes()
from_spice.assert_called_with(center_ephemeris_time=2.4, ephemeris_times=[2.4], sensor_frame=-12345, target_frame=-800)
@patch('ale.transformation.FrameChain.from_spice', return_value=ale.transformation.FrameChain())
def test_custom_frame_chain_iak(self, from_spice):
with patch('ale.drivers.co_drivers.spice.bods2c', return_value=-12345) as bods2c, \
patch('ale.drivers.co_drivers.CassiniIssPds3LabelNaifSpiceDriver.target_frame_id', \
new_callable=PropertyMock) as target_frame_id, \
patch('ale.drivers.co_drivers.CassiniIssPds3LabelNaifSpiceDriver.ephemeris_start_time', \
new_callable=PropertyMock) as ephemeris_start_time, \
patch('ale.drivers.co_drivers.spice.frinfo', return_value=True) as frinfo:
ephemeris_start_time.return_value = .1
target_frame_id.return_value = -800
frame_chain = self.driver.frame_chain
assert len(frame_chain.nodes()) == 0
from_spice.assert_called_with(center_ephemeris_time=2.4, ephemeris_times=[2.4], nadir=False, sensor_frame=14082360, target_frame=-800)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment