Skip to content

Commit 3993cd7

Browse files
committed
feat: add option to null out some flags when finding usable detectors and take in usable detector thresh as a cli arg
1 parent 5a61876 commit 3993cd7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

sotodlib/mapmaking/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,11 @@ def rangemat_sum(rangemat):
577577
res[i] = np.sum(ra[:,1]-ra[:,0])
578578
return res
579579

580-
def find_usable_detectors(obs, maxcut=0.1, glitch_flags: str = "flags.glitch_flags"):
581-
ncut = rangemat_sum(obs[glitch_flags])
580+
def find_usable_detectors(obs, maxcut=0.1, glitch_flags: str = "flags.glitch_flags", to_null : str = "flags.expected_flags"):
581+
flag = obs[glitch_flags]
582+
if to_null != "":
583+
flag *= ~obs[to_null]
584+
ncut = rangemat_sum(flag)
582585
good = ncut < obs.samps.count * maxcut
583586
return obs.dets.vals[good]
584587

sotodlib/site_pipeline/make_ml_map.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def get_parser(parser=None):
3333
parser.add_argument("-T", "--tiled" , type=int, default=1, help="0: untiled maps. Nonzero: tiled maps")
3434
parser.add_argument( "--srcsamp", type=str, default=None, help="path to mask file where True regions indicate where bright object mitigation should be applied. Mask is in equatorial coordinates. Not tiled, so should be low-res to not waste memory.")
3535
parser.add_argument( "--unit", type=str, default="uK", help="Unit of the maps")
36+
parser.add_argument( "--maxcut", type=float, default=.1, help="Maximum fraction of cut samples in a detector.")
3637
return parser
3738

3839
sens_limits = {"f030":120, "f040":80, "f090":100, "f150":140, "f220":300, "f280":750}
@@ -301,7 +302,7 @@ class DataMissing(Exception): pass
301302
# Calibrate to K_cmb
302303
#obs.signal = np.multiply(obs.signal.T, obs.abscal.abscal_cmb).T
303304
# Disqualify overly cut detectors
304-
good_dets = mapmaking.find_usable_detectors(obs)
305+
good_dets = mapmaking.find_usable_detectors(obs, args.maxcut)
305306
obs.restrict("dets", good_dets)
306307
if obs.dets.count == 0:
307308
to_skip += [sub_id]

0 commit comments

Comments
 (0)