diff --git a/poetry.lock b/poetry.lock index d29e28173..0d10358c6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "alabaster" @@ -2780,31 +2780,36 @@ files = [ [[package]] name = "qibo" -version = "0.2.12" +version = "0.2.13" description = "A framework for quantum computing with hardware acceleration." optional = false -python-versions = "<3.13,>=3.9" -files = [ - {file = "qibo-0.2.12-py3-none-any.whl", hash = "sha256:2e301747b31946d0737bfa621bf5b30b00c861926468ce36973cf61b2803f58a"}, - {file = "qibo-0.2.12.tar.gz", hash = "sha256:6849801eee77f928077a3e11b52cf549c34a9e9678a6d366d495686a6b21e788"}, -] +python-versions = ">=3.9,<3.13" +files = [] +develop = false [package.dependencies] -cma = ">=3.3.0,<4.0.0" -joblib = ">=1.2.0,<2.0.0" -networkx = ">=3.2.1,<4.0.0" -numpy = ">=1.26.4,<2.0.0" +cma = "^3.3.0" +joblib = "^1.2.0" +networkx = "^3.2.1" +numpy = "^1.26.4" openqasm3 = {version = ">=0.5.0", extras = ["parser"]} -optuna = ">=4.0.0,<5.0.0" -scipy = ">=1.10.1,<2.0.0" -sympy = ">=1.11.1,<2.0.0" -tabulate = ">=0.9.0,<0.10.0" +optuna = "^4.0.0" +scipy = "^1.10.1" +sympy = "^1.11.1" +tabulate = "^0.9.0" [package.extras] +qinfo = [] qulacs = ["qulacs (>=0.6.4,<0.7.0)"] tensorflow = ["tensorflow (>=2.16.1,<3.0.0)"] torch = ["torch (>=2.1.1,<2.4)"] +[package.source] +type = "git" +url = "https://github.com/qiboteam/qibo" +reference = "HEAD" +resolved_reference = "45eae7f81d1fe0fe9c3cd5b39c98fa225a6c29e8" + [[package]] name = "qibolab" version = "0.1.9" @@ -2904,11 +2909,6 @@ files = [ {file = "scikit_learn-1.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f60021ec1574e56632be2a36b946f8143bf4e5e6af4a06d85281adc22938e0dd"}, {file = "scikit_learn-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:394397841449853c2290a32050382edaec3da89e35b3e03d6cc966aebc6a8ae6"}, {file = "scikit_learn-1.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:57cc1786cfd6bd118220a92ede80270132aa353647684efa385a74244a41e3b1"}, - {file = "scikit_learn-1.5.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9a702e2de732bbb20d3bad29ebd77fc05a6b427dc49964300340e4c9328b3f5"}, - {file = "scikit_learn-1.5.2-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:b0768ad641981f5d3a198430a1d31c3e044ed2e8a6f22166b4d546a5116d7908"}, - {file = "scikit_learn-1.5.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:178ddd0a5cb0044464fc1bfc4cca5b1833bfc7bb022d70b05db8530da4bb3dd3"}, - {file = "scikit_learn-1.5.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f7284ade780084d94505632241bf78c44ab3b6f1e8ccab3d2af58e0e950f9c12"}, - {file = "scikit_learn-1.5.2-cp313-cp313-win_amd64.whl", hash = "sha256:b7b0f9a0b1040830d38c39b91b3a44e1b643f4b36e36567b80b7c6bd2202a27f"}, {file = "scikit_learn-1.5.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:757c7d514ddb00ae249832fe87100d9c73c6ea91423802872d9e74970a0e40b9"}, {file = "scikit_learn-1.5.2-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:52788f48b5d8bca5c0736c175fa6bdaab2ef00a8f536cda698db61bd89c551c1"}, {file = "scikit_learn-1.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:643964678f4b5fbdc95cbf8aec638acc7aa70f5f79ee2cdad1eec3df4ba6ead8"}, @@ -3710,4 +3710,4 @@ viz = ["pydot"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "b31514915b244e127dbec3b410da96239f94cf15dab113126b6ec1fd0461f543" +content-hash = "2fc56305ae80b66ba65b2bec6b77af3484b419fb321147386e9f8d4b12f02d7b" diff --git a/pyproject.toml b/pyproject.toml index 81d110de1..b56002f67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ classifiers = [ [tool.poetry.dependencies] python = ">=3.9,<3.12" qibolab = "^0.1.8" -qibo = "^0.2.12" +qibo = { git = "https://github.com/qiboteam/qibo" } numpy = "^1.26.4" scipy = "^1.10.1" pandas = { version = "^2.2.2", extras = ["html"] } diff --git a/src/qibocal/protocols/randomized_benchmarking/utils.py b/src/qibocal/protocols/randomized_benchmarking/utils.py index e9f41ced3..233c4ffe7 100644 --- a/src/qibocal/protocols/randomized_benchmarking/utils.py +++ b/src/qibocal/protocols/randomized_benchmarking/utils.py @@ -6,8 +6,7 @@ import numpy as np import numpy.typing as npt -from qibo import gates -from qibo.backends import GlobalBackend +from qibo import gates, get_backend from qibo.config import raise_error from qibo.models import Circuit from qibolab.platform import Platform @@ -69,7 +68,6 @@ } NPULSES_PER_CLIFFORD = 1.875 - """ Global phases that could appear in the Clifford group we defined in the "2q_cliffords.json" file due to the gates we selected to generate the Clifford group. @@ -352,7 +350,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 @@ -402,7 +400,6 @@ def get_circuits( - circuits (list): List of generated circuits. - indexes (dict): Dictionary containing the random indexes for each qubit and depth. - npulses_per_clifford (float): Number of pulses per Clifford. - """ circuits = [] indexes = {} @@ -452,7 +449,6 @@ def execute_circuits(circuits, targets, params, backend, single_qubit=True): Returns: list: List of executed circuits. - """ # Execute the circuits transpiler = dummy_transpiler(backend) diff --git a/src/qibocal/protocols/readout_mitigation_matrix.py b/src/qibocal/protocols/readout_mitigation_matrix.py index 61397e4f5..dc8f3f16d 100644 --- a/src/qibocal/protocols/readout_mitigation_matrix.py +++ b/src/qibocal/protocols/readout_mitigation_matrix.py @@ -4,8 +4,7 @@ import numpy as np import numpy.typing as npt import plotly.express as px -from qibo import gates -from qibo.backends import GlobalBackend +from qibo import gates, get_backend from qibo.models import Circuit from qibolab import ExecutionParameters from qibolab.platform import Platform @@ -97,7 +96,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) qubit_map = [i for i in range(platform.nqubits)] diff --git a/src/qibocal/protocols/state_tomography.py b/src/qibocal/protocols/state_tomography.py index 7085aecd7..87cb608c2 100644 --- a/src/qibocal/protocols/state_tomography.py +++ b/src/qibocal/protocols/state_tomography.py @@ -7,8 +7,8 @@ import numpy as np 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 import Circuit, gates, get_backend +from qibo.backends import NumpyBackend, matrices from qibo.quantum_info import fidelity, partial_trace from qibolab.platform import Platform from qibolab.qubits import QubitId @@ -102,7 +102,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) diff --git a/src/qibocal/protocols/two_qubit_interaction/chsh/protocol.py b/src/qibocal/protocols/two_qubit_interaction/chsh/protocol.py index 6adc6f147..4e508714c 100644 --- a/src/qibocal/protocols/two_qubit_interaction/chsh/protocol.py +++ b/src/qibocal/protocols/two_qubit_interaction/chsh/protocol.py @@ -8,7 +8,7 @@ import numpy as np import numpy.typing as npt import plotly.graph_objects as go -from qibo.backends import GlobalBackend +from qibo import get_backend from qibolab import ExecutionParameters from qibolab.platform import Platform from qibolab.qubits import QubitId, QubitPairId @@ -45,6 +45,7 @@ class CHSHParameters(Parameters): bell_states: list """List with Bell states to compute CHSH. + The following notation it is used: 0 -> |00>+|11> 1 -> |00>-|11> @@ -157,7 +158,6 @@ def __contains__(self, key: QubitPairId): While key is a QubitPairId both chsh and chsh_mitigated contain an additional key which represents the basis chosen. - """ return key in [(target, control) for target, control, _ in self.chsh] @@ -220,7 +220,7 @@ def _acquisition_circuits( bell_states=params.bell_states, thetas=thetas.tolist(), ) - backend = GlobalBackend() + backend = get_backend() backend.platform = platform transpiler = dummy_transpiler(backend) qubit_map = [i for i in range(platform.nqubits)] diff --git a/src/qibocal/protocols/two_qubit_state_tomography.py b/src/qibocal/protocols/two_qubit_state_tomography.py index 29a07d8a0..51d5c87ea 100644 --- a/src/qibocal/protocols/two_qubit_state_tomography.py +++ b/src/qibocal/protocols/two_qubit_state_tomography.py @@ -8,8 +8,8 @@ import numpy as np 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 import Circuit, gates, get_backend +from qibo.backends import NumpyBackend from qibo.quantum_info import fidelity, partial_trace from qibo.result import QuantumState from qibolab.platform import Platform @@ -97,7 +97,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) diff --git a/tests/test_task_options.py b/tests/test_task_options.py index f2caafd58..dd2ce8ee9 100644 --- a/tests/test_task_options.py +++ b/tests/test_task_options.py @@ -4,7 +4,7 @@ import pytest from pytest import approx -from qibo.backends import GlobalBackend, set_backend +from qibo import get_backend, set_backend from qibocal import protocols from qibocal.auto.mode import AUTOCALIBRATION, ExecutionMode @@ -20,7 +20,7 @@ @pytest.fixture(scope="module") def platform(): set_backend(backend="qibolab", platform="dummy") - return GlobalBackend().platform + return get_backend().platform TARGETS = [0, 1, 2] @@ -107,7 +107,7 @@ def test_update_argument(platform, global_update, local_update, tmp_path): NEW_CARD = modify_card( UPDATE_CARD, local_update=local_update, global_update=global_update ) - # platform = deepcopy(GlobalBackend().platform) + # platform = deepcopy(get_backend().platform) old_readout_frequency = platform.qubits[0].readout_frequency old_iq_angle = platform.qubits[1].iq_angle Runcard.load(NEW_CARD).run( diff --git a/tests/test_transpile.py b/tests/test_transpile.py index 499ac9d28..7f40c3f56 100644 --- a/tests/test_transpile.py +++ b/tests/test_transpile.py @@ -1,6 +1,5 @@ import numpy as np -from qibo import Circuit, gates, set_backend -from qibo.backends import GlobalBackend +from qibo import Circuit, gates, get_backend, set_backend from qibocal.auto.transpile import ( dummy_transpiler, @@ -24,13 +23,12 @@ def test_padd_circuit(): def test_execute_transpiled_circuit(): - circuit = Circuit(2) circuit.add(gates.X(0)) 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 @@ -46,13 +44,12 @@ def test_execute_transpiled_circuit(): def test_execute_transpiled_circuits(): - circuit = Circuit(2) circuit.add(gates.X(0)) 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