Commit cb653b6a authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by Jesse Mapel
Browse files

fikid vars now included in naif_keywords. (#326)

* Fixes mex driver and adds fikid naif keywords into the naif keywords

* Update to the cmake list file to better interact with conda environments

* Changed calling value in test

* Updated instrument id test

* Test to see how the kernel list is coming out

* Reverted CMakeList file

* fikid now in kernel group

* unverbose

* reverted xfail

* IAKs now sorted to back of kernel list in image_2_data
parent fa805423
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -534,4 +534,9 @@ class NaifSpice():

            self._naif_keywords = {**self._naif_keywords, **util.query_kernel_pool(f"*{self.ikid}*"),  **util.query_kernel_pool(f"*{self.target_id}*")}

            try:
                self._naif_keywords = {**self._naif_keywords, **util.query_kernel_pool(f"*{self.fikid}*")}
            except AttributeError as error:
                pass

        return self._naif_keywords
+2 −3
Original line number Diff line number Diff line
@@ -506,8 +506,7 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD
            """
            if(super().instrument_id != "HRSC"):
                raise Exception ("Instrument ID is wrong.")

            return super().instrument_id
            return self.label['IsisCube']['Archive']['DetectorId']

        @property
        def sensor_model_version(self):
@@ -587,7 +586,7 @@ class MexHrscIsisLabelNaifSpiceDriver(LineScanner, IsisLabel, NaifSpice, RadialD

            Expects filter_number to be defined. This should be an integer containing
            the filter number from the pds3 label.
            Expects ikid to be defined. This should be the integer Naid ID code for
            Expects ikid to be defined. This should be the integer Naif ID code for
            the instrument.

            Returns
+3 −1
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ target_link_libraries(runAleTests
                      GSL::gslcblas
                      Eigen3::Eigen
                      gtest
                      Threads::Threads)
                      Threads::Threads
                      nlohmann_json::nlohmann_json
                      )

gtest_discover_tests(runAleTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/ctests)
+2 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ image_2_data = {}
for d in dirs:
    tmp = os.path.join(data_root, d)
    image_2_data[d] = [os.path.join(tmp, f) for f in os.listdir(tmp) if not f.startswith('.') and os.path.splitext(f)[1] != '.lbl']
    # force IAKs to the back of the list
    image_2_data[d] = sorted(image_2_data[d], key=lambda x: "Addendum" in x)

def get_image_label(image, label_type='pds3'):
    if not isinstance(image, str):
+101 −38
Original line number Diff line number Diff line
@@ -283,7 +283,69 @@ def usgscsm_compare_dict():
      176.63,
      350.89198226,
      0.0
    ]
    ],
    "INS-41218_ITRANSL": [
      -7113.11359717265,
      0.062856784318668,
      142.857129028729
    ],
    "INS-41218_ITRANSS": [
      -0.778052433438109,
      -142.857129028729,
      0.062856784318668
    ],
    "INS-41218_FOV_SHAPE": "RECTANGLE",
    "INS-41218_PIXEL_SIZE": [
      7.0,
      7.0
    ],
    "INS-41218_CK_REFERENCE_ID": 1.0,
    "INS-41218_FOV_FRAME": "MEX_HRSC_HEAD",
    "INS-41218_CCD_CENTER": [
      2592.5,
      0.5
    ],
    "INS-41218_CK_FRAME_ID": -41001.0,
    "INS-41218_F/RATIO": 5.6,
    "INS-41218_PIXEL_SAMPLES": 5184.0,
    "INS-41218_BORESIGHT_SAMPLE": 2592.5,
    "INS-41218_FILTER_BANDWIDTH": 90.0,
    "INS-41218_BORESIGHT_LINE": 0.0,
    "INS-41218_PIXEL_LINES": 1.0,
    "INS-41218_FOCAL_LENGTH": 174.82,
    "INS-41218_FOV_ANGULAR_SIZE": [
      0.2,
      4e-05
    ],
    "INS-41218_FILTER_BANDCENTER": 970.0,
    "INS-41218_TRANSX": [
      0.016461898406507,
      -0.006999999322408,
      3.079982431615e-06
    ],
    "INS-41218_TRANSY": [
      49.7917927568053,
      3.079982431615e-06,
      0.006999999322408
    ],
    "INS-41218_FOV_BOUNDARY_CORNERS": [
      18.1982,
      49.9121,
      175.0,
      18.1982,
      49.9051,
      175.0,
      -18.1693,
      49.8901,
      175.0,
      -18.1693
    ],
    "INS-41218_BORESIGHT": [
      0.0151,
      49.9039,
      175.0
    ],
    "INS-41218_IFOV": 4e-05
  },
  "InstrumentPointing": {
    "TimeDependentFrames": [
@@ -368,10 +430,10 @@ def usgscsm_compare_dict():
    ],
    "Quaternions": [
      [
        -0.6525755651363002,
        -0.023151423913928198,
        0.31744150842891783,
        -0.6876336467074379
        -0.6525755651363003,
        -0.0231514239139282,
        0.3174415084289179,
        -0.6876336467074378
      ],
      [
        -0.6531746247480361,
@@ -380,17 +442,17 @@ def usgscsm_compare_dict():
        -0.6870646329712322
      ],
      [
        -0.6534739684048749,
        -0.022736404778153124,
        0.3174715036099805,
        -0.6867799304803299
        -0.6534739684048748,
        -0.022736404778153148,
        0.31747150360998055,
        -0.68677993048033
      ]
    ],
    "AngularVelocity": [
      [
        3.162398161513711e-05,
        -2.880303177599155e-05,
        5.65207273177886e-05
        3.1623981615137114e-05,
        -2.8803031775991542e-05,
        5.6520727317788564e-05
      ],
      [
        3.162398161506756e-05,
@@ -398,8 +460,8 @@ def usgscsm_compare_dict():
        5.652072731743428e-05
      ],
      [
        3.162398161503279e-05,
        -2.8803031777148904e-05,
        3.1623981615032794e-05,
        -2.8803031777148914e-05,
        5.6520727317257115e-05
      ]
    ]
@@ -415,36 +477,36 @@ def usgscsm_compare_dict():
    ],
    "Positions": [
      [
        3508.7678822054836,
        -1180.090578774873,
        -404.6580659358623
        3508.767882205483,
        -1180.0905787748716,
        -404.6580659358628
      ],
      [
        3509.6584138014186,
        -1143.4324359500306,
        -502.6029463204845
        -1143.4324359500313,
        -502.6029463204848
      ],
      [
        3509.4431532823473,
        -1124.8866548757126,
        -551.4851113671581
        -1124.886654875713,
        -551.4851113671591
      ]
    ],
    "Velocities": [
      [
        0.0720400832434136,
        1.478737567336345,
        -3.9872650791431576
        0.07204008324341263,
        1.4787375673363454,
        -3.987265079143158
      ],
      [
        0.0003930097221540194,
        1.502497160864039,
        -3.978142968407851
        0.0003930097221548436,
        1.5024971608640412,
        -3.9781429684078495
      ],
      [
        -0.03540185319234352,
        1.5140837760694028,
        -3.972834676104136
        -0.03540185319234399,
        1.5140837760694033,
        -3.9728346761041364
      ]
    ]
  },
@@ -457,16 +519,16 @@ def usgscsm_compare_dict():
    ],
    "Positions": [
      [
        97397666.49661356,
        97397666.49661352,
        -201380879.84291452,
        -94392949.8261708
        -94392949.82617083
      ]
    ],
    "Velocities": [
      [
        21.260857263715938,
        7.173395648419857,
        2.73958955646446
        21.26085726371221,
        7.17339564842172,
        2.739589556465391
      ]
    ]
  }
@@ -478,6 +540,7 @@ def test_kernels():
    kernels = get_image_kernels('h5270_0000_ir2')
    updated_kernels, binary_kernels = convert_kernels(kernels)
    yield updated_kernels
    print(updated_kernels)
    for kern in binary_kernels:
        os.remove(kern)

@@ -632,7 +695,7 @@ class test_mex_isis3_naif(unittest.TestCase):
        self.driver =  MexHrscIsisLabelNaifSpiceDriver(label)

    def test_instrument_id(self):
        assert self.driver.instrument_id == 'HRSC'
        assert self.driver.instrument_id == 'MEX_HRSC_IR'

    def test_ikid(self):
        with patch('ale.drivers.mex_drivers.spice.bods2c', return_value=12345) as bods2c:
@@ -642,7 +705,7 @@ class test_mex_isis3_naif(unittest.TestCase):
    def test_fikid(self):
        with patch('ale.drivers.mex_drivers.spice.bods2c', return_value=12345) as bods2c:
            assert self.driver.fikid == 12345
            bods2c.assert_called_with('HRSC')
            bods2c.assert_called_with('MEX_HRSC_IR')

    def test_ephemeris_start_time(self):
        with patch('ale.drivers.mex_drivers.read_table_data', return_value=12345) as read_table_data, \