|  View source on GitHub | 
Helper class that provides a standard way to create an ABC using inheritance.
Inherits From: ClassicalDataStoreReader
| Attributes | |
|---|---|
| channel_records | Gets the a mapping from measurement key to channel measurement records. | 
| records | Gets the a mapping from measurement key to measurement records. | 
Methods
copy
@abc.abstractmethodcopy() -> Self
Creates a copy of the object.
get_digits
@abc.abstractmethodget_digits( key: cirq.MeasurementKey, index=-1 ) -> tuple[int, ...]
Gets the values of the qubits that were measured into this key.
For example, if the measurement of qubits [q0, q1] produces [0, 1], this function will return (0, 1).
| Args | |
|---|---|
| key | The measurement key. | 
| index | If multiple measurements have the same key, the index
argument can be used to specify which measurement to retrieve.
Here 0refers to the first measurement, and-1refers to
the most recent. | 
| Raises | |
|---|---|
| KeyError | If the key has not been used or if the index is out of bounds. | 
get_int
@abc.abstractmethodget_int( key: cirq.MeasurementKey, index=-1 ) -> int
Gets the integer corresponding to the measurement.
The integer is determined by summing the qubit-dimensional basis value of each measured qubit. For example, if the measurement of qubits [q1, q0] produces [1, 0], then the corresponding integer is 2, the big- endian equivalent. If they are qutrits and the measurement is [2, 1], then the integer is 2 * 3 + 1 = 7.
| Args | |
|---|---|
| key | The measurement key. | 
| index | If multiple measurements have the same key, the index
argument can be used to specify which measurement to retrieve.
Here 0refers to the first measurement, and-1refers to
the most recent. | 
| Raises | |
|---|---|
| KeyError | If the key has not been used or if the index is out of bounds. | 
keys
@abc.abstractmethodkeys() -> tuple[cirq.MeasurementKey, ...]
Gets the measurement keys in the order they were stored.
record_channel_measurement
@abc.abstractmethodrecord_channel_measurement( key: cirq.MeasurementKey, measurement: int )
Records a channel measurement.
| Args | |
|---|---|
| key | The measurement key to hold the measurement. | 
| measurement | The measurement result. | 
| Raises | |
|---|---|
| ValueError | If the measurement key was already used. | 
record_measurement
@abc.abstractmethodrecord_measurement( key: cirq.MeasurementKey, measurement: Sequence[int], qubits: Sequence[cirq.Qid] )
Records a measurement.
| Args | |
|---|---|
| key | The measurement key to hold the measurement. | 
| measurement | The measurement result. | 
| qubits | The qubits that were measured. | 
| Raises | |
|---|---|
| ValueError | If the measurement shape does not match the qubits measured or if the measurement key was already used. |