Suppose, you have two parts of a circuit in Qiskit, qc1 and qc2 on any number of qubits such that the entire circuit is given by

qc = qc1.compose(qc2)

For sake of concreteness, here is an example on 2 qubits:

qc1 = QuantumCircuit(2)
qc2 = QuantumCircuit(2)


I want to apply a single-qubit channel on the first qubit, say a depolarizing one, in between qc1 and qc2 and then simulate the whole circuit using qiskit. That is, after qc1 and before qc2. After having looked at the Qiskit Aer noise module, my idea would be to introduce a noisy version of an identity gate between the two circuits qc1 and qc2. How to do this?

  • $\begingroup$ Good question! At least according to the documentation, a noise model applies to an execution and not to a specific piece of a circuit. qiskit.org/documentation/apidoc/aer_noise.html $\endgroup$ Commented Dec 1, 2022 at 19:26
  • $\begingroup$ Are you open to a classical Monte Carlo like simulation where you execute the circuit again and again? Then you could introduce a u3 gate in between (on a specific qubit) and sample the gate parameters from a distribution of your choice. $\endgroup$
    – Sam
    Commented Dec 6, 2022 at 1:55
  • $\begingroup$ Thanks for the comment. What you describe is precisely the workaround that I am using at the moment. I just find it extremely annoying that I have to manually implement the effect of the noise myself when there is a noise module. I am looking for an answer that is native to qiskit. $\endgroup$
    – Marsl
    Commented Dec 6, 2022 at 8:50
  • $\begingroup$ You could do something like qiskit.org/documentation/tutorials/simulators/… with a u3 gate. $\endgroup$
    – R K Rupesh
    Commented Dec 7, 2022 at 14:33
  • $\begingroup$ @RKRupesh could you come up with some example code? $\endgroup$
    – Marsl
    Commented Dec 8, 2022 at 10:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.