qiskit-documentation/docs/api/qiskit/0.42/qiskit_aer.noise.LocalNoise...

94 lines
4.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: LocalNoisePass
description: API reference for qiskit_aer.noise.LocalNoisePass
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit_aer.noise.LocalNoisePass
---
# LocalNoisePass
<Class id="qiskit_aer.noise.LocalNoisePass" isDedicatedPage={true} github="https://github.com/qiskit/qiskit-aer/tree/stable/0.12/qiskit_aer/noise/passes/local_noise_pass.py" signature="LocalNoisePass(func, op_types=None, method='append')" modifiers="class">
Bases: [`qiskit.transpiler.basepasses.TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass")
Transpiler pass to insert noise into a circuit.
The noise in this pass is defined by a noise function or callable with signature
```python
def func(
inst: Instruction,
qubits: Optional[List[int]] = None
) -> InstructionLike:
```
For every instance of one of the reference instructions in a circuit the supplied function is called on that instruction and the returned noise is added to the circuit. This noise can depend on properties of the instruction it is called on (for example parameters or duration) to allow inserting parameterized noise models.
Several methods for adding the constructed errors to circuits are supported and can be set by using the `method` kwarg. The supported methods are
* `"append"`: add the return of the callable after the instruction.
* `"prepend"`: add the return of the callable before the instruction.
* **`"replace"`: replace the instruction with the return of the callable.**
If the return is None, the instruction will be removed.
Initialize noise pass.
**Parameters**
* **func** (`Callable`\[\[[`Instruction`](qiskit.circuit.Instruction "qiskit.circuit.instruction.Instruction"), `Sequence`\[`int`]], `Union`\[[`Instruction`](qiskit.circuit.Instruction "qiskit.circuit.instruction.Instruction"), [`QuantumError`](qiskit_aer.noise.QuantumError "qiskit_aer.noise.errors.quantum_error.QuantumError"), [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit"), `None`]]) noise function func(inst, qubits) -> InstructionLike.
* **op\_types** (`Union`\[`type`, `Iterable`\[`type`], `None`]) Optional, single or list of instruction types to apply the noise function to. If None the noise function will be applied to all instructions in the circuit.
* **method** (`str`) method for inserting noise. Allow methods are append, prepend, replace.
**Raises**
[**TranspilerError**](qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") if an invalid option is specified.
## Methods
### name
<Function id="qiskit_aer.noise.LocalNoisePass.name" signature="LocalNoisePass.name()">
Return the name of the pass.
</Function>
### run
<Function id="qiskit_aer.noise.LocalNoisePass.run" signature="LocalNoisePass.run(dag)">
Run the LocalNoisePass pass on dag. :type dag: [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.dagcircuit.DAGCircuit") :param dag: DAG to be changed.
**Return type**
[`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.dagcircuit.DAGCircuit")
**Returns**
A changed DAG.
**Raises**
[**TranspilerError**](qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") if generated operation is not valid.
</Function>
## Attributes
### is\_analysis\_pass
<Attribute id="qiskit_aer.noise.LocalNoisePass.is_analysis_pass">
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
</Attribute>
### is\_transformation\_pass
<Attribute id="qiskit_aer.noise.LocalNoisePass.is_transformation_pass">
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
</Attribute>
</Class>