loom.executor.converter

Copyright (c) Entropica Labs Pte Ltd 2025.

Use, distribution and reproduction of this program in its source or compiled form is prohibited without the express written consent of Entropica Labs Pte Ltd.

loom.executor.converter.detector_outcomes(measurement_counts_dict, detector_observable_list, detector_ref_parities=None, observable_ref_parities=None)[source]

Construct detector and observable parities from the raw device measurement results. If the reference parities of detectors and observable are not specified, the state of the detectors are computed w.r.t all zeros reference state.

Parameters:
  • measurement_counts_dict (dict) – The measurement outcomes from the device

  • detector_observable_list (list[tuple]) – List containing detector definitions in absolute indices e.g. [(“DETECTOR”, [Channel(classical_register_12, …)]), (“DETECTOR”, [Channel(classical_register_5, …)])]

  • detector_ref_parities (list[bool] | None) – reference parities of detectors

  • observable_ref_parities (list[bool] | None) – reference parities of observables

Returns:

detectors_parity, observable_parity – detectors_parity: Each detector’s parity w.r.t reference state observable_parity: Each observable’s parity w.r.t reference state

Return type:

tuple(np.ndarray, np.ndarray)

loom.executor.converter.detector_reference_states(reference_measurement_sample, detector_observable_list)[source]

Compute the state of detectors in the reference state (without noise)

Parameters:
  • reference_measurement_sample (list) – A list of syndrome measurements in the circuit under zero noise case.

  • detector_observable_list (list) – The list of all detectors and observables present in stim circuit. NOTE: Assumes that there is only one observable appended at the end of the list and all others before are detectors. To be fixed later

Return type:

tuple[list[bool], list[bool]]

Returns:

  • detector_ref_parity (list[bool]) – The outcome of each detectors’ reference state under zero noise

  • observable_ref_parity (list[bool]) – The outcome of the observable’s reference state under zero noise