From cec1cd619996656fcb32f1cd2fca139bba02f0ad Mon Sep 17 00:00:00 2001 From: Yiming Zhang Date: Tue, 3 Dec 2024 11:34:02 +0800 Subject: [PATCH] Fix packed obs shape --- glue/sample/src/sinter/_decoding/_decoding_fusion_blossom.py | 2 +- glue/sample/src/sinter/_decoding/_decoding_mwpf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glue/sample/src/sinter/_decoding/_decoding_fusion_blossom.py b/glue/sample/src/sinter/_decoding/_decoding_fusion_blossom.py index ac3e5bfb..c43760fa 100644 --- a/glue/sample/src/sinter/_decoding/_decoding_fusion_blossom.py +++ b/glue/sample/src/sinter/_decoding/_decoding_fusion_blossom.py @@ -24,7 +24,7 @@ def decode_shots_bit_packed( bit_packed_detection_event_data: 'np.ndarray', ) -> 'np.ndarray': num_shots = bit_packed_detection_event_data.shape[0] - predictions = np.zeros(shape=(num_shots, self.num_obs), dtype=np.uint8) + predictions = np.zeros(shape=(num_shots, (self.num_obs + 7) // 8), dtype=np.uint8) import fusion_blossom for shot in range(num_shots): dets_sparse = np.flatnonzero(np.unpackbits(bit_packed_detection_event_data[shot], count=self.num_dets, bitorder='little')) diff --git a/glue/sample/src/sinter/_decoding/_decoding_mwpf.py b/glue/sample/src/sinter/_decoding/_decoding_mwpf.py index 461cbc0f..dfe1129c 100644 --- a/glue/sample/src/sinter/_decoding/_decoding_mwpf.py +++ b/glue/sample/src/sinter/_decoding/_decoding_mwpf.py @@ -38,7 +38,7 @@ def decode_shots_bit_packed( bit_packed_detection_event_data: "np.ndarray", ) -> "np.ndarray": num_shots = bit_packed_detection_event_data.shape[0] - predictions = np.zeros(shape=(num_shots, self.num_obs), dtype=np.uint8) + predictions = np.zeros(shape=(num_shots, (self.num_obs + 7) // 8), dtype=np.uint8) import mwpf for shot in range(num_shots):