tqecd.match.match_detectors_within_fragment#

match_detectors_within_fragment(flows: FragmentFlows | FragmentLoopFlows, qubit_coordinates: Mapping[int, tuple[float, ...]]) list[MatchedDetector][source]#

Match all the detectors that can be resolved without considering neighbouring fragments.

Some detectors only include measurements from one fragment. This is for example the case during the initialisation of any code: some measurements from the first round have a pre-defined value that should be constant in the absence of errors.

Note that this function ignores “trivial” flows to avoid trivial detectors to be matched on some particular cases (e.g., 1-round repetition code).

Parameters:
  • flows – pre-computed flows for the fragment of interest. If any detector is found, the involved flow(s) will be removed from the provided instance. This means that this parameter may be mutated inline.

  • qubit_coordinates – a mapping from qubit indices to coordinates. Used to annotate the matched detectors with the coordinates from the qubits involved in the measurement forming the detector.

Returns:

the list of all the detectors found.