# Simulation of Noise in a particular quantum computer

I wish to be able to model a quantum computer with all the noise sources of an IBM quantum computer. For a given set of T1, T2, readout_errors, U2_errors and CNOT errors I want to know how to include all these errors. I can run a quantum circuit using the expected noise from a particular computer through the following code

backend = provider.get_backend('ibmqx2')
noise_model = NoiseModel.from_backend(backend)
# Get coupling map from backend
coupling_map = backend.configuration().coupling_map
# Get basis gates from noise model
basis_gates = noise_model.basis_gates


This runs my code with the noise from ibmqx2. I then try to implement each noise source. For example if the single qubit U2 error rate is er1, I implement this as follows:

 error_1 = noise.depolarizing_error(er1, 1)


I implement the two qubit and readout errors in the same way. Is this correct? Also how do I implement the errors associated with the T1 and T2 values? I am asking because my current model when I add each noise source myself does not match when I simply import the noise model. I wish to reconcile this.

If you are intending to add noise to the specific qubit (qubit [0] in this case) then this seems to be correct. At least from looking at this document: Building Noise Models

• Yes but the results from this model don't match the results from when I directly import the noise model. I suspect this has to do with the times T1 and T2 but I am not sure how
– LOC
Oct 18, 2020 at 5:19
• Make sure to note that the device noise model is not fixed either. The device is being calibrated a couple of times a day (I think) and the noise_model will change based on the calibration results. Oct 18, 2020 at 6:37

To build a noise model from scratch and compare with the backend noise model, you can do

from qiskit import *
from qiskit.providers.aer.noise import NoiseModel
basic_device_gate_errors)

provider = IBMQ.get_provider(hub='ibm-q')
backend = provider.get_backend('ibmq_bogota')
properties = backend.properties()
config = backend.configuration()
backend_noise_model = NoiseModel.from_backend(backend)

my_noise_model = NoiseModel(basis_gates=config.basis_gates)
gate_errors = basic_device_gate_errors(properties)
for name, qubits, error in gate_errors:

print(backend_noise_model == my_noise_model)


This should print out True. Here the two functions basic_device_readout_errors and basic_device_gate_errors build the error channels from the device parameters, such as $$T_1$$, $$T_2$$, gate lengths, gate errors, readout errors etc.

Building the readout error channels is straightforward, which just includes probabilities of reading out 1 when preparing 0 and vice versa. Building the gate error channels is quite involved. The basic idea is to approximate the gate with a depolarizing channel, which consists of an auxiliary depolarizing channel combined with an amplitude phase damping channel. The amplitude phase damping channel on each qubit is

$$\mathcal{E}_{\text{amp-phase}}(\rho) = \begin{pmatrix} \rho_{00} + (1 - e^{-T_{\text{gate}}/T_1})\rho_{01} & e^{-T_{\text{gate}}/T_2}\rho_{01}\\ e^{-T_{\text{gate}}/T_2}\rho_{10} & e^{-T_{\text{gate}}/T_1}\rho_{11} \end{pmatrix}.$$

This is where the $$T_1$$ and $$T_2$$ come in. The depolarizing probability $$p$$ of the auxiliary depolarizing channel with depolarizing probability $$p$$ is found by solving the equation

$$F_{\text{gate}} = (1-p) F_{\text{amp-phase}} + \frac{p}{d}$$

where $$F_{\text{amp-phase}}$$ is the average fidelity of the amplitude phase damping channel, $$F_{\text{gate}}$$ is the fidelity of the gate from randomized benchmarking and $$d$$ is the dimension of the Hilbert space. For more details I would recommend taking a look at the source code.