cirq.MeasurementKey

A class representing a Measurement Key.

Used in the notebooks

Used in the tutorials

Wraps a string key. If you just want the string measurement key, simply call str() on this.

name The string representation of the key.
path The path to this key in a circuit. In a multi-level circuit (one with repeated or nested subcircuits), we need to differentiate the keys that occur multiple times. The path is used to create such fully qualified unique measurement key based on where it occurs in the circuit. The path is outside-to-in, the outermost subcircuit identifier appears first in the tuple.

name Dataclass field
path Dataclass field

Methods

parse_serialized

View source

Parses the serialized string representation of Measurementkey into a MeasurementKey.

This is the only way to construct a MeasurementKey from a nested string representation (where the path is joined to the key name by the MEASUREMENT_KEY_SEPARATOR)

replace

View source

Returns a copy of this MeasurementKey with the specified changes.

with_key_path_prefix

View source

Adds the input path component to the start of the path.

Useful when constructing the path from inside to out (in case of nested subcircuits), recursively.

__eq__

View source

Return self==value.

__le__

View source

Return self<=value.

__lt__

View source

Return self<value.