braket.circuits.noise_model.noise_model module
- class braket.circuits.noise_model.noise_model.NoiseModelInstruction(noise: Noise, criteria: Criteria)[source]
Bases:
object
Represents a single instruction for a Noise Model.
- classmethod from_dict(noise_model_item: dict) NoiseModelInstruction [source]
Converts a dictionary representing an object of this class into an instance of this class.
- Parameters:
noise_model_item (dict) – A dictionary representation of an object of this class.
- Returns:
NoiseModelInstruction – An object of this class that corresponds to the passed in dictionary.
- class braket.circuits.noise_model.noise_model.NoiseModelInstructions(initialization_noise: list[NoiseModelInstruction], gate_noise: list[NoiseModelInstruction], readout_noise: list[NoiseModelInstruction])[source]
Bases:
object
Represents the instructions in a noise model, separated by type.
- initialization_noise: list[NoiseModelInstruction]
- gate_noise: list[NoiseModelInstruction]
- readout_noise: list[NoiseModelInstruction]
- class braket.circuits.noise_model.noise_model.NoiseModel(instructions: list[NoiseModelInstruction] | None = None)[source]
Bases:
object
A Noise Model can be thought of as a set of Noise objects, and a corresponding set of criteria for how each Noise object should be applied to a circuit. For example, a noise model may represent that every H gate that acts on qubit 0 has a 10% probability of a bit flip, and every X gate that acts on qubit 0 has a 20% probability of a bit flip, and 5% probability of a phase flip.
- property instructions: list[NoiseModelInstruction]
List all the noise in the NoiseModel.
- Returns:
list[NoiseModelInstruction] – The noise model instructions.
- add_noise(noise: Noise, criteria: Criteria) NoiseModel [source]
Modifies the NoiseModel to add noise with a given Criteria.
- insert_noise(index: int, noise: Noise, criteria: Criteria) NoiseModel [source]
Modifies the NoiseModel to insert a noise with a given Criteria at particular position.
- remove_noise(index: int) NoiseModel [source]
Removes the noise and corresponding criteria from the NoiseModel at the given index.
- Parameters:
index (int) – The index of the instruction to remove.
- Returns:
NoiseModel – This NoiseModel object.
- Throws:
- IndexError: If the provided index is not less than the number of noise (as returned
from items()).
- get_instructions_by_type() NoiseModelInstructions [source]
Returns the noise in this model by noise type.
- Returns:
NoiseModelInstructions – The noise model instructions.
- from_filter(qubit: QubitSetInput | None = None, gate: Gate | None = None, noise: type[Noise] | None = None) NoiseModel [source]
Returns a new NoiseModel from this NoiseModel using a given filter. If no filters are specified, the returned NoiseModel will be the same as this one.
- Parameters:
qubit (Optional[QubitSetInput]) – The qubit to filter. Default is None. If not None, the returned NoiseModel will only have Noise that might be applicable to the passed qubit (or qubit list, if the criteria acts on a multi-qubit Gate).
gate (Optional[Gate]) – The gate to filter. Default is None. If not None, the returned NoiseModel will only have Noise that might be applicable to the passed Gate.
noise (Optional[type[Noise]]) – The noise class to filter. Default is None. If not None, the returned NoiseModel will only have noise that is of the same class as the given noise class.
- Returns:
NoiseModel – A noise model containing Noise and Criteria that are applicable for the given filter.
- apply(circuit: Circuit) Circuit [source]
Applies this noise model to a circuit, and returns a new circuit that’s the
noisy
version of the given circuit. If multiple noise will act on the same instruction, they will be applied in the order they are added to the noise model.- Parameters:
circuit (Circuit) – a circuit to apply
noise
to.- Returns:
Circuit – A new circuit that’s a
noisy
version of the passed in circuit.
- classmethod from_dict(noise_dict: dict) NoiseModel [source]
Converts a dictionary representing an object of this class into an instance of this class.
- Parameters:
noise_dict (dict) – A dictionary representation of an object of this class.
- Returns:
NoiseModel – An object of this class that corresponds to the passed in dictionary.