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

updates for Isis support (#277)

* Adds voyager driver and associated tests

* Dictionary diff changes and isis_formatter updates

* Removed unnecessary imports from MRO driver

* Removed voyager playground notebook

* Removed comments on test data.

* Added comments to isis_formatter

* Updated tests based on changes to the isis_formatter

* Updated sun_position again for light time correction

* Naif Keyword update (sledgehammer edition)

* updated test data

* renamed func

* updated as per comments

* passing tests

* getting call stack for python sometimes causes bus error

* removed debug prints

* Updated frame chain, tests, and other drivers

* Cleaned up some logic

* Updated mro test with new frame chain output

* Test updates to mostly quaternions and moves frame_trace into transformation.py

* Added USGS channel to the environment file

* Adds Spiceypy outside of the environment.yml

* Updated python version

* Reverted travis and environment files

* Added back spiceypy to environment file

* Moved channels and updated version

* Install python into the base env

* More messing with travis

* Travis syntax fix

* idk

* mes to mess

* added support for isis kernel group

* updated for isis support

* gettiing more tests passing

* removed notebook changes

* removed vis

* remove test notbook

* removed print

* changed cmakelists as per comments

* revert kaguya changes

* adressing comments

updated ale C++ tests

Updated how Angular Velocity is stored and computed in rotations (#275)

* Added angular velocity to rotations

* In progress commit

* Updated new AV calculations

* In progress commit

* More in progress

* In progress

* Updated rotation

* indexing error fix

* more clean up

* Fixed velocity rotation

* Removed commented line

updating voyager tests

updated testsw

updated tests

* fixed property
parent 3d2b4aa4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ if(BUILD_TESTS)
                        PRIVATE
                        GSL::gsl
                        GSL::gslcblas
                        ${PYTHON_LIBRARY}
                        Python::Python
                        PUBLIC
                        gtest ${CMAKE_THREAD_LIBS_INIT})
  enable_testing()
+2 −1
Original line number Diff line number Diff line
import pvl
import json

class Driver():
    """
@@ -221,7 +222,7 @@ class Driver():
        raise NotImplementedError

    @property
    def isis_naif_keywords(self):
    def naif_keywords(self):
        """
          Returns
        -------
+17 −17
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ class IsisSpice():
        """
        The hex encoded image start time computed from the
        spacecraft clock count
        Expects isis_naif_keywords to be defined. This should be a dict containing
        Expects naif_keywords to be defined. This should be a dict containing
        Naif keyworkds from the label.

        Returns
@@ -291,7 +291,7 @@ class IsisSpice():
            start time as a double
        """
        regex = re.compile('CLOCK_ET_.*_COMPUTED')
        for key in self.isis_naif_keywords:
        for key in self.naif_keywords:
            if re.match(regex, key[0]):
                # If the hex string is only numbers and contains leading 0s,
                # the PVL library strips them off (ie. 0000000000002040 becomes
@@ -325,7 +325,7 @@ class IsisSpice():
        list :
            The center of the CCD formatted as line, sample
        """
        return self.isis_naif_keywords.get('INS{}_BORESIGHT_SAMPLE'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_BORESIGHT_SAMPLE'.format(self.ikid), None)

    @property
    def detector_center_line(self):
@@ -339,7 +339,7 @@ class IsisSpice():
        list :
            The center of the CCD formatted as line, sample
        """
        return self.isis_naif_keywords.get('INS{}_BORESIGHT_LINE'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_BORESIGHT_LINE'.format(self.ikid), None)


    @property
@@ -394,7 +394,7 @@ class IsisSpice():
        """
        The line component of the affine transformation
        from focal plane coordinates to centered ccd pixels
        Expects isis_naif_keywords to be defined. This should be a dict containing
        Expects naif_keywords to be defined. This should be a dict containing
        Naif keyworkds from the label.
        Expects ikid to be defined. This should be the integer Naif ID code
        for the instrument.
@@ -405,14 +405,14 @@ class IsisSpice():
            The coefficients of the affine transformation
            formatted as constant, x, y
        """
        return self.isis_naif_keywords.get('INS{}_ITRANSL'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_ITRANSL'.format(self.ikid), None)

    @property
    def focal2pixel_samples(self):
        """
        The sample component of the affine transformation
        from focal plane coordinates to centered ccd pixels
        Expects isis_naif_keywords to be defined. This should be a dict containing
        Expects naif_keywords to be defined. This should be a dict containing
        Naif keyworkds from the label.
        Expects ikid to be defined. This should be the integer Naif ID code
        for the instrument.
@@ -423,7 +423,7 @@ class IsisSpice():
            The coefficients of the affine transformation
            formatted as constant, x, y
        """
        return self.isis_naif_keywords.get('INS{}_ITRANSS'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_ITRANSS'.format(self.ikid), None)

    @property
    def pixel2focal_x(self):
@@ -436,7 +436,7 @@ class IsisSpice():
        detector to focal plane x
        """

        return self.isis_naif_keywords.get('INS{}_TRANSX'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_TRANSX'.format(self.ikid), None)

    @property
    def pixel2focal_y(self):
@@ -449,13 +449,13 @@ class IsisSpice():
        detector to focal plane y
        """

        return self.isis_naif_keywords.get('INS{}_TRANSY'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_TRANSY'.format(self.ikid), None)

    @property
    def focal_length(self):
        """
        The focal length of the instrument
        Expects isis_naif_keywords to be defined. This should be a dict containing
        Expects naif_keywords to be defined. This should be a dict containing
        Naif keyworkds from the label.
        Expects ikid to be defined. This should be the integer Naif ID code
        for the instrument.
@@ -465,13 +465,13 @@ class IsisSpice():
        float :
            The focal length in millimeters
        """
        return self.isis_naif_keywords.get('INS{}_FOCAL_LENGTH'.format(self.ikid), None)
        return self.naif_keywords.get('INS{}_FOCAL_LENGTH'.format(self.ikid), None)

    @property
    def target_body_radii(self):
        """
        The triaxial radii of the target body
        Expects isis_naif_keywords to be defined. This should be a dict containing
        Expects naif_keywords to be defined. This should be a dict containing
        Naif keyworkds from the label.

        Returns
@@ -482,9 +482,9 @@ class IsisSpice():
            semiminor
        """
        regex = re.compile(r'BODY-?\d*_RADII')
        for key in self.isis_naif_keywords:
        for key in self.naif_keywords:
            if re.match(regex, key[0]):
                return self.isis_naif_keywords[key[0]]
                return self.naif_keywords[key[0]]

    @property
    def frame_chain(self):
@@ -547,7 +547,7 @@ class IsisSpice():


    @property
    def isis_naif_keywords(self):
    def naif_keywords(self):
        """
        The NaifKeywords group from the file label that
        contains stored values from the original SPICE
@@ -574,7 +574,7 @@ class IsisSpice():
        : list
          optical distortion coefficients
        """
        return self.isis_naif_keywords["INS{}_OD_K".format(self.ikid)]
        return self.naif_keywords["INS{}_OD_K".format(self.ikid)]

    @property
    def sensor_frame_id(self):
+15 −8
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@ class NaifSpice():
    def kernels(self):
        if not hasattr(self, '_kernels'):
            if 'kernels' in self._props.keys():
                try:
                    self._kernels = util.get_kernels_from_isis_pvl(self._props['kernels'])
                except Exception as e:
                    self._kernels =  self._props['kernels']
            else:
                if not ale.spice_root:
@@ -40,6 +43,7 @@ class NaifSpice():
                if search_results['count'] == 0:
                    raise ValueError(f'Failed to find metakernels. mission: {self.short_mission_name}, year:{self.utc_start_time.year}, versions="latest" spice root = "{ale.spice_root}"')
                self._kernels = [search_results['data'][0]['path']]

        return self._kernels

    @property
@@ -479,18 +483,21 @@ class NaifSpice():
            return False

    @property
    def isis_naif_keywords(self):
    def naif_keywords(self):
        """
        Returns
        -------
        : dict
          Dictionary of keywords and values that ISIS creates and attaches to the label
        """
        naif_keywords = dict()
        if not hasattr(self, "_naif_keywords"):
            self._naif_keywords = dict()

            self._naif_keywords['BODY{}_RADII'.format(self.target_id)] = self.target_body_radii
            self._naif_keywords['BODY_FRAME_CODE'] = self.target_frame_id
            self._naif_keywords['BODY_CODE'] = self.target_id

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

        naif_keywords['BODY{}_RADII'.format(self.target_id)] = self.target_body_radii
        naif_keywords['BODY_FRAME_CODE'] = self.target_frame_id
        naif_keywords['BODY_CODE'] = self.target_id
        return self._naif_keywords
        naif_keywords = {**naif_keywords, **util.query_kernel_pool(f"*{self.ikid}*")}
        return naif_keywords
+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ class AleJsonEncoder(json.JSONEncoder):
            return obj.isoformat()
        return json.JSONEncoder.default(self, obj)

def load(label, props={}, formatter='usgscsm', verbose=False):
def load(label, props={}, formatter='usgscsm', verbose=True):
    """
    Attempt to load a given label from all possible drivers

@@ -75,6 +75,6 @@ def load(label, props={}, formatter='usgscsm', verbose=False):
                traceback.print_exc()
    raise Exception('No Such Driver for Label')

def loads(label, props='', formatter='usgscsm', verbose=False):
def loads(label, props='', formatter='usgscsm', verbose=True):
    res = load(label, props, formatter, verbose=verbose)
    return json.dumps(res, cls=AleJsonEncoder)
Loading