← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe
IBM Quantum and the Qiskit community
Noisy quantum simulation with Qiskit Aer
Official source: Qiskit/qiskit-aer
Download ZIP (free)Real quantum computers are noisy. A tested example that models gate and measurement errors with Qiskit Aer and compares the result with the ideal Bell circuit.
What is Qiskit Aer?
Qiskit Aer is the high-performance simulator in IBM's Qiskit ecosystem. As well as running ideal circuits quickly, it lets you add noise models that imitate the errors of real devices.
Why noise?
On today's quantum computers every gate and every measurement goes wrong with a small probability. Trying your algorithm in a noisy simulation before sending it to real hardware shows you in advance how much the results will suffer.
The example in this package
gurultulu_bell.py runs the two-qubit Bell circuit twice:
- On the ideal simulator only
00and11appear (on our test machine none of 4000 shots was wrong). - On the noisy simulator (1% error on single-qubit gates, 5% on the CNOT
and a 3% readout error) about 8.6% of the results came out as
01and10, which should never appear.
Next steps
- Lower the CNOT error rate from
0.05to0.01; see how the wrong results decrease. - Add 10 more CNOTs to the circuit (apply each twice, so logically nothing changes); watch how the noise builds up with the gate count.
- Download the measured noise model of a real IBM device with
qiskit-ibm-runtimeand try the same circuit with it.
Installation and running
pip install qiskit qiskit-aer
python gurultulu_bell.py
Tested with: qiskit 2.5.2, qiskit-aer 0.17.2, Python 3.12.
Official source
- Repository: Qiskit/qiskit-aer
- Latest release: 0.17.2 — 17 September 2025
- Licence: Apache-2.0
- Stars: 703
- Default branch commit when the catalogue was built:
fe964bf3ec37(7 October 2026)
Links
Package contents
gurultulu_bell.pyREADME.en.md— this fileREADME.md— the same guide in TurkishLICENSE— the licence of the files in this packageKAYNAK.json— a machine-readable summary of the official sourceUPSTREAM-LICENSE.txt— the licence text of the official project
Licence
The example code and the guide in this package were written by the Quantum Store editors and are MIT licensed. The project it uses is subject to its own licence (Apache-2.0).
Quantum Store — https://hakanerdogan.com/en
Example code
The example shipped in the package, run and checked. Comments and printed messages are in Turkish; the code is the same in any language. Everything is in the ZIP.
gurultulu_bell.py
"""Qiskit Aer ile gürültülü simülasyon: ideal ve gürültülü Bell durumunu karşılaştır.
Çalıştırma:
pip install qiskit qiskit-aer
python gurultulu_bell.py
"""
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
from qiskit_aer.noise import NoiseModel, ReadoutError, depolarizing_error
SHOTS = 4000
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
# Basit bir gürültü modeli: tek kübitlik kapılarda %1, CNOT'ta %5 depolarizasyon,
# her kübitin ölçümünde %3 okuma hatası. Gerçek cihazların değerleri bu mertebededir.
gurultu = NoiseModel()
gurultu.add_all_qubit_quantum_error(depolarizing_error(0.01, 1), ["h", "x", "sx", "rz"])
gurultu.add_all_qubit_quantum_error(depolarizing_error(0.05, 2), ["cx"])
gurultu.add_all_qubit_readout_error(ReadoutError([[0.97, 0.03], [0.03, 0.97]]))
def calistir(sim: AerSimulator) -> dict[str, int]:
sonuc = sim.run(transpile(qc, sim), shots=SHOTS, seed_simulator=11).result()
return dict(sorted(sonuc.get_counts().items()))
def hata_orani(sayim: dict[str, int]) -> float:
# Bell durumunda 01 ve 10 asla çıkmamalı; çıkan her biri gürültünün izidir.
return (sayim.get("01", 0) + sayim.get("10", 0)) / SHOTS
ideal = calistir(AerSimulator())
gurultulu = calistir(AerSimulator(noise_model=gurultu))
print(qc.draw(output="text"))
print(f"İdeal : {ideal} hatalı sonuç oranı {hata_orani(ideal):.1%}")
print(f"Gürültülü : {gurultulu} hatalı sonuç oranı {hata_orani(gurultulu):.1%}")
assert hata_orani(ideal) == 0, ideal
assert 0.03 < hata_orani(gurultulu) < 0.2, gurultulu
print("Tamam: gürültü, ideal devrede hiç görülmeyen 01 ve 10 sonuçlarını üretti.")
Related concepts
- Quantum error correction · Quantum error correction spreads one logical qubit over many physical qubits so that errors caused by noise can be found and fixed without measuring the qubits directly.
- Decoherence · Decoherence is a qubit gradually losing its superposition and entanglement, its quantum properties, through unwanted interaction with its environment.
- NISQ (noisy intermediate-scale quantum) · NISQ is the current era of quantum computing, named by John Preskill in 2018: devices with tens to a few hundred noisy qubits and no error correction.
- Qiskit · Qiskit is IBM’s open-source Python library for quantum programming; it lets you build circuits, run them on simulators and send them to IBM quantum computers.