![]() |
A class representing a Measurement Key.
cirq.value.MeasurementKey(
name: str, path: Tuple[str, ...] = dataclasses.field(default_factory=tuple)
)
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.
Args | |
---|---|
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. |
Attributes | |
---|---|
name
|
Dataclass field |
path
|
Dataclass field |
Methods
parse_serialized
@classmethod
parse_serialized( key_str: str )
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
replace(
**changes
) -> 'MeasurementKey'
Returns a copy of this MeasurementKey with the specified changes.
with_key_path_prefix
with_key_path_prefix(
*path_component
)
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__
__eq__(
other
) -> bool
Return self==value.
__le__
__le__(
other
)
Return self<=value.
__lt__
__lt__(
other
)
Return self<value.