Skip to content

QECCodePatch

Bases: Mapping[str, Instruction], Displayable

An instantiation of a QECCode on a set of qubits.

This object acts like a dict, where instruction names are the keys and the appropriate Instruction (mapped to the patch qubits) is returned. It also stores the PauliFrame for the data qubits, as this is the natural place for it.

Examples:

>>> from loqs.core import QECCode
>>> from loqs.core.recordables import QECCodePatch
>>> code = QECCode(instructions={}, template_qubits=["q0", "q1"], template_data_qubits=["q0"])
>>> patch = QECCodePatch(code=code, qubits=["Q0", "Q1"], pauli_frame="II")
>>> patch.qubits
['Q0', 'Q1']

QECCodePatch

QECCodePatch(code: 'QECCode', qubits: Sequence[str | int], pauli_frame: PauliFrameLike, data: dict | None = None)

Parameters:

Name Type Description Default
code 'QECCode'

See code.

required
qubits Sequence[str | int]

See qubits().

required
pauli_frame PauliFrameLike required
data dict | None

Tracked patch-specific data dictionary. If provided, it will be deep-copied to ensure independence of the new patch's state.

None

Attributes

Name Type Value Doc
data_qubits list[str | int] read-only property This patch's own data qubits (a subset of qubits()).

copy

copy(pauli_frame: PauliFrameLike | None = None) -> U

Create a copy of this QECCodePatch, deep-copying its tracked data.

Parameters:

Name Type Description Default
pauli_frame PauliFrameLike

A new Pauli frame to associate with the copied patch. If None (default), the copied patch retains the original patch's Pauli frame.

None

decode

Inherited static method from Serializable.decode().


display

Inherited method from Displayable.display().


dump

Inherited method from Serializable.dump().


encode

Inherited static method from Serializable.encode().


get

Inherited method from Mapping.


items

Inherited method from Mapping.


keys

Inherited method from Mapping.


load

Inherited class method from Serializable.load().


read

Inherited class method from Serializable.read().


serialize_function

Inherited static method from Serializable.serialize_function().


values

Inherited method from Mapping.


write

Inherited method from Serializable.write().