cirq.ClassicalDataStore

Helper class that provides a standard way to create an ABC using inheritance.

Inherits From: ClassicalDataStoreReader

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

View source

Creates a copy of the object.

get_digits

View source

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

View source

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

View source

Gets the measurement keys in the order they were stored.

record_channel_measurement

View source

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

View source

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.