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

Fix backend call #1050

Merged
merged 2 commits into from
Nov 28, 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
708 changes: 373 additions & 335 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
[tool.poetry.dependencies]
python = ">=3.9,<3.12"
qibolab = { git = "https://github.com/qiboteam/qibolab.git" }
qibo = "^0.2.12"
qibo = "^0.2.13"
numpy = "^1.26.4"
scipy = "^1.10.1"
pandas = { version = "^2.2.2", extras = ["html"] }
Expand Down
4 changes: 2 additions & 2 deletions src/qibocal/protocols/randomized_benchmarking/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import numpy.typing as npt
from qibo import gates
from qibo.backends import GlobalBackend
from qibo.backends import get_backend
from qibo.config import raise_error
from qibo.models import Circuit

Expand Down Expand Up @@ -351,7 +351,7 @@ def setup(
tuple: A tuple containing the experiment data, noise model, and backend.
"""

backend = GlobalBackend()
backend = get_backend()
backend.platform = platform
# For simulations, a noise model can be added.
noise_model = None
Expand Down
4 changes: 2 additions & 2 deletions src/qibocal/protocols/readout_mitigation_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy.typing as npt
import plotly.express as px
from qibo import gates
from qibo.backends import GlobalBackend
from qibo.backends import get_backend
from qibo.models import Circuit
from qibolab import PulseSequence
from scipy.sparse import lil_matrix
Expand Down Expand Up @@ -115,7 +115,7 @@ def _acquisition(
data = ReadoutMitigationMatrixData(
nshots=params.nshots, qubit_list=[list(qq) for qq in targets]
)
backend = GlobalBackend()
backend = get_backend()
backend.platform = platform
transpiler = dummy_transpiler(backend)

Expand Down
4 changes: 2 additions & 2 deletions src/qibocal/protocols/state_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from qibo import Circuit, gates
from qibo.backends import GlobalBackend, NumpyBackend, matrices
from qibo.backends import NumpyBackend, get_backend, matrices
from qibo.quantum_info import fidelity, partial_trace

from qibocal.auto.operation import DATAFILE, Data, Parameters, QubitId, Results, Routine
Expand Down Expand Up @@ -103,7 +103,7 @@ def _acquisition(
if params.circuit is None:
params.circuit = Circuit(len(targets))

backend = GlobalBackend()
backend = get_backend()
backend.platform = platform
transpiler = dummy_transpiler(backend)

Expand Down
4 changes: 2 additions & 2 deletions src/qibocal/protocols/two_qubit_state_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from qibo import Circuit, gates
from qibo.backends import GlobalBackend, NumpyBackend
from qibo.backends import NumpyBackend, get_backend
from qibo.quantum_info import fidelity, partial_trace
from qibo.result import QuantumState

Expand Down Expand Up @@ -105,7 +105,7 @@ def _acquisition(
if params.circuit is None:
params.circuit = Circuit(len(qubits))

backend = GlobalBackend()
backend = get_backend()
backend.platform = platform
simulator = NumpyBackend()
transpiler = dummy_transpiler(backend)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_task_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest
from pytest import approx
from qibo.backends import GlobalBackend, set_backend
from qibo.backends import get_backend, set_backend

from qibocal import protocols
from qibocal.auto.mode import AUTOCALIBRATION, ExecutionMode
Expand All @@ -21,7 +21,7 @@
@pytest.fixture(scope="module")
def platform():
set_backend(backend="qibolab", platform="dummy")
return CalibrationPlatform.from_platform(GlobalBackend().platform)
return CalibrationPlatform.from_platform(get_backend().platform)


TARGETS = [0, 1, 2]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_transpile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from qibo import Circuit, gates, set_backend
from qibo.backends import GlobalBackend
from qibo.backends import get_backend

from qibocal.auto.transpile import (
dummy_transpiler,
Expand Down Expand Up @@ -30,7 +30,7 @@ def test_execute_transpiled_circuit():
circuit.add(gates.X(1))
qubit_map = [1, 2]
set_backend("qibolab", platform="dummy")
backend = GlobalBackend()
backend = get_backend()
transpiler = dummy_transpiler(backend)
transpiled_circuit, _ = execute_transpiled_circuit(
circuit, qubit_map, backend, transpiler=transpiler
Expand All @@ -52,7 +52,7 @@ def test_execute_transpiled_circuits():
circuit.add(gates.X(1))
qubit_map = [1, 2]
set_backend("qibolab", platform="dummy")
backend = GlobalBackend()
backend = get_backend()
transpiler = dummy_transpiler(backend)
transpiled_circuits, _ = execute_transpiled_circuits(
[circuit], [qubit_map], backend, transpiler=transpiler
Expand Down