@@ -1273,7 +1273,7 @@ def save(self, proc_aman, source_aman):
1273
1273
if self .save_cfgs :
1274
1274
proc_aman .wrap (self .source_flags_name , source_aman )
1275
1275
1276
- def select (self , meta , proc_aman = None ):
1276
+ def select (self , meta , proc_aman = None , in_place = True ):
1277
1277
if self .select_cfgs is None :
1278
1278
return meta
1279
1279
if proc_aman is None :
@@ -1300,13 +1300,18 @@ def select(self, meta, proc_aman=None):
1300
1300
elif len (kinds ) != len (select_list ):
1301
1301
raise ValueError ("Length of kinds must match length of select_source, or just str" )
1302
1302
1303
- keep = np .zeros (meta .dets .count )
1303
+ keep_all = np .ones (meta .dets .count , dtype = bool )
1304
+
1304
1305
for source , kind , cut in zip (select_list , kinds , cuts ):
1305
1306
if source in source_flags ._fields :
1306
- keep += flag_cut_select (source_flags [source ], cut , kind )
1307
- meta .restrict ("dets" , meta .dets .vals [keep .astype ('bool' )])
1308
- source_flags .restrict ("dets" , source_flags .dets .vals [keep .astype ('bool' )])
1309
- return meta
1307
+ keep_all &= flag_cut_select (source_flags [source ], cut , kind )
1308
+
1309
+ if in_place :
1310
+ meta .restrict ("dets" , meta .dets .vals [keep_all ])
1311
+ source_flags .restrict ("dets" , source_flags .dets .vals [keep_all ])
1312
+ return meta
1313
+ else :
1314
+ return keep_all
1310
1315
1311
1316
class HWPAngleModel (_Preprocess ):
1312
1317
"""Apply hwp angle model to the TOD.
0 commit comments