Skip to content

Commit

Permalink
temporary fixes: .qasm() to dumps and change fake provider path
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Feb 27, 2024
1 parent 40c6eba commit 2163fe4
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
qiskit~=1.0.1
qiskit-aer~=0.13.2
qiskit-ibm-provider~=0.8.0
qiskit-ibm-runtime
pyquil~=3.5.4
pennylane-qiskit~=0.34.0
pennylane~=0.34.0
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/calibration-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ from mitiq import (
MeasurementResult,
)
from qiskit.providers.fake_provider import FakeJakarta # Fake (simulated) QPU
from qiskit_ibm_runtime.fake_provider import FakeJakarta # Fake (simulated) QPU
```

### Define the circuit to study
Expand Down
4 changes: 2 additions & 2 deletions docs/source/examples/ddd_on_ibmq_ghz.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kernelspec:

In this notebook DDD is applied to improve the success rate of the computation on a real hardware backend.
A similar approach can be taken on a simulated backend, by setting the ``USE_REAL_HARDWARE`` option to ``False``
and specifying a simulated backend from `qiskit.providers.fake_provider`, which includes a noise model that approximates the noise of the
and specifying a simulated backend from `qiskit_ibm_runtime.fake_provider`, which includes a noise model that approximates the noise of the
real device.

In DDD, sequences of gates are applied to slack windows, i.e. single-qubit idle windows, in a quantum circuit.
Expand Down Expand Up @@ -148,7 +148,7 @@ if USE_REAL_HARDWARE:
provider = IBMProvider()
backend = provider.get_backend("ibmq_lima")
else:
from qiskit.providers.fake_provider import FakeLima as FakeLima
from qiskit_ibm_runtime.fake_provider import FakeLima as FakeLima
backend = FakeLima()
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/ggi_summer_school_solved.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ from qiskit import QuantumCircuit
from qiskit.providers.aer import AerSimulator
from qiskit.tools.visualization import plot_histogram
from qiskit import transpile
from qiskit.providers.fake_provider import FakeJakarta # Fake (simulated) QPUs
from qiskit_ibm_runtime.fake_provider import FakeJakarta # Fake (simulated) QPUs
# Number of measurements
shots = 10 ** 5
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/ggi_summer_school_unsolved.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator
from qiskit.tools.visualization import plot_histogram
from qiskit import transpile
from qiskit.providers.fake_provider import FakeJakarta # Fake (simulated) QPUs
from qiskit_ibm_runtime.fake_provider import FakeJakarta # Fake (simulated) QPUs
# Number of measurements
shots = 10 ** 5
Expand Down
3 changes: 2 additions & 1 deletion mitiq/interface/mitiq_qiskit/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import numpy as np
import qiskit
from cirq.contrib.qasm_import import circuit_from_qasm
from qiskit.qasm2 import dumps

from mitiq.utils import _simplify_circuit_exponents

Expand Down Expand Up @@ -283,7 +284,7 @@ def from_qiskit(circuit: qiskit.QuantumCircuit) -> cirq.Circuit:
Returns:
Mitiq circuit representation equivalent to the input Qiskit circuit.
"""
return from_qasm(circuit.qasm())
return from_qasm(dumps(circuit))


def from_qasm(qasm: QASMType) -> cirq.Circuit:
Expand Down
5 changes: 3 additions & 2 deletions mitiq/interface/mitiq_qiskit/tests/test_conversions_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import numpy as np
import pytest
import qiskit
from qiskit.qasm2 import dumps

from mitiq.interface import convert_to_mitiq
from mitiq.interface.mitiq_qiskit.conversions import (
Expand Down Expand Up @@ -209,7 +210,7 @@ def test_convert_with_barrier(as_qasm):
qiskit_circuit.barrier()

if as_qasm:
cirq_circuit = from_qasm(qiskit_circuit.qasm())
cirq_circuit = from_qasm(dumps(qiskit_circuit))
else:
cirq_circuit = from_qiskit(qiskit_circuit)

Expand All @@ -229,7 +230,7 @@ def test_convert_with_multiple_barriers(as_qasm):
qiskit_circuit.barrier()

if as_qasm:
cirq_circuit = from_qasm(qiskit_circuit.qasm())
cirq_circuit = from_qasm(dumps(qiskit_circuit))
else:
cirq_circuit = from_qiskit(qiskit_circuit)

Expand Down
2 changes: 1 addition & 1 deletion mitiq/interface/mitiq_qiskit/tests/test_qiskit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import pytest
from qiskit import QuantumCircuit
from qiskit.providers.fake_provider import FakeLima
from qiskit_ibm_runtime.fake_provider import FakeLima

from mitiq import MeasurementResult, Observable, PauliString
from mitiq.interface.mitiq_qiskit.qiskit_utils import (
Expand Down
3 changes: 2 additions & 1 deletion mitiq/tests/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from braket.circuits import Instruction
from braket.circuits import gates as braket_gates
from pyquil import Program, gates
from qiskit.qasm2 import dumps

from mitiq import SUPPORTED_PROGRAM_TYPES
from mitiq.interface import (
Expand Down Expand Up @@ -44,7 +45,7 @@
qiskit_circuit = qiskit.QuantumCircuit(qiskit_qreg)
qiskit_circuit.h(qiskit_qreg[0])
qiskit_circuit.cx(*qiskit_qreg)
qasm_str = qiskit_circuit.qasm()
qasm_str = dumps(qiskit_circuit)


# pyQuil Bell circuit.
Expand Down
2 changes: 1 addition & 1 deletion mitiq/zne/tests/test_zne.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def test_execute_with_zne_transpiled_qiskit_circuit():
"""Tests ZNE when transpiling to a Qiskit device. Note transpiling can
introduce idle (unused) qubits to the circuit.
"""
from qiskit.providers.fake_provider import FakeSantiago
from qiskit_ibm_runtime.fake_provider import FakeSantiago

santiago = FakeSantiago()
backend = qiskit.providers.aer.AerSimulator.from_backend(santiago)
Expand Down

0 comments on commit 2163fe4

Please sign in to comment.