Skip to content

Commit

Permalink
Merge pull request #922 from HERA-Team/allinpflags
Browse files Browse the repository at this point in the history
fix: only flag lstbin if all are flagged and NOT inpainted
  • Loading branch information
steven-murray authored Nov 30, 2023
2 parents 7005da8 + f19c965 commit 790428f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion hera_cal/lstbin_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ def lst_average(
# np.sum works the same for both masked and non-masked arrays.
meandata = np.sum(data * nsamples, axis=0)

lstbin_flagged = np.all(flags, axis=0)
lstbin_flagged = np.all(data.mask, axis=0)

if flag_below_min_N:
lstbin_flagged[ndays_binned < sigma_clip_min_N] = True

Expand Down
6 changes: 3 additions & 3 deletions hera_cal/tests/test_lstbin_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,11 @@ def test_inpaint_mode(self):
data=_data, nsamples=nsamples, flags=flags, inpainted_mode=True
)

# The data and std in the fully-flagged bin should be different, but Nsamples
# and Flags should be the same.
# The data, flags and std in the fully-flagged bin should be different, but
# Nsamples and Flags should be the same.
assert not np.allclose(df[0, 0, 0], di[0, 0, 0])
assert np.allclose(df[1:], di[1:])
assert np.allclose(ff, fi)
assert not np.allclose(ff, fi)
assert not np.allclose(stdf[0, 0, 0], stdi[0, 0, 0])
assert np.allclose(stdf[1:], stdi[1:])
assert np.allclose(nf, ni)
Expand Down

0 comments on commit 790428f

Please sign in to comment.