Skip to content

Commit

Permalink
Fix sonar scan failures on AMI changes (#9112)
Browse files Browse the repository at this point in the history
  • Loading branch information
emolter authored Jan 30, 2025
1 parent c4309b8 commit 2cfb80d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jwst/ami/ami_analyze_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
YO_COMM = 0.0


class BandpassError:
class BandpassError(Exception):
pass


Expand Down Expand Up @@ -124,6 +124,7 @@ def override_affine2d(self):
affine2d : Affine2d object
User-defined affine transform
"""
msg_defaulting = "\t **** DEFAULTING TO USE IDENTITY TRANSFORM ****"
try:
with asdf.open(self.affine2d, lazy_load=False) as af:
affine2d = utils.Affine2d(
Expand All @@ -141,7 +142,7 @@ def override_affine2d(self):

except FileNotFoundError:
self.log.info(f"File {self.affine2d} could not be found at the specified location.")
self.log.info("\t **** DEFAULTING TO USE IDENTITY TRANSFORM ****")
self.log.info(msg_defaulting)
affine2d = None

except KeyError:
Expand All @@ -151,14 +152,14 @@ def override_affine2d(self):
)
message2 = "See step documentation for info on creating a custom affine2d ASDF file."
self.log.info(message1 + message2)
self.log.info("\t **** DEFAULTING TO USE IDENTITY TRANSFORM ****")
self.log.info(msg_defaulting)
affine2d = None

except (IndexError, TypeError, ValueError):
message1 = f"Could not use affine2d from {self.affine2d}. "
message2 = "See documentation for info on creating a custom bandpass ASDF file."
self.log.info(message1 + message2)
self.log.info("\t **** DEFAULTING TO USE IDENTITY TRANSFORM ****")
self.log.info(msg_defaulting)
affine2d = None

else:
Expand Down

0 comments on commit 2cfb80d

Please sign in to comment.