Skip to content

Commit

Permalink
Merge pull request #960 from HERA-Team/sc-suppress-warnigns
Browse files Browse the repository at this point in the history
Suppress mean of empty slice warnings in smooth_cal
  • Loading branch information
steven-murray authored Jul 17, 2024
2 parents 75f0d94 + 8e88bba commit 0e2852b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hera_cal/smooth_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def single_iterative_fft_dly(gains, wgts, freqs, conv_crit=1e-5, maxiter=100):
df = np.median(np.diff(freqs))
gains = deepcopy(gains)
gains[wgts <= 0] = np.nan
avg_gains = np.nanmean(gains, axis=0, keepdims=True)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="Mean of empty slice", category=RuntimeWarning)
avg_gains = np.nanmean(gains, axis=0, keepdims=True)
unflagged_channels = np.nonzero(np.isfinite(avg_gains[0]))
unflagged_range = slice(np.min(unflagged_channels), np.max(unflagged_channels) + 1)
avg_gains[~np.isfinite(avg_gains)] = 0
Expand Down

0 comments on commit 0e2852b

Please sign in to comment.