diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf63aed9b5fdf82462682b531d7c184161f6d56..b811094e1cbad343ccc86b8bd2f567ac79d5649f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ release. ### Fixed - 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) - Bugfix for position and orientation for MSL cameras (driver MslMastcamPds3NaifSpiceDriver). Validated that Nav and Mast LBL files (for both left and right sensor) produce correctly positioned and oriented CSM cameras, that are self-consistent and consistent with a prior DEM for the site. [#580](https://github.com/DOI-USGS/ale/pull/580) +- Bug fix for ray direction for MSL. [#589](https://github.com/DOI-USGS/ale/pull/589) ### Changed - Removed the affine6p library and replaced affine6p's affine transformation with a numpy solution [#579](https://github.com/DOI-USGS/ale/pull/579) diff --git a/ale/base/type_sensor.py b/ale/base/type_sensor.py index eca9178018e1f57ae7e2c7f8909aed74ba94a212..8229b66c0ba91060ed081b8c7ae19536def0b4bd 100644 --- a/ale/base/type_sensor.py +++ b/ale/base/type_sensor.py @@ -612,4 +612,4 @@ class Cahvor(): : float Pixel size of a cahvor model instrument """ - return -self.focal_length/self.compute_h_s() + return self.focal_length/self.compute_h_s() diff --git a/ale/drivers/msl_drivers.py b/ale/drivers/msl_drivers.py index 4aa009a74c4dfb64026f32abdb1cfa7a2e4766ae..f4ab01c8aa46d64d68fc6ec61c2ec6282568eb49 100644 --- a/ale/drivers/msl_drivers.py +++ b/ale/drivers/msl_drivers.py @@ -126,7 +126,7 @@ class MslMastcamPds3NaifSpiceDriver(Cahvor, Framer, Pds3Label, NaifSpice, Cahvor : list<double> focal plane to detector lines """ - return [0, 0, -1/self.pixel_size] + return [0, 0, 1/self.pixel_size] @property def focal2pixel_samples(self): @@ -138,7 +138,7 @@ class MslMastcamPds3NaifSpiceDriver(Cahvor, Framer, Pds3Label, NaifSpice, Cahvor : list<double> focal plane to detector samples """ - return [0, -1/self.pixel_size, 0] + return [0, 1/self.pixel_size, 0] @property def sensor_model_version(self): @@ -181,10 +181,10 @@ class MslMastcamPds3NaifSpiceDriver(Cahvor, Framer, Pds3Label, NaifSpice, Cahvor if self.is_navcam: # Focal length in pixel as computed for a cahvor model. # See is_navcam() for an explanation. - return -(self.compute_h_s() + self.compute_v_s())/2.0 + return (self.compute_h_s() + self.compute_v_s())/2.0 - # For mast cam - return -super().focal_length + # For mast cam + return super().focal_length @property def pixel_size(self): @@ -200,5 +200,5 @@ class MslMastcamPds3NaifSpiceDriver(Cahvor, Framer, Pds3Label, NaifSpice, Cahvor # See is_navcam() for an explanation. return 1.0 - # For mast cam + # For mast cam return super().pixel_size diff --git a/tests/pytests/data/isds/msl_isd.json b/tests/pytests/data/isds/msl_isd.json index 87194f8e84aeb854769fffc2a87f5729d73e8dd0..fc8589bff0bb349ced699f8644d868425de6b8e7 100644 --- a/tests/pytests/data/isds/msl_isd.json +++ b/tests/pytests/data/isds/msl_isd.json @@ -226,7 +226,7 @@ "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": { - "focal_length": -34.0 + "focal_length": 34.0 }, "detector_center": { "line": 576.4026068104001, @@ -235,11 +235,11 @@ "focal2pixel_lines": [ 0, 0, - -136.49886775101947 + 136.49886775101947 ], "focal2pixel_samples": [ 0, - -136.49886775101947, + 136.49886775101947, 0 ], "optical_distortion": { @@ -301,4 +301,4 @@ ], "reference_frame": 1 } -} \ No newline at end of file +} diff --git a/tests/pytests/data/isds/msl_nadir_isd.json b/tests/pytests/data/isds/msl_nadir_isd.json index 5193198501f197f1773ca3c5132c0683a1ed6e13..f809ba0368dab6fc7cc75bd1fd1444ec28de28b8 100644 --- a/tests/pytests/data/isds/msl_nadir_isd.json +++ b/tests/pytests/data/isds/msl_nadir_isd.json @@ -217,7 +217,7 @@ "detector_sample_summing": 1, "detector_line_summing": 1, "focal_length_model": { - "focal_length": -34.0 + "focal_length": 34.0 }, "detector_center": { "line": 576.4026068104001, @@ -226,11 +226,11 @@ "focal2pixel_lines": [ 0, 0, - -136.49886775101947 + 136.49886775101947 ], "focal2pixel_samples": [ 0, - -136.49886775101947, + 136.49886775101947, 0 ], "optical_distortion": { @@ -292,4 +292,4 @@ ], "reference_frame": 1 } -} \ No newline at end of file +} diff --git a/tests/pytests/test_cahvor_mixin.py b/tests/pytests/test_cahvor_mixin.py index ad9b3a68d06895a95f0504424eeb0dafe4a686b4..b3ad22f4b41c2181c3328af7fcb791008cb8fa69 100644 --- a/tests/pytests/test_cahvor_mixin.py +++ b/tests/pytests/test_cahvor_mixin.py @@ -65,4 +65,4 @@ class test_cahvor_sensor(unittest.TestCase): @patch("ale.base.type_sensor.Cahvor.cahvor_camera_dict", new_callable=PropertyMock, return_value=cahvor_camera_dict()) def test_cahvor_pixel_size(self, cahvor_camera_dict): - assert self.driver.pixel_size == -0.007248034226138798 \ No newline at end of file + assert self.driver.pixel_size == 0.007248034226138798 \ No newline at end of file diff --git a/tests/pytests/test_msl_drivers.py b/tests/pytests/test_msl_drivers.py index c12d308c151d1c4dbd378029a5811e560489e1fa..e4565e7fc1913be89eea227cb028110be9a966cb 100644 --- a/tests/pytests/test_msl_drivers.py +++ b/tests/pytests/test_msl_drivers.py @@ -73,13 +73,13 @@ class test_mastcam_pds_naif(unittest.TestCase): def test_focal2pixel_lines(self): with patch('ale.drivers.msl_drivers.spice.bods2c', new_callable=PropertyMock, return_value=-76220) as bods2c, \ patch('ale.drivers.msl_drivers.spice.gdpool', new_callable=PropertyMock, return_value=[100]) as gdpool: - np.testing.assert_allclose(self.driver.focal2pixel_lines, [0, 0, -137.96844341513602]) + np.testing.assert_allclose(self.driver.focal2pixel_lines, [0, 0, 137.96844341513602]) bods2c.assert_called_with('MSL_MASTCAM_RIGHT') gdpool.assert_called_with('INS-76220_FOCAL_LENGTH', 0, 1) def test_focal2pixel_samples(self): with patch('ale.drivers.msl_drivers.spice.bods2c', new_callable=PropertyMock, return_value=-76220) as bods2c, \ patch('ale.drivers.msl_drivers.spice.gdpool', new_callable=PropertyMock, return_value=[100]) as gdpool: - np.testing.assert_allclose(self.driver.focal2pixel_samples, [0, -137.96844341513602, 0]) + np.testing.assert_allclose(self.driver.focal2pixel_samples, [0, 137.96844341513602, 0]) bods2c.assert_called_with('MSL_MASTCAM_RIGHT') gdpool.assert_called_with('INS-76220_FOCAL_LENGTH', 0, 1)