Skip to content

Commit 2f3b679

Browse files
Correcting syndromes per shot in circuit-level example (#136)
In the current python circuit-level noise example, all syndromes are mistakenly processed each shot, rather than only the syndromes contained within a shot. This PR reshapes the syndromes into a new array, and corrects this behavior. --------- Signed-off-by: Justin Lietz <[email protected]> Signed-off-by: Melody Ren <[email protected]> Co-authored-by: Melody Ren <[email protected]>
1 parent 4df9939 commit 2f3b679

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.github/workflows/docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
- name: Build docs
7171
run: |
7272
cmake -S . -B "build" \
73+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
7374
-DCMAKE_BUILD_TYPE=Release \
7475
-DCMAKE_C_COMPILER=gcc-11 \
7576
-DCMAKE_CXX_COMPILER=g++-11 \

docs/sphinx/examples/qec/python/circuit_level_noise.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@
5656
logical_measurements = logical_measurements.flatten()
5757
print("LMz:\n", logical_measurements)
5858

59+
# organize data by shot and round if desired
60+
syndromes = syndromes.reshape((nShots, nRounds, syndromes.shape[1]))
61+
5962
# initialize a Pauli frame to track logical flips
6063
# through the stabilizer rounds
6164
pauli_frame = np.array([0, 0], dtype=np.uint8)
6265
for shot in range(0, nShots):
6366
print("shot:", shot)
64-
for syndrome in syndromes:
67+
for syndrome in syndromes[shot]:
6568
print("syndrome:", syndrome)
6669
# decode the syndrome
6770
convergence, result = decoder.decode(syndrome)

0 commit comments

Comments
 (0)