tqec.circuit.operations.operation.Observable

class Observable(measurement_data: Sequence[Measurement], observable_index: int = 0)[source]
__init__(measurement_data: Sequence[Measurement], observable_index: int = 0) None[source]

Operation representing an observable.

Since the operation is not a real quantum operation, it does not have qubits and is not applied to any qubits. This might cause surprising behavior if you try to append or insert it into a circuit. It is always recommended to containerize this operation in a cirq.Moment before appending it to a circuit.

In tqec, this kind of annotation operation should be tagged with the cirq.VirtualTag and the STIM_TAG to work correctly with the circuit transformation and the noise model. You can use the make_observable helper function to create an instance of this class with the correct tags. Otherwise, you might need to manually tag the operation with the cirq.VirtualTag and the STIM_TAG.

Warning

you should use make_observable to create instances of this class. To understand how to use this class directly, please refer to the documentation above.

Parameters:
  • measurement_data – a sequence of Measurement that form a group. There should be no duplicate in the provided sequence.

  • observable_index – index of the observable.

Methods

__init__(measurement_data[, observable_index])

Operation representing an observable.

controlled_by(*control_qubits[, control_values])

Returns a controlled version of this operation. If no control_qubits

transform_qubits(qubit_map)

Returns the same operation, but with different qubits.

validate_args(qubits)

Raises an exception if the qubits don't match this operation's qid shape.

with_classical_controls(*conditions)

Returns a classically controlled version of this operation.

with_probability(probability)

Creates a probabilistic channel with this operation.

with_qubits(*new_qubits)

Returns the same operation, but applied to different qubits.

with_tags(*new_tags)

Creates a new TaggedOperation, with this op and the specified tags.

without_classical_controls()

Removes all classical controls from the operation.

Attributes

classical_controls

The classical controls gating this operation.

gate

index

Return the index of the observable.

measurement_data

The recorded relative measurement data.

qubits

tags

Returns a tuple of the operation's tags.

untagged

Returns the underlying operation without any tags.