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

Minirf fix (#569)


* Fixes LRO minirf driver

* Reverted gitignore

* Reverted sensor_frame_id override

* Added naifkeyword test for minirf

* Updated minirf json

* Updated doc strings

* fixed typo

* Updated changelog entry

---------

Co-authored-by: default avatarKelvin <krodriguez@usgs.gov>
parent ae705ef7
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ release.
- 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)
- Fixed LRO MiniRF drivers naif keywords focal to pixel and pixel to focal translations to be correct. [#569](https://github.com/DOI-USGS/ale/pull/569)
## [0.9.1] - 2023-06-05
......
......@@ -814,19 +814,21 @@ class LroMiniRfIsisLabelNaifSpiceDriver(Radar, NaifSpice, IsisLabel, Driver):
: float
start time
"""
return spice.str2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f"))
return spice.str2et(self.utc_start_time.strftime("%Y-%m-%d %H:%M:%S.%f")) - self.line_exposure_duration
@property
def ephemeris_stop_time(self):
"""
Returns the stop ephemeris time for the image.
Returns the stop ephemeris time for the image. This is computed from
the start time plus the line exposure per line, plus the line exposure
removed from the start time, plus the line exposure for the final line.
Returns
-------
: float
stop time
"""
return spice.str2et(self.utc_stop_time.strftime("%Y-%m-%d %H:%M:%S.%f"))
return self.ephemeris_start_time + (self.image_lines * self.line_exposure_duration) + (self.line_exposure_duration * 2)
@property
def look_direction(self):
......@@ -846,7 +848,6 @@ class LroMiniRfIsisLabelNaifSpiceDriver(Radar, NaifSpice, IsisLabel, Driver):
Returns the Naif ID code for the sensor reference frame
We replace this with the target frame ID because the sensor operates
entirely in the target reference frame
Returns
-------
: int
......@@ -854,7 +855,28 @@ class LroMiniRfIsisLabelNaifSpiceDriver(Radar, NaifSpice, IsisLabel, Driver):
"""
return self.target_frame_id
@property
def naif_keywords(self):
"""
Adds the correct TRANSX/Y and ITRANS/L values for use in ISIS. By default
these values are placeholders in the ISIS iaks and need to be computed manully
from the ground range resolution. See RadarGroundRangeMap.cpp in ISIS for
the calculations.
Returns
-------
: dict
An updated dictionary of NAIF keywords with the correct TRANSX/Y and ITRANSS/L
values computed
"""
naif_keywords = super().naif_keywords
ground_range_resolution = self.label['IsisCube']['Instrument']["ScaledPixelHeight"]
icode = "INS" + str(self.ikid)
naif_keywords[icode + "_TRANSX"] = [-1.0 * ground_range_resolution, ground_range_resolution, 0.0]
naif_keywords[icode + "_TRANSY"] = [0.0, 0.0, 0.0]
naif_keywords[icode + "_ITRANSS"] = [1.0, 1.0 / ground_range_resolution, 0.0]
naif_keywords[icode + "_ITRANSL"] = [0.0, 0.0, 0.0]
return naif_keywords
class LroLrocWacIsisLabelIsisSpiceDriver(PushFrame, IsisLabel, IsisSpice, RadialDistortion, Driver):
@property
......
This diff is collapsed.
......@@ -261,12 +261,20 @@ class test_miniRf(unittest.TestCase):
def test_ephmeris_start_time(self):
with patch('ale.drivers.lro_drivers.spice.str2et', return_value=12345) as str2et:
assert self.driver.ephemeris_start_time == 12345
assert self.driver.ephemeris_start_time == 12344.995295578527
def test_ephmeris_stop_time(self):
with patch('ale.drivers.lro_drivers.spice.str2et', return_value=12345) as str2et:
assert self.driver.ephemeris_stop_time == 12345
assert self.driver.ephemeris_stop_time == 12348.297799453276
@patch('ale.base.data_naif.NaifSpice.naif_keywords', new_callable=PropertyMock, return_value={})
def test_naif_keywords(self, naif_keywords):
with patch("ale.base.data_naif.spice.bods2c", return_value=12345) as bods2c:
print(self.driver.naif_keywords["INS12345_ITRANSL"])
np.testing.assert_array_almost_equal(self.driver.naif_keywords["INS12345_ITRANSL"], [0.0, 0.0, 0.0])
np.testing.assert_array_almost_equal(self.driver.naif_keywords["INS12345_ITRANSS"], [1.0, 0.13333333333333, 0])
np.testing.assert_array_almost_equal(self.driver.naif_keywords["INS12345_TRANSX"], [-7.5, 7.5, 0])
np.testing.assert_array_almost_equal(self.driver.naif_keywords["INS12345_TRANSY"], [0, 0, 0])
# ========= Test WAC isislabel and naifspice driver =========
class test_wac_isis_naif(unittest.TestCase):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment