From feb58177ad92aef94a2e444ff6045fd930f49a31 Mon Sep 17 00:00:00 2001 From: Joseph Spitale Date: Wed, 10 Dec 2025 13:49:32 -0700 Subject: [PATCH 1/2] safety push --- oops/backplane/limb.py | 23 +++++++++++++++++++---- oops/hosts/galileo/ssi/__init__.py | 10 ++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/oops/backplane/limb.py b/oops/backplane/limb.py index c7817574..e2e4739e 100755 --- a/oops/backplane/limb.py +++ b/oops/backplane/limb.py @@ -30,8 +30,9 @@ def limb_altitude(self, event_key, zmin=None, zmax=None, scaled=False): radius = body.surface.radii.max() if zmin is not None: zmin = zmin * radius - if zmin is not None: - zmax = zmax * radius + if zmax is not None: + if zmin is not None: + zmax = zmax * radius key = ('limb_altitude', event_key, zmin, zmax) if key in self.backplanes: @@ -159,7 +160,7 @@ def limb_latitude(self, event_key, lat_type='centric'): return self.register_backplane(key, latitude) #=============================================================================== -def limb_clock_angle(self, event_key): +def limb_clock_angle(self, event_key, zmin=None, zmax=None, scaled=False): """Angular location around the limb, measured clockwise from the projected north pole. @@ -168,8 +169,16 @@ def limb_clock_angle(self, event_key): limb_altitude backplane key, in which case this backplane inherits the mask of the given backplane array. + zmin lower limit on altitude; lower values are masked. + zmax upper limit on altitude. + scaled if True, zmin and zmax are in units of the maximum body radius. """ + # Get the altitude backplane + altitude_key = ('limb_altitude', event_key, zmin, zmax) + altitude = limb_altitude(self, event_key, zmin=zmin, zmax=zmax, scaled=scaled) + + # Create the clock angle backplane (event_key, backplane_key) = self._event_and_backplane_keys(event_key, LIMB_BACKPLANES, default='LIMB') @@ -194,8 +203,14 @@ def limb_clock_angle(self, event_key): event = polar_surface.apply_coords_to_event(event, obs=self.obs_event, axes=2, derivs=self.ALL_DERIVS) + clock_angle = event.coord2 + + ### use self._remasked_backplane + # copy altitude mask + if np.any(altitude.mask): + clock_angle = clock_angle.remask_or(altitude.mask) - return self.register_backplane(key, event.coord2) + return self.register_backplane(key, clock_angle) ################################################################################ diff --git a/oops/hosts/galileo/ssi/__init__.py b/oops/hosts/galileo/ssi/__init__.py index dbd04628..2e3a7680 100755 --- a/oops/hosts/galileo/ssi/__init__.py +++ b/oops/hosts/galileo/ssi/__init__.py @@ -42,7 +42,8 @@ def from_file(filespec, filespec = FCPath(filespec) # Load the PDS label - label = pds3.get_label(filespec) +# label = pds3.get_label(filespec) + label = pdsparser.PdsLabel.from_file(filespec).as_dict() # Load the data array local_path = filespec.retrieve() @@ -211,6 +212,8 @@ def __init__(self, meta_dict): self.target = meta_dict['TARGET_NAME'] # Telemetry mode + if not 'TELEMETRY_FORMAT_ID' in meta_dict: + meta_dict['TELEMETRY_FORMAT_ID'] = 'NONE' self.mode = meta_dict['TELEMETRY_FORMAT_ID'] # Window @@ -366,9 +369,12 @@ def initialize(planets=None, asof=None, SSI.fovs['HCM'] = fov_full # Inference based on inspection # hmmm, actually C0248807700R.img is 800x200 # maybe this is just a cropped full fov + SSI.fovs['NONE'] = fov_full # Inference based on inspection # Construct the SpiceFrame - _ = oops.frame.SpiceFrame("GLL_SCAN_PLATFORM") + # SSI images are spaced as closely as 1 unit in the file name, which + # corresponds to 80 clock ticks. Therefore, we use a tolerance of +/-40 + _ = oops.frame.SpiceType1Frame("GLL_SCAN_PLATFORM", -77, 40) # Load kernels Galileo.load_kernels() From 0f6090b5bad2276fa9a94b9801bb5564b4e34f0c Mon Sep 17 00:00:00 2001 From: Joseph Spitale Date: Thu, 11 Dec 2025 09:04:51 -0700 Subject: [PATCH 2/2] coderabbit fixes --- oops/backplane/limb.py | 4 +--- oops/hosts/galileo/ssi/__init__.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/oops/backplane/limb.py b/oops/backplane/limb.py index e2e4739e..a04d61b0 100755 --- a/oops/backplane/limb.py +++ b/oops/backplane/limb.py @@ -31,8 +31,7 @@ def limb_altitude(self, event_key, zmin=None, zmax=None, scaled=False): if zmin is not None: zmin = zmin * radius if zmax is not None: - if zmin is not None: - zmax = zmax * radius + zmax = zmax * radius key = ('limb_altitude', event_key, zmin, zmax) if key in self.backplanes: @@ -205,7 +204,6 @@ def limb_clock_angle(self, event_key, zmin=None, zmax=None, scaled=False): derivs=self.ALL_DERIVS) clock_angle = event.coord2 - ### use self._remasked_backplane # copy altitude mask if np.any(altitude.mask): clock_angle = clock_angle.remask_or(altitude.mask) diff --git a/oops/hosts/galileo/ssi/__init__.py b/oops/hosts/galileo/ssi/__init__.py index 2e3a7680..1b2452da 100755 --- a/oops/hosts/galileo/ssi/__init__.py +++ b/oops/hosts/galileo/ssi/__init__.py @@ -11,7 +11,6 @@ import pdsparser import oops -from oops.hosts import pds3 from oops.hosts.galileo import Galileo from filecache import FCPath @@ -42,7 +41,6 @@ def from_file(filespec, filespec = FCPath(filespec) # Load the PDS label -# label = pds3.get_label(filespec) label = pdsparser.PdsLabel.from_file(filespec).as_dict() # Load the data array @@ -212,7 +210,7 @@ def __init__(self, meta_dict): self.target = meta_dict['TARGET_NAME'] # Telemetry mode - if not 'TELEMETRY_FORMAT_ID' in meta_dict: + if 'TELEMETRY_FORMAT_ID' not in meta_dict: meta_dict['TELEMETRY_FORMAT_ID'] = 'NONE' self.mode = meta_dict['TELEMETRY_FORMAT_ID']