View source on GitHub |
Classical data representing measurements and metadata.
Inherits From: ClassicalDataStore
, ClassicalDataStoreReader
cirq.ClassicalDataDictionaryStore(
*,
_records: Optional[Dict['cirq.MeasurementKey', List[Tuple[int, ...]]]] = None,
_measured_qubits: Optional[Dict['cirq.MeasurementKey', List[Tuple['cirq.Qid', ...]]]] = None,
_channel_records: Optional[Dict['cirq.MeasurementKey', List[int]]] = None,
_measurement_types: Optional[Dict['cirq.MeasurementKey', 'cirq.MeasurementType']] = None
)
Methods
copy
copy()
Creates a copy of the object.
get_digits
get_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 0 refers to the first measurement, and -1 refers to
the most recent.
|
Raises | |
---|---|
KeyError
|
If the key has not been used or if the index is out of bounds. |
get_int
get_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 0 refers to the first measurement, and -1 refers to
the most recent.
|
Raises | |
---|---|
KeyError
|
If the key has not been used or if the index is out of bounds. |
keys
keys() -> Tuple['cirq.MeasurementKey', ...]
Gets the measurement keys in the order they were stored.
record_channel_measurement
record_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
record_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. |
__eq__
__eq__(
other: _SupportsValueEquality
) -> bool
__ne__
__ne__(
other: _SupportsValueEquality
) -> bool