Skip to content

Commit af629f1

Browse files
committed
fix: handle wire_sparse output in bucketed+electronics unstacking
process_event mis-handled the use_bucketed=True + include_electronics=True case: the electronics step converts each plane's buckets to a wire_sparse 3-tuple (active_signals, wire_indices, n_active), but the unstacking still treated it as the raw bucket triple and did int(sig[1]) on the wire-index array -> 'Only scalar arrays can be converted' TypeError. Add a dedicated output_format=='wire_sparse' branch producing the correct 3-tuple. Fixes test_electronics.py::test_bucketed_electronics (slow tier).
1 parent d093754 commit af629f1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tools/simulation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,16 @@ def process_event(self, deposits: DepositData, sim_params=None, key=None):
750750
'time': tks[mask].astype(np_host.int32),
751751
'values': chs[mask].astype(np_host.float32),
752752
}
753+
elif cfg.output_format == 'wire_sparse':
754+
# Bucketed + electronics: the electronics step converts each plane's
755+
# buckets into a wire_sparse 3-tuple (active_signals, wire_indices,
756+
# n_active), so stacked_signal carries those three arrays — not the
757+
# raw bucket triple handled below.
758+
out_active, out_wire_idx, out_n_active = stacked_signal
759+
for v in range(n_volumes):
760+
for p in range(n_readouts):
761+
response_signals[(v, p)] = (
762+
out_active[v, p], out_wire_idx[v, p], out_n_active[v, p])
753763
elif cfg.use_bucketed:
754764
out_buckets, out_num_active, out_ctk = stacked_signal
755765
pk = self.response_kernels[cfg.plane_names[0][0]]

0 commit comments

Comments
 (0)