loom.interpreter.detector

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.

class loom.interpreter.detector.Detector(*args, **kwargs)[source]

Bases: object

A detector is the parity of multiple syndromes. This dataclass does not store the actual value of a detector but instead the required information on how to calculate it given the output of a quantum circuit.

Parameters:

syndromes (tuple[Syndrome, ...]) – Syndromes that this detector corresponds to, in temporal order of measurement. NOTE: “Please ensure this order for proper functioning of the detector”

dumps()[source]

Return the detector as a JSON string. This string does not contain the complete Syndrome objects but only their UUIDs to not store redundant information.

Return type:

str

labels: dict[str, str | tuple[int, ...] | int] = FieldInfo(annotation=dict[str, Union[str, tuple[int, ...], int]], required=False, default_factory=dict)
property measurements: tuple[tuple[str, int] | Literal[1, 0], ...]

Returns the measurements of the constituent syndromes. The corrections must be used in a detector definition only once.

Returns:

The detector measurements

Return type:

tuple[Cbit, …]

rounds()[source]

Returns the rounds of the constituent syndromes

Returns:

The detector rounds

Return type:

tuple[int]

stabilizer()[source]

Returns the UUIDs of the stabilizer(s) of the constituent syndromes

Returns:

The UUIDs of the stabilizer(s) of the constituent syndromes.

Return type:

tuple[str]

syndromes: tuple[Syndrome, ...]