Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
melanieclarke committed Jan 29, 2025
1 parent 50a49dd commit 6149637
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ repos:
jwst/associations/.* |
jwst/background/.* |
jwst/badpix_selfcal/.* |
jwst/barshadow/.* |
jwst/charge_migration/.* |
jwst/clean_flicker_noise/.* |
jwst/combine_1d/.* |
Expand Down
4 changes: 2 additions & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"]
Expand Down
17 changes: 4 additions & 13 deletions jwst/barshadow/bar_shadow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
8 changes: 2 additions & 6 deletions jwst/barshadow/barshadow_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 6149637

Please sign in to comment.