Skip to content

Commit 06eac0d

Browse files
committed
Fix a typo which introduced a bug in PR #1522.
Found through use of some new integration tests in `sopipetest`, PR will be opened soon with those.
1 parent 6a424e1 commit 06eac0d

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

sotodlib/toast/ops/load_context.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2022-2024 Simons Observatory.
22
# Full license can be found in the top level "LICENSE" file.
33

4+
import copy
45
import re
56
import sqlite3
67
import yaml
@@ -596,7 +597,7 @@ def _exec(self, data, detectors=None, **kwargs):
596597

597598
# If we have an observation with a specific wafer, modify the detector
598599
# selection dictionary to include only that wafer.
599-
obs_dets_select = dets_select
600+
obs_dets_select = copy.deepcopy(dets_select)
600601
if obs_props[obindx]["wafer"] != "all":
601602
if obs_dets_select is None:
602603
obs_dets_select = dict()
@@ -722,6 +723,8 @@ def _load_metadata(self, obs_name, session_name, gcomm, dets_select, preproc_con
722723
# hence one reader).
723724
if rank == 0:
724725
# Load metadata
726+
msg = f"LoadContext {obs_name} metadata using dets_select={dets_select}"
727+
log.debug(msg)
725728
ctx = open_context(context=self.context, context_file=self.context_file)
726729
meta = ctx.get_meta(session_name, dets=dets_select)
727730
if self.context_file is not None:
@@ -755,7 +758,11 @@ def _load_metadata(self, obs_name, session_name, gcomm, dets_select, preproc_con
755758
band = fp_cols[
756759
f"det_info{self.ax_pathsep}wafer{self.ax_pathsep}bandpass"
757760
].data
758-
freq = [float(b[1:]) for b in band]
761+
762+
fpat = re.compile(r"^f[\d]+$")
763+
freq = [
764+
float(b[1:]) if fpat.match(b) is not None else 0.0 for b in band
765+
]
759766
bandcenter = np.array(freq) * u.GHz
760767
bandwidth = bandcenter * self.bandwidth
761768
fp_cols["bandcenter"] = Column(name="bandcenter", data=bandcenter)

sotodlib/toast/ops/load_context_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,14 @@ def _process_flag(mask, inbuf, detdata, det_begin, det_end, invert):
636636
# Just assign
637637
for idet in range(n_recv_det):
638638
if daq_units:
639-
nan_mask = np.isnan(recv_data[idet])
639+
nan_mask = np.isnan(recv_2d[idet])
640640
if np.count_nonzero(nan_mask) > 0:
641641
det_flags[idet] = 1
642-
obs.detdata[field][idet + recv_dets[0], :] = recv_data[
642+
obs.detdata[field][idet + recv_dets[0], :] = recv_2d[
643643
idet
644644
].astype(np.int32, casting="unsafe")
645645
else:
646-
obs.detdata[field][idet + recv_dets[0], :] = recv_data[idet]
646+
obs.detdata[field][idet + recv_dets[0], :] = recv_2d[idet]
647647
# Update per-detector flags
648648
dflags = {
649649
obs.local_detectors[recv_dets[0] + x]: defaults.det_mask_invalid

0 commit comments

Comments
 (0)