# How can noise on a device be simulated using measured noise parameters?

The real devices used as backends for Qiskit have calibration data that quantifies errors ($$T_1$$ and $$T_2$$, gate fidelities, etc). This can be accessed by, for example

from qiskit import IBMQ
device = IBMQ.get_backend('ibmq_5_tenerife')
properties = device.properties()

print( properties.to_dict() )


How can a simulation be performed that takes all of this information into account, and produces a result given a simulation of this noise?

This can be done using the 'Aer' component of Qiskit. The properties information can be turned into a noise model using

from qiskit.providers.aer import noise
properties = device.properties()
noise_model = noise.device.basic_device_noise_model(properties)
basis_gates = noise_model.basis_gates


This can then be supplied to the execute() method, as is normally used to run jobs. Here is a full working example of a simulation using the noise model from the Tenerife device, for a circuit that creates a Bell pair.

from qiskit import QuantumRegister, ClassicalRegister
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.providers.aer import noise

# Choose a real device to simulate
device = IBMQ.get_backend('ibmq_5_tenerife')
properties = device.properties()
coupling_map = device.configuration().coupling_map

# Generate an Aer noise model for device
noise_model = noise.device.basic_device_noise_model(properties)
basis_gates = noise_model.basis_gates

# Generate a quantum circuit
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)

qc.h(q[0])
qc.cx(q[0], q[1])
qc.measure(q, c)

# Perform noisy simulation
backend = Aer.get_backend('qasm_simulator')
job_sim = execute(qc, backend,
coupling_map=coupling_map,
noise_model=noise_model,
basis_gates=basis_gates)
sim_result = job_sim.result()

print(sim_result.get_counts(qc))


The result I got when running this was {'00': 409, '11': 411, '10': 94, '01': 110}, which shows that the expected results of '00' and '11' are indeed dominant, but '01' and '10' also appear due to the simulated noise.