Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
cshanahan1 committed Dec 4, 2023
1 parent d6991f1 commit 6894ec8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions specreduce/tests/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ def test_fit_trace():
nddat = NDData(data=img, mask=mask, unit=u.DN)
warn_bins = np.arange(20)
warn_bins = ', '.join([str(x) for x in warn_bins])
msg = f"All pixels in bin 75 are masked. Falling to trace value from all-bin fit."
msg = f"All pixels in bin {warn_bins} are masked. Falling to trace value from all-bin fit."
with pytest.warns(UserWarning, match=msg):
FitTrace(nddat)

# could try to catch warning thrown for all-nan bins
3 changes: 1 addition & 2 deletions specreduce/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ def __post_init__(self):
warn_bins.append(i)
peak_y_i = peak_y


if self.peak_method == 'gaussian':
yy_i_above_half_max = np.sum(z_i > (z_i.max() / 2))
width_guess_i = yy_i_above_half_max / gaussian_sigma_to_fwhm
Expand Down Expand Up @@ -355,7 +354,7 @@ def __post_init__(self):
if len(warn_bins) > 20:
warn_bins = warn_bins[0: 10] + ['...'] + warn_bins[10: 19]
warnings.warn(f"All pixels in bin{plural} {', '.join([str(x) for x in warn_bins])}"
" are masked. Falling to trace value from all-bin fit.")
" are masked. Falling to trace value from all-bin fit.")

# recenter bin positions
x_bins = (x_bins[:-1] + x_bins[1:]) / 2
Expand Down

0 comments on commit 6894ec8

Please sign in to comment.