deltakit.decode.utils.parse_stim_circuit#

deltakit.decode.utils.parse_stim_circuit(stim_circuit: Circuit, trim_circuit: bool = True, lexical_detectors: bool = True) tuple[NXDecodingGraph, list[set[DecodingEdge]], Circuit]#

Parse a Stim file into a decoding graph and the relevant logicals.

Parameters:
  • stim_circuit (stim.Circuit) – Input Stim circuit to parse.

  • trim_circuit (bool, optional) – If True, the output will be trimmed to only include the parts relevant to the logicals specified, by default True.

  • lexical_detectors (bool, optional) – If True, the detectors in the stim file will be re-ordered to coordinate lexical order. No detector will move in a way that changes the meaning of the detector. By default True.

Returns:

The decoding graph, the logicals, and the Stim circuit. The Stim circuit will be unchanged unless trim_circuit is set, in which case a copy of the Stim circuit with only the trimmed detectors is returned.

Return type:

Tuple[NXDecodingGraph, List[Set[DecodingEdge]], stim.Circuit]