From 3b6421d02fb3682a1417fa8a59a69761527f9264 Mon Sep 17 00:00:00 2001
From: Jesse Mapel <jmapel@usgs.gov>
Date: Wed, 30 Oct 2019 12:46:40 -0700
Subject: [PATCH] Updated Kaguya driver for LISM distortion

---
 ale/drivers/selene_drivers.py        | 34 ++++++++++++++++++++++++++--
 tests/pytests/test_kaguya_drivers.py |  6 +++--
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/ale/drivers/selene_drivers.py b/ale/drivers/selene_drivers.py
index aa5f699..76c273a 100644
--- a/ale/drivers/selene_drivers.py
+++ b/ale/drivers/selene_drivers.py
@@ -298,6 +298,34 @@ class KaguyaTcPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, Driver):
         """
         return spice.gdpool('INS{}_DISTORTION_COEF_Y'.format(self.ikid), 0, 4).tolist()
 
+    @property
+    def boresight_x(self):
+        """
+        Returns the x focal plane coordinate of the boresight.
+        Expects ikid to be defined. This should be the NAIF integer ID for the
+        sensor.
+
+        Returns
+        -------
+        : float
+          Boresight focal plane x coordinate
+        """
+        return spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 0, 1)[0]
+
+    @property
+    def boresight_y(self):
+        """
+        Returns the y focal plane coordinate of the boresight.
+        Expects ikid to be defined. This should be the NAIF integer ID for the
+        sensor.
+
+        Returns
+        -------
+        : float
+          Boresight focal plane x coordinate
+        """
+        return spice.gdpool('INS{}_BORESIGHT'.format(self.ikid), 1, 1)[0]
+
     @property
     def line_exposure_duration(self):
         """
@@ -368,9 +396,11 @@ class KaguyaTcPds3NaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, Driver):
 
         """
         return {
-            "kaguyatc": {
+            "kaguyalism": {
                 "x" : self._odkx,
-                "y" : self._odky
+                "y" : self._odky,
+                "boresight_x" : self.boresight_x,
+                "boresight_y" : self.boresight_y
             }
         }
 
diff --git a/tests/pytests/test_kaguya_drivers.py b/tests/pytests/test_kaguya_drivers.py
index a357707..9bdf7d4 100644
--- a/tests/pytests/test_kaguya_drivers.py
+++ b/tests/pytests/test_kaguya_drivers.py
@@ -138,9 +138,11 @@ def test_load(test_kernels):
         'focal2pixel_lines': [0, -142.85714285714286, 0],
         'focal2pixel_samples': [0, 0, -142.85714285714286],
         'optical_distortion': {
-            'kaguyatc': {
+            'kaguyalism': {
                 'x': [-0.0009649900000000001, 0.00098441, 8.5773e-06, -3.7438e-06],
-                'y': [-0.0013796, 1.3502e-05, 2.7251e-06, -6.193800000000001e-06]}},
+                'y': [-0.0013796, 1.3502e-05, 2.7251e-06, -6.193800000000001e-06],
+                'boresight_x' : -0.0725,
+                'boresight_y' : 0.0214}},
         'image_lines': 400,
         'image_samples': 3208,
         'name_platform': 'SELENE-M',
-- 
GitLab