tqec.circuit.schedule.circuit.ScheduledCircuit#

class ScheduledCircuit(moments: list[Moment], schedule: Schedule | list[int] | int, qubit_map: QubitMap, _avoid_checks: bool = False)[source]#
__init__(moments: list[Moment], schedule: Schedule | list[int] | int, qubit_map: QubitMap, _avoid_checks: bool = False) None[source]#

Represent a quantum circuit with scheduled moments.

This class aims at representing a stim.Circuit instance that has all its moments scheduled, i.e., associated with a time slice.

This class explicitly does not support stim.CircuitRepeatBlock (i.e., REPEAT instruction). It will raise an exception if such an instruction is found.

Parameters:
  • moments – moments representing the computation that is scheduled. The provided moments should not contain any QUBIT_COORDS instructions. Instead, the qubit coordinates should be provided through the qubit_map parameter.

  • schedule – schedule of the provided moments. If an integer is provided, each moment of the provided stim.Circuit is scheduled sequentially, starting by the provided integer.

  • qubit_map – a map from indices to qubits that is used to re-create QUBIT_COORDS instructions when generating a stim.Circuit.

  • _avoid_checks – if True, the inputs are not checked for pre-condition violation and it is up to the user to ensure that ScheduledCircuit pre-conditions are checked by the provided input.

Raises:
  • ScheduleError – if the provided schedule is invalid.

  • TQECException – if the provided circuit contains at least one stim.CircuitRepeatBlock instance.

  • TQECException – if the provided circuit contains at least one QUBIT_COORDS instruction after the first TICK instruction.

Methods

__init__(moments, schedule, qubit_map[, ...])

Represent a quantum circuit with scheduled moments.

add_to_schedule_index(schedule, moment)

Add the operations contained in the provided moment at the provided schedule.

append_annotation(instruction)

Append an annotation to the last moment.

append_new_moment(moment)

Schedule the provided Moment instance at the end of the circuit.

append_observable(index, targets)

Append an OBSERVABLE_INCLUDE instruction to the last moment.

empty()

filter_by_qubits(qubits_to_keep)

Filter the circuit to keep only the instructions that are applied on the provided qubits.

from_circuit(circuit[, schedule, qubit_map])

Build a ScheduledCircuit instance from a circuit and a schedule.

get_circuit([include_qubit_coords])

Build and return the stim.Circuit instance represented by self.

get_qubit_coords_definition_preamble()

Get a circuit with only QUBIT_COORDS instructions.

get_repeated_circuit(repetitions[, ...])

Build and return the stim.Circuit instance represented by self encapsulated in a REPEAT block.

map_qubit_indices(qubit_index_map[, inplace])

Map the qubits indices the ScheduledCircuit instance is applied on.

map_to_qubits(qubit_map[, inplace_qubit_map])

Map the qubits the ScheduledCircuit instance is applied on.

moment_at_schedule(schedule)

Get the Moment instance scheduled at the provided schedule.

Attributes

moments

num_measurements

qubit_map

qubits

schedule

scheduled_moments

Yields stim.Circuit instances representing a moment with their computed schedule.