Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating qiskit noise imports to latest versions #355

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/tequila/simulators/simulator_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
HAS_QISKIT = True
INSTALLED_SIMULATORS["qiskit"] = BackendTypes(BackendCircuitQiskit, BackendExpectationValueQiskit)
INSTALLED_SAMPLERS["qiskit"] = BackendTypes(BackendCircuitQiskit, BackendExpectationValueQiskit)
INSTALLED_NOISE_SAMPLERS["qiskit"] = BackendTypes(BackendCircuitQiskit, BackendExpectationValueQiskit)
from tequila.simulators.simulator_qiskit import HAS_NOISE as HAS_QISKIT_NOISE
if HAS_QISKIT_NOISE:
INSTALLED_NOISE_SAMPLERS["qiskit"] = BackendTypes(BackendCircuitQiskit, BackendExpectationValueQiskit)
except ImportError:
HAS_QISKIT = False
HAS_QISKIT_NOISE = False

HAS_QIBO = True
try:
Expand Down Expand Up @@ -133,6 +136,8 @@ def show_available_simulators():
str(k in INSTALLED_SAMPLERS),
str(k in INSTALLED_NOISE_SAMPLERS),
str(k in INSTALLED_BACKENDS)))
if HAS_QISKIT and not HAS_QISKIT_NOISE:
print("missing qiskit_aer: no noisy simulation")


def pick_backend(backend: str = None, samples: int = None, noise: NoiseModel = None, device=None,
Expand Down
16 changes: 12 additions & 4 deletions src/tequila/simulators/simulator_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
from tequila import TequilaException, TequilaWarning
from tequila import BitString, BitNumbering, BitStringLSB
from tequila.utils.keymap import KeyMapRegisterToSubregister
import qiskit, numpy, warnings
import qiskit.providers.aer.noise as qiskitnoise
from tequila.utils import to_float
import qiskit.test.mock.backends
from qiskit.providers.ibmq import IBMQBackend
import qiskit, numpy, warnings

HAS_NOISE=True
try:
from qiskit_aer import noise as qiskitnoise
except:
HAS_NOISE = False

HAS_IBMQ=True
try:
from qiskit.providers.ibmq import IBMQBackend
except:
HAS_IBMQ=False

def get_bit_flip(p):
"""
Expand Down
Loading