Skip to content

Commit

Permalink
Fix Renew example codes in README Qiskit#1806: qiskit.providers.ibmq …
Browse files Browse the repository at this point in the history
…is deprecated; ibmq_athens is not available (Qiskit#1831)

* Fix REAM Qiskit#1896 qiskit.providers.ibmq is deprecated;

* In README example, simplify code to get aersim_backend

* Update README.md remove shots=1000

* use FakeManilaV2

* Update README.md import Fake backend in the beginning

* Update README.md remove unneeded IBM_Providers import.

---------

Co-authored-by: Hiroshi Horii <[email protected]>
  • Loading branch information
davidlearn and hhorii authored Jun 5, 2023
1 parent d954a88 commit b6cc4a2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ $ python

```python
import qiskit
from qiskit import IBMQ
from qiskit_aer import AerSimulator
from qiskit.providers.fake_provider import FakeManilaV2

# Generate 3-qubit GHZ state
circ = qiskit.QuantumCircuit(3)
Expand All @@ -61,24 +61,23 @@ circ.measure_all()
aersim = AerSimulator()

# Perform an ideal simulation
result_ideal = qiskit.execute(circ, aersim).result()
result_ideal = aersim.run(circ).result()
counts_ideal = result_ideal.get_counts(0)
print('Counts(ideal):', counts_ideal)
# Counts(ideal): {'000': 493, '111': 531}

# Construct a noisy simulator backend from an IBMQ backend
# This simulator backend will be automatically configured
# using the device configuration and noise model
provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_athens')
# using the device configuration and noise model
backend = FakeManilaV2()
aersim_backend = AerSimulator.from_backend(backend)

# Perform noisy simulation
result_noise = qiskit.execute(circ, aersim_backend).result()
result_noise = aersim_backend.run(circ).result()
counts_noise = result_noise.get_counts(0)

print('Counts(noise):', counts_noise)
# Counts(noise): {'000': 492, '001': 6, '010': 8, '011': 14, '100': 3, '101': 14, '110': 18, '111': 469}
# Counts(noise): {'101': 16, '110': 48, '100': 7, '001': 31, '010': 7, '000': 464, '011': 15, '111': 436}
```

## Contribution Guidelines
Expand Down

0 comments on commit b6cc4a2

Please sign in to comment.