Skip to content

Commit

Permalink
Ignore warning about all-NaN slices
Browse files Browse the repository at this point in the history
  • Loading branch information
troyraen committed Dec 17, 2024
1 parent fc2bb99 commit bf4d320
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spectroscopy/code_src/mast_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ def JWST_group_spectra(df, verbose, quickplot):
fluxes_int = np.asarray(
[np.interp(wave_grid, tab_sel.iloc[idx]["wave"], tab_sel.iloc[idx]["flux"]) for idx in idx_good])
fluxes_units = [tab_sel.iloc[idx]["flux"].unit for idx in idx_good]

# Sometimes fluxes are all NaN. We'll leave these in and ignore the RuntimeWarning.
warnings.filterwarnings("ignore", message='All-NaN slice encountered', category=RuntimeWarning)
fluxes_stack = np.nanmedian(fluxes_int, axis=0)
if verbose:
print("Units of fluxes for each spectrum: {}".format(
Expand Down

0 comments on commit bf4d320

Please sign in to comment.