MeasureCriteria

class braket.circuits.noise_model.measure_criteria.MeasureCriteria(qubits=None)[source]

Bases: CircuitInstructionCriteria

This class models noise Criteria based on Measure instructions.

Parameters:

qubits (Union[Qubit, int, Iterable[Union[Qubit, int]], None])

Creates Measure-based Criteria.

Parameters:

qubits (QubitSetInput | None) – A set of relevant qubits. If no qubits are provided, all (possible) qubits are considered to be relevant.

applicable_key_types()[source]

Returns an Iterable of criteria keys.

Return type:

Iterable[CriteriaKey]

Returns:

Iterable[CriteriaKey] – This Criteria operates on Qubits.

get_keys(key_type)[source]

Gets the keys for a given CriteriaKey.

Parameters:

key_type (CriteriaKey) – The relevant Criteria Key.

Return type:

CriteriaKeyResult | set[Any]

Returns:

CriteriaKeyResult | set[Any] – The return value is based on the key type: QUBIT will return a set of qubit targets that are relevant to this Criteria, or CriteriaKeyResult.ALL if the Criteria is relevant for all (possible) qubits. All other keys will return an empty set.

to_dict()[source]

Converts a dictionary representing an object of this class into an instance of this class.

Return type:

dict

Returns:

dict – A dictionary representing the serialized version of this Criteria.

instruction_matches(instruction)[source]

Returns true if an Instruction matches the criteria.

Parameters:

instruction (Instruction) – An Instruction to match.

Return type:

bool

Returns:

bool – Returns true if the instruction is a Measure instruction and the target is a qubit (or set of qubits) provided in the constructor. If qubits were not provided in the constructor, then this method will accept any Measure instruction target.

classmethod from_dict(criteria)[source]

Deserializes a dictionary into a Criteria object.

Parameters:

criteria (dict) – A dictionary representation of a MeasureCriteria.

Return type:

Criteria

Returns:

Criteria – A deserialized MeasureCriteria represented by the passed in serialized data.