From 61496375f91e9cff8b3c0cc7b0edc1a52daa7b12 Mon Sep 17 00:00:00 2001 From: Melanie Clarke Date: Wed, 29 Jan 2025 15:34:13 -0500 Subject: [PATCH] Code style fixes --- .pre-commit-config.yaml | 1 - .ruff.toml | 4 ++-- jwst/barshadow/bar_shadow.py | 17 ++++------------- jwst/barshadow/barshadow_step.py | 8 ++------ 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b039994e5..354505050d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,6 @@ repos: jwst/associations/.* | jwst/background/.* | jwst/badpix_selfcal/.* | - jwst/barshadow/.* | jwst/charge_migration/.* | jwst/clean_flicker_noise/.* | jwst/combine_1d/.* | diff --git a/.ruff.toml b/.ruff.toml index acd3554d12..22a49444d1 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -29,7 +29,7 @@ exclude = [ "jwst/associations/**.py", "jwst/background/**.py", "jwst/badpix_selfcal/**.py", - "jwst/barshadow/**.py", + #"jwst/barshadow/**.py", "jwst/charge_migration/**.py", "jwst/clean_flicker_noise/**.py", "jwst/combine_1d/**.py", @@ -157,7 +157,7 @@ ignore-fully-untyped = true # Turn of annotation checking for fully untyped cod "jwst/associations/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] "jwst/background/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] "jwst/badpix_selfcal/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] -"jwst/barshadow/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] +#"jwst/barshadow/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] "jwst/charge_migration/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] "jwst/clean_flicker_noise/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] "jwst/combine_1d/**.py" = ["D", "N", "A", "ARG", "B", "C4", "ICN", "INP", "ISC", "LOG", "NPY", "PGH", "PTH", "S", "SLF", "SLOT", "T20", "TRY", "UP", "YTT", "E501"] diff --git a/jwst/barshadow/bar_shadow.py b/jwst/barshadow/bar_shadow.py index 911df8b6a6..ad5f27677e 100644 --- a/jwst/barshadow/bar_shadow.py +++ b/jwst/barshadow/bar_shadow.py @@ -115,10 +115,7 @@ def _calc_correction(slitlet, barshadow_model, source_type): # Correction only applies to extended/uniform sources correction = datamodels.SlitModel(data=np.ones(slitlet.data.shape)) if not has_uniform_source(slitlet, source_type): - log.info( - "Bar shadow correction skipped for " - f"slitlet {slitlet_number} (source not uniform)" - ) + log.info(f"Bar shadow correction skipped for slitlet {slitlet_number} (source not uniform)") return correction # No correction for zero length slitlets @@ -151,9 +148,7 @@ def _calc_correction(slitlet, barshadow_model, source_type): # so that the separation between the slit centers is 1, # i.e. slit height + interslit bar if slitlet.slit_yscale is None: - log.warning( - f"Slit height scale factor not found. Using default value {SLITRATIO}." - ) + log.warning(f"Slit height scale factor not found. Using default value {SLITRATIO}.") yslit = yslit / SLITRATIO else: yslit = yslit / slitlet.slit_yscale @@ -171,9 +166,7 @@ def _calc_correction(slitlet, barshadow_model, source_type): wcol = (wavelength - w0) / wave_increment # Interpolate the bar shadow correction for non-Nan pixels - correction.data = ndimage.map_coordinates( - shadow, [yrow, wcol], cval=np.nan, order=1 - ) + correction.data = ndimage.map_coordinates(shadow, [yrow, wcol], cval=np.nan, order=1) return correction @@ -398,7 +391,5 @@ def has_uniform_source(slitlet, force_type=None): return True else: # If there's no source type info, default to EXTENDED - log.info( - f"SRCTYPE not set for slitlet {slitlet.slitlet_id}; assuming EXTENDED." - ) + log.info(f"SRCTYPE not set for slitlet {slitlet.slitlet_id}; assuming EXTENDED.") return True diff --git a/jwst/barshadow/barshadow_step.py b/jwst/barshadow/barshadow_step.py index 8f02f1f0a4..47ef082705 100755 --- a/jwst/barshadow/barshadow_step.py +++ b/jwst/barshadow/barshadow_step.py @@ -54,12 +54,8 @@ def process(self, input_data): correction_pars = None # Get the name of the bar shadow reference file to use - self.barshadow_name = self.get_reference_file( - input_model, "barshadow" - ) - self.log.info( - f"Using BARSHADOW reference file {self.barshadow_name}" - ) + self.barshadow_name = self.get_reference_file(input_model, "barshadow") + self.log.info(f"Using BARSHADOW reference file {self.barshadow_name}") # Check for a valid reference file if self.barshadow_name == "N/A":