diff --git a/qec_util/performance/sampler.py b/qec_util/performance/sampler.py index 63b68d2..340dc99 100644 --- a/qec_util/performance/sampler.py +++ b/qec_util/performance/sampler.py @@ -71,7 +71,7 @@ def sample_failures( ) if "decode_batch" not in dir(decoder): raise TypeError("'decoder' does not have a 'decode_batch' method.") - + sampler = dem.compile_sampler() num_failures, num_samples = 0, 0 diff --git a/qec_util/util/syndrome.py b/qec_util/util/syndrome.py index 2423ef0..5fe4945 100644 --- a/qec_util/util/syndrome.py +++ b/qec_util/util/syndrome.py @@ -4,6 +4,21 @@ def get_syndromes(anc_meas: DataArray) -> DataArray: + """Returns the syndrome outcomes from the ancilla outcomes + for a memory experiment. + + Parameters + ---------- + anc_meas + Ancilla outcomes for the memory experiment. + Expected minimum set of coordinates: ``qec_round`` and ``meas_reset``. + + Returns + ------- + syndromes + Syndrome outcomes. + Coordinates: same coordinates as ``anc_meas``. + """ if anc_meas.meas_reset: return anc_meas @@ -13,6 +28,23 @@ def get_syndromes(anc_meas: DataArray) -> DataArray: def get_defects(syndromes: DataArray, frame: Optional[DataArray] = None) -> DataArray: + """Returns the defects from the syndrome outcomes for a memory experiment. + + Parameters + ---------- + syndromes + Syndrome outcomes of the memory experiment. + Expected coordinates: ``qec_round`` and ``anc_qubit``. + frame + Initial Pauli frame of the memory experiment. + Expected coordinates: ``anc_qubit``. + + Returns + ------- + defects + Defects. + Coordinates: ``qec_round`` and ``anc_qubit``. + """ shifted_syn = syndromes.shift(qec_round=1, fill_value=0) if frame is not None: @@ -23,6 +55,24 @@ def get_defects(syndromes: DataArray, frame: Optional[DataArray] = None) -> Data def get_final_defects(syndromes: DataArray, proj_syndrome: DataArray) -> DataArray: + """Returns the defects for the final round build from the ancilla outcomes + and the data qubit outcomes for a memory experiment. + + Parameters + ---------- + syndromes + Syndrome outcomes from the ancilla qubits in the memory experiment. + Expected coordinates: ``qec_round`` and ``anc_qubit``. + proj_syndromes + Syndrome outcomes built from the data qubit outcomes. + Expected coordinates: ``anc_qubit``. + + Returns + ------- + defects + Defects for the stabilizers in ``proj_syndromes``. + Coordinates: ``anc_qubit``. + """ last_round = syndromes.qec_round.values[-1] anc_qubits = proj_syndrome.anc_qubit.values