NoiseModel
- class braket.circuits.noise_model.noise_model.NoiseModelInstruction(noise, criteria)[source]
Bases:
objectRepresents a single instruction for a Noise Model.
- classmethod from_dict(noise_model_item)[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.
- Return type:
- Returns:
NoiseModelInstruction – An object of this class that corresponds to the passed in dictionary.
- class braket.circuits.noise_model.noise_model.NoiseModelInstructions(initialization_noise, gate_noise, readout_noise)[source]
Bases:
objectRepresents the instructions in a noise model, separated by type.
- Parameters:
initialization_noise (
list[NoiseModelInstruction])gate_noise (
list[NoiseModelInstruction])readout_noise (
list[NoiseModelInstruction])
- initialization_noise: list[NoiseModelInstruction]
- gate_noise: list[NoiseModelInstruction]
- readout_noise: list[NoiseModelInstruction]
- class braket.circuits.noise_model.noise_model.NoiseModel(instructions=None)[source]
Bases:
objectA 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.
- Parameters:
instructions (
list[NoiseModelInstruction] |None)
- supported_specifications = braket.circuits.circuit.Circuit | braket.program_sets.program_set.ProgramSet
- property instructions: list[NoiseModelInstruction]
List all the noise in the NoiseModel.
- Returns:
list[NoiseModelInstruction] – The noise model instructions.
- add_noise(noise, criteria)[source]
Modifies the NoiseModel to add noise with a given Criteria.
- Parameters:
- Return type:
- Returns:
NoiseModel – This NoiseModel object.
- insert_noise(index, noise, criteria)[source]
Modifies the NoiseModel to insert a noise with a given Criteria at particular position.
- Parameters:
- Return type:
- Returns:
NoiseModel – This NoiseModel object.
- remove_noise(index)[source]
Removes the noise and corresponding criteria from the NoiseModel at the given index.
- Parameters:
index (int) – The index of the instruction to remove.
- Return type:
- 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()[source]
Returns the noise in this model by noise type.
- Return type:
- Returns:
NoiseModelInstructions – The noise model instructions.
- from_filter(qubit=None, gate=None, noise=None)[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 (QubitSetInput | None) – 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 (Gate | None) – 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 (type[Noise] | None) – 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.
- Return type:
NoiseModel
- Returns:
NoiseModel – A noise model containing Noise and Criteria that are applicable for the given filter.
- apply(task_specification)[source]
Applies this noise model to a circuit, and returns a new circuit that’s the
noisyversion 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:
task_specification (TaskSpecification) – a (supported) task to apply noise to see NoiseModel.supported_specifications for supported tasks.
- Return type:
Circuit|SerializableProgram|ProgramSet|Program|ProgramSet|AnalogHamiltonianSimulation|PulseSequence- Returns:
task_specification – A new task with noise inserted.
- classmethod from_dict(noise_dict)[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.
- Return type:
- Returns:
NoiseModel – An object of this class that corresponds to the passed in dictionary.