Skip to content

Commit

Permalink
Warn if no good calibrator measurements are available for a given cha…
Browse files Browse the repository at this point in the history
…nnel
  • Loading branch information
matteobachetti committed Dec 28, 2024
1 parent 39897b9 commit 6085327
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions srttools/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,10 +1423,18 @@ def main_cal(args=None):
snr = caltable["Counts"] / caltable["Data Std"]
N = len(caltable)
good = snr > args.snr_min
chans = list(set(caltable["Chan"]))

caltable = caltable[good]
logging.info(
f"{len(caltable)} good calibrator observations found above " f"SNR={args.snr_min} (of {N})"
)
for chan in chans:
good_chan = caltable["Chan"] == chan
if not np.any(good_chan):
warnings.warn(
f"No good data for channel {chan}. Try using the --snr-min option with some value lower than {args.snr_min}"
)
caltable.update()

if args.check:
Expand Down

0 comments on commit 6085327

Please sign in to comment.