diff --git a/docs/manuals/characterization/stark_experiment.rst b/docs/manuals/characterization/stark_experiment.rst index 23b6c56d4e..8233a6ac6f 100644 --- a/docs/manuals/characterization/stark_experiment.rst +++ b/docs/manuals/characterization/stark_experiment.rst @@ -112,9 +112,13 @@ drive port of the qubit. In a typical IBM device using the cross-resonance drive architecture, such channel can be identified with your backend as follows: +.. note:: + This tutorial requires the :mod:`qiskit_ibm_runtime` package to model a + backend. You can install it with ``python -m pip install qiskit-ibm-runtime``. + .. jupyter-execute:: - from qiskit.providers.fake_provider import FakeHanoiV2 + from qiskit_ibm_runtime.fake_provider import FakeHanoiV2 backend = FakeHanoiV2() qubit = 0 @@ -143,7 +147,7 @@ by a variant of the Hahn-echo pulse sequence [5]_. from qiskit_experiments.library import StarkRamseyXY from qiskit import schedule, pulse - from qiskit.providers.fake_provider import FakeHanoi + from qiskit_ibm_runtime.fake_provider import FakeHanoi from qiskit.visualization.pulse_v2 import IQXSimple backend = FakeHanoi() diff --git a/docs/manuals/characterization/t1.rst b/docs/manuals/characterization/t1.rst index 8a926e9254..82a5801ebe 100644 --- a/docs/manuals/characterization/t1.rst +++ b/docs/manuals/characterization/t1.rst @@ -30,8 +30,9 @@ The following code demonstrates a basic run of a :math:`T_1` experiment for qubit 0. .. note:: - This manual requires the :mod:`qiskit_aer` package to run simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: @@ -42,9 +43,9 @@ for qubit 0. from qiskit_experiments.library.characterization.analysis.t1_analysis import T1KerneledAnalysis # A T1 simulator - from qiskit.providers.fake_provider import FakePerth from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel + from qiskit_ibm_runtime.fake_provider import FakePerth # A kerneled data simulator from qiskit_experiments.test.mock_iq_backend import MockIQBackend diff --git a/docs/manuals/characterization/t2ramsey.rst b/docs/manuals/characterization/t2ramsey.rst index 6e404d9be4..f7991572e4 100644 --- a/docs/manuals/characterization/t2ramsey.rst +++ b/docs/manuals/characterization/t2ramsey.rst @@ -58,13 +58,14 @@ We run the experiment on a simulated backend using Qiskit Aer with a pure T1/T2 relaxation noise model. .. note:: - This manual requires the :mod:`qiskit_aer` package to run simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: # A T1 simulator - from qiskit.providers.fake_provider import FakePerth + from qiskit_ibm_runtime.fake_provider import FakePerth from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel diff --git a/docs/manuals/characterization/tphi.rst b/docs/manuals/characterization/tphi.rst index 3e0f25503e..245614af31 100644 --- a/docs/manuals/characterization/tphi.rst +++ b/docs/manuals/characterization/tphi.rst @@ -21,8 +21,9 @@ From the :math:`T_1` and :math:`T_2` estimates, we compute the results for :math:`T_\varphi.` .. note:: - This manual requires the :mod:`qiskit_aer` package to run simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: @@ -31,9 +32,9 @@ From the :math:`T_1` and :math:`T_2` estimates, we compute the results for from qiskit_experiments.library.characterization import Tphi # An Aer simulator - from qiskit.providers.fake_provider import FakePerth from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel + from qiskit_ibm_runtime.fake_provider import FakePerth # Create a pure relaxation noise model for AerSimulator noise_model = NoiseModel.from_backend( diff --git a/docs/manuals/measurement/readout_mitigation.rst b/docs/manuals/measurement/readout_mitigation.rst index 0fed52b920..8fa861a4ff 100644 --- a/docs/manuals/measurement/readout_mitigation.rst +++ b/docs/manuals/measurement/readout_mitigation.rst @@ -31,8 +31,9 @@ This notebook demonstrates the usage of both the local and correlated experiments to generate the corresponding mitigators. .. note:: - This manual requires the :mod:`qiskit_aer` package to run simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: @@ -43,7 +44,7 @@ experiments to generate the corresponding mitigators. from qiskit_experiments.library import LocalReadoutError, CorrelatedReadoutError from qiskit_aer import AerSimulator - from qiskit.providers.fake_provider import FakePerth + from qiskit_ibm_runtime.fake_provider import FakePerth from qiskit.result.mitigation.utils import ( expval_with_stddev, diff --git a/docs/manuals/measurement/restless_measurements.rst b/docs/manuals/measurement/restless_measurements.rst index c62fe75d27..fbde9c7a3e 100644 --- a/docs/manuals/measurement/restless_measurements.rst +++ b/docs/manuals/measurement/restless_measurements.rst @@ -1,218 +1,223 @@ -Restless Measurements -===================== - -When running circuits, the qubits are typically reset to the ground state after -each measurement to ensure that the next circuit has a well-defined initial state. -This can be done passively by waiting several :math:`T_1`-times so that qubits in -the excited state decay to :math:`\left\vert0\right\rangle`. Since :math:`T_1`-times -are continuously improving (they already increased beyond :math:`100\,\mu s`), this -initialization procedure is now inefficient. This makes active reset necessary. -Active qubit reset, as employed by IBM Quantum systems is more efficient and saves -time but also lasts a few microseconds (between :math:`3` and :math:`5\,\mu s`). -Furthermore, a delay, typically lasting :math:`250\,\mu s`, after the reset -operation is often necessary to ensure a high initialization quality. -However, for several types of characterization and calibration experiments we can -avoid qubit reset by post-processing the measurement outcomes and continue directly -with the next circuit after an optional short delay, even if the qubit was measured -in the excited state. Foregoing qubit reset is the main idea behind restless measurements. - -The IBM Quantum systems have dynamical repetition delays enabled. We can thus choose -the delay between the execution of two quantum circuits. This delay -typically ranges from :math:`0` to :math:`500\,\mu s` depending on the system. -The default value for most devices is :math:`250\,\mu s`. Restless measurements -set this delay to small values such as :math:`1\,\mu s` or lower. Note that sometimes -the measurement instructions already contain a delay after the measurement pulse to -allow the readout resonator to depopulate. - -When the qubit is not reset it will either be in the :math:`\left\vert0\right\rangle` -or in the :math:`\left\vert1\right\rangle` state when the next circuit starts. -Therefore, the measured outcomes of the restless experiments require post-processing. -The following example, taken from Ref. [1]_, illustrates what happens to the single -measurement outcomes represented as complex numbers in the IQ plane in a restless -setting. Here, we run three circuits with an identity gate and three circuits with -an :math:`X` gate, each followed by a measurement. The numbers in the IQ shots indicate the -order in which the shots were acquired. The IQ plane on the left shows the single -measurement shots gathered when the qubits are reset. Here, the blue and red points, -corresponding to measurements following the :math:`Id` and :math:`X` gates, are associated with the -:math:`\left\vert0\right\rangle` and :math:`\left\vert1\right\rangle` states, -respectively. -By contrast, with restless measurements the qubit is not reset after a -measurement. As one can see in the IQ plane on the right the single measurement -outcomes of the :math:`Id`` and :math:`X` circuits no longer match with the -:math:`\left\vert0\right\rangle` and :math:`\left\vert1\right\rangle` states, -respectively. This is why restless measurements need special post-processing. - -.. image:: restless_shots.png - :width: 600 - -Enabling restless measurements -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In Qiskit Experiments, the experiments that support restless measurements -have a special method :meth:`~.RestlessMixin.enable_restless` to set the restless run options -and define the data processor that will process the measured data. -If you are an experiment developer, you can add the :class:`.RestlessMixin` -to your experiment class to add support for restless measurements. -Here, we will show how to activate restless measurements using -a fake backend and a rough DRAG experiment. Note however, that you will not -observe any meaningful outcomes with fake backends since the circuit simulator -they use always starts with the qubits in the ground state. - -.. jupyter-execute:: - - from qiskit_experiments.library import RoughDragCal - from qiskit_experiments.calibration_management import ( - Calibrations, - FixedFrequencyTransmon, - ) - from qiskit_experiments.data_processing.data_processor import DataProcessor - from qiskit.providers.fake_provider import FakePerth - - # replace this lines with an IBM Quantum backend to run the experiment. - backend = FakePerth() - cals = Calibrations.from_backend(backend, libraries=[FixedFrequencyTransmon()]) - - # Define the experiment - qubit = 2 - cal_drag = RoughDragCal((qubit,), cals, schedule_name='sx', backend=backend) - - # Enable restless measurements by setting the run options and data processor - cal_drag.enable_restless(rep_delay=1e-6) - - print(cal_drag.analysis.options.data_processor) - print(cal_drag.run_options) - -As you can see, a restless data processor is automatically chosen for the experiment. This -data processor post-processes the restless measured shots according to the order in which -they were acquired. Furthermore, the appropriate run options are also set. Note that -these run options might be unique to IBM Quantum providers. Therefore, execute may fail -on non-IBM Quantum providers if the required options are not supported. - -After calling :meth:`~.RestlessMixin.enable_restless` the experiment is ready to be run -in a restless mode. With a hardware backend, this would be done by calling the -:meth:`~.BaseExperiment.run` method: - -.. jupyter-input:: - - drag_data_restless = cal_drag.run() - -As shown by the example, the code is identical to running a normal experiment aside -from a call to the method :meth:`~.RestlessMixin.enable_restless`. Note that you can also choose to keep -the standard data processor by providing it to the analysis options and telling -:meth:`~.RestlessMixin.enable_restless` not to override the data processor. - -.. jupyter-execute:: - - from qiskit_experiments.data_processing import ( - DataProcessor, - Probability, - ) - - # define a standard data processor. - standard_processor = DataProcessor("counts", [Probability("1")]) - - cal_drag = RoughDragCal((qubit,), cals, schedule_name='sx', backend=backend) - cal_drag.analysis.set_options(data_processor=standard_processor) - - # enable restless mode and set override_processor_by_restless to False. - cal_drag.enable_restless(rep_delay=1e-6, override_processor_by_restless=False) - -If you run the experiment in this setting you will see that the data is often -unusable which illustrates the importance of the data processing. As detailed -in Ref. [2]_, restless measurements can be done with a wide variety -of experiments such as fine amplitude and drag error amplifying gate sequences -as well as randomized benchmarking. - -Calculating restless quantum processor speed-ups -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Following Ref. [2]_, we can compare the time spent by the quantum processor executing -restless and standard jobs. This allows us to compute the effective speed-up we gain -when performing restless experiments. Note that we do not consider any classical -run-time contributions such as runtime-compilation or data transfer times [3]_. -The time to run :math:`K` circuits and gather :math:`N` shots for each -circuit is - -.. math:: - - \tau^{(x)} = NK\left(\tau^{(x)}_\text{reset}+\tau^{(x)}_\text{delay}+ - \langle{\tau}_\text{circ}\rangle+\tau_\text{meas}\right), - -where :math:`\tau^{(x)}_\text{reset}` and :math:`\tau^{(x)}_\text{delay}` -are the reset and post measurement delay times, respectively. The superscript -:math:`(x)` indicates restless :math:`(r)` or standard :math:`(s)` measurements. -The average duration of all :math:`K` circuits in an experiment is -:math:`\langle{\tau}_\text{circ}\rangle=K^{-1}\sum_{k=1}^{K} \tau_{\text{circ},k}` -where :math:`\tau_{\text{circ},k}` is the duration of only the gates in circuit -:math:`k`. We therefore compute the quantum processor speed-up of restless -measurements as :math:`\tau^{(\text{s})}/\tau^{(\text{r})}` which is independent -of the number of circuits and shots. - -We approximate the standard reset time in IBM Quantum backends by -:math:`\tau^{(s)}_\text{reset} = 4\,\mu s` whereas :math:`\tau^{(r)}_\text{reset} = 0\,\mu s` -since we do not reset the qubit in a restless experiment. By default, the repetition delay is -:math:`\tau^{(s)}_\text{delay} = 250\,\mu s`. For our restless experiments we -set :math:`\tau^{(r)}_\text{delay} = 1\,\mu s`. These speed-ups can be evaluated -using the code below. - -.. jupyter-execute:: - - from qiskit import schedule, transpile - from qiskit_experiments.framework import BackendData - - dt = BackendData(backend).dt - inst_map = backend.instruction_schedule_map - meas_length = inst_map.get("measure", (qubit,)).duration * dt - - # Compute the average duration of all circuits - # Remove measurement instructions - circuits = [] - for qc in cal_drag.circuits(): - qc.remove_final_measurements(inplace=True) - circuits.append(qc) - - # Schedule the circuits to obtain the duration of all the gates - executed_circs = transpile( - circuits, - backend, - initial_layout=[qubit], - scheduling_method="alap", - **cal_drag.transpile_options.__dict__, - ) - durations = [c.duration for c in executed_circs] - - tau = sum(durations) * dt / (len(durations)) - - n_circs = len(cal_drag.circuits()) - # can be obtained from backend.default_rep_delay on a backend from qiskit-ibm-provider - - delay_s = 0.0025 - delay_r = 1e-6 # restless delay - reset = 4e-6 # Estimated reset duration - speed_up = (meas_length + reset + delay_s + tau) / (meas_length + delay_r + tau) - print(f"The QPU will spend {speed_up:.1f}x less time running restless Drag.") - -The example above is applicable to other experiments and shows that restless -measurements can greatly speed-up characterization and calibration tasks. - -References ----------- - -.. [1] Max Werninghaus, Daniel J. Egger, Stefan Filipp, High-speed calibration and - characterization of superconducting quantum processors without qubit reset, - PRX Quantum **2**, 020324 (2021). https://arxiv.org/abs/2010.06576. - -.. [2] Caroline Tornow, Naoki Kanazawa, William E. Shanks, Daniel J. Egger, - Minimum quantum run-time characterization and calibration via restless - measurements with dynamic repetition rates, Physics Review Applied **17**, - 064061 (2022). https://arxiv.org/abs/2202.06981. - -.. [3] Andrew Wack, Hanhee Paik, Ali Javadi-Abhari, Petar Jurcevic, Ismael Faro, - Jay M. Gambetta, Blake R. Johnson, Quality, Speed, and Scale: three key - attributes to measure the performance of near-term quantum computers, - https://arxiv.org/abs/2110.14108. - -See also --------- - -* API documentation: :mod:`~qiskit_experiments.framework.RestlessMixin` +Restless Measurements +===================== + +When running circuits, the qubits are typically reset to the ground state after +each measurement to ensure that the next circuit has a well-defined initial state. +This can be done passively by waiting several :math:`T_1`-times so that qubits in +the excited state decay to :math:`\left\vert0\right\rangle`. Since :math:`T_1`-times +are continuously improving (they already increased beyond :math:`100\,\mu s`), this +initialization procedure is now inefficient. This makes active reset necessary. +Active qubit reset, as employed by IBM Quantum systems is more efficient and saves +time but also lasts a few microseconds (between :math:`3` and :math:`5\,\mu s`). +Furthermore, a delay, typically lasting :math:`250\,\mu s`, after the reset +operation is often necessary to ensure a high initialization quality. +However, for several types of characterization and calibration experiments we can +avoid qubit reset by post-processing the measurement outcomes and continue directly +with the next circuit after an optional short delay, even if the qubit was measured +in the excited state. Foregoing qubit reset is the main idea behind restless measurements. + +The IBM Quantum systems have dynamical repetition delays enabled. We can thus choose +the delay between the execution of two quantum circuits. This delay +typically ranges from :math:`0` to :math:`500\,\mu s` depending on the system. +The default value for most devices is :math:`250\,\mu s`. Restless measurements +set this delay to small values such as :math:`1\,\mu s` or lower. Note that sometimes +the measurement instructions already contain a delay after the measurement pulse to +allow the readout resonator to depopulate. + +When the qubit is not reset it will either be in the :math:`\left\vert0\right\rangle` +or in the :math:`\left\vert1\right\rangle` state when the next circuit starts. +Therefore, the measured outcomes of the restless experiments require post-processing. +The following example, taken from Ref. [1]_, illustrates what happens to the single +measurement outcomes represented as complex numbers in the IQ plane in a restless +setting. Here, we run three circuits with an identity gate and three circuits with +an :math:`X` gate, each followed by a measurement. The numbers in the IQ shots indicate the +order in which the shots were acquired. The IQ plane on the left shows the single +measurement shots gathered when the qubits are reset. Here, the blue and red points, +corresponding to measurements following the :math:`Id` and :math:`X` gates, are associated with the +:math:`\left\vert0\right\rangle` and :math:`\left\vert1\right\rangle` states, +respectively. +By contrast, with restless measurements the qubit is not reset after a +measurement. As one can see in the IQ plane on the right the single measurement +outcomes of the :math:`Id`` and :math:`X` circuits no longer match with the +:math:`\left\vert0\right\rangle` and :math:`\left\vert1\right\rangle` states, +respectively. This is why restless measurements need special post-processing. + +.. image:: restless_shots.png + :width: 600 + +Enabling restless measurements +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In Qiskit Experiments, the experiments that support restless measurements +have a special method :meth:`~.RestlessMixin.enable_restless` to set the restless run options +and define the data processor that will process the measured data. +If you are an experiment developer, you can add the :class:`.RestlessMixin` +to your experiment class to add support for restless measurements. +Here, we will show how to activate restless measurements using +a fake backend and a rough DRAG experiment. Note however, that you will not +observe any meaningful outcomes with fake backends since the circuit simulator +they use always starts with the qubits in the ground state. + +.. note:: + This tutorial requires the :mod:`qiskit_ibm_runtime` package to model a + backend. You can install it with ``python -m pip install qiskit-ibm-runtime``. + +.. jupyter-execute:: + + from qiskit_ibm_runtime.fake_provider import FakePerth + + from qiskit_experiments.library import RoughDragCal + from qiskit_experiments.calibration_management import ( + Calibrations, + FixedFrequencyTransmon, + ) + from qiskit_experiments.data_processing.data_processor import DataProcessor + + # replace this lines with an IBM Quantum backend to run the experiment. + backend = FakePerth() + cals = Calibrations.from_backend(backend, libraries=[FixedFrequencyTransmon()]) + + # Define the experiment + qubit = 2 + cal_drag = RoughDragCal((qubit,), cals, schedule_name='sx', backend=backend) + + # Enable restless measurements by setting the run options and data processor + cal_drag.enable_restless(rep_delay=1e-6) + + print(cal_drag.analysis.options.data_processor) + print(cal_drag.run_options) + +As you can see, a restless data processor is automatically chosen for the experiment. This +data processor post-processes the restless measured shots according to the order in which +they were acquired. Furthermore, the appropriate run options are also set. Note that +these run options might be unique to IBM Quantum providers. Therefore, execute may fail +on non-IBM Quantum providers if the required options are not supported. + +After calling :meth:`~.RestlessMixin.enable_restless` the experiment is ready to be run +in a restless mode. With a hardware backend, this would be done by calling the +:meth:`~.BaseExperiment.run` method: + +.. jupyter-input:: + + drag_data_restless = cal_drag.run() + +As shown by the example, the code is identical to running a normal experiment aside +from a call to the method :meth:`~.RestlessMixin.enable_restless`. Note that you can also choose to keep +the standard data processor by providing it to the analysis options and telling +:meth:`~.RestlessMixin.enable_restless` not to override the data processor. + +.. jupyter-execute:: + + from qiskit_experiments.data_processing import ( + DataProcessor, + Probability, + ) + + # define a standard data processor. + standard_processor = DataProcessor("counts", [Probability("1")]) + + cal_drag = RoughDragCal((qubit,), cals, schedule_name='sx', backend=backend) + cal_drag.analysis.set_options(data_processor=standard_processor) + + # enable restless mode and set override_processor_by_restless to False. + cal_drag.enable_restless(rep_delay=1e-6, override_processor_by_restless=False) + +If you run the experiment in this setting you will see that the data is often +unusable which illustrates the importance of the data processing. As detailed +in Ref. [2]_, restless measurements can be done with a wide variety +of experiments such as fine amplitude and drag error amplifying gate sequences +as well as randomized benchmarking. + +Calculating restless quantum processor speed-ups +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Following Ref. [2]_, we can compare the time spent by the quantum processor executing +restless and standard jobs. This allows us to compute the effective speed-up we gain +when performing restless experiments. Note that we do not consider any classical +run-time contributions such as runtime-compilation or data transfer times [3]_. +The time to run :math:`K` circuits and gather :math:`N` shots for each +circuit is + +.. math:: + + \tau^{(x)} = NK\left(\tau^{(x)}_\text{reset}+\tau^{(x)}_\text{delay}+ + \langle{\tau}_\text{circ}\rangle+\tau_\text{meas}\right), + +where :math:`\tau^{(x)}_\text{reset}` and :math:`\tau^{(x)}_\text{delay}` +are the reset and post measurement delay times, respectively. The superscript +:math:`(x)` indicates restless :math:`(r)` or standard :math:`(s)` measurements. +The average duration of all :math:`K` circuits in an experiment is +:math:`\langle{\tau}_\text{circ}\rangle=K^{-1}\sum_{k=1}^{K} \tau_{\text{circ},k}` +where :math:`\tau_{\text{circ},k}` is the duration of only the gates in circuit +:math:`k`. We therefore compute the quantum processor speed-up of restless +measurements as :math:`\tau^{(\text{s})}/\tau^{(\text{r})}` which is independent +of the number of circuits and shots. + +We approximate the standard reset time in IBM Quantum backends by +:math:`\tau^{(s)}_\text{reset} = 4\,\mu s` whereas :math:`\tau^{(r)}_\text{reset} = 0\,\mu s` +since we do not reset the qubit in a restless experiment. By default, the repetition delay is +:math:`\tau^{(s)}_\text{delay} = 250\,\mu s`. For our restless experiments we +set :math:`\tau^{(r)}_\text{delay} = 1\,\mu s`. These speed-ups can be evaluated +using the code below. + +.. jupyter-execute:: + + from qiskit import schedule, transpile + from qiskit_experiments.framework import BackendData + + dt = BackendData(backend).dt + inst_map = backend.instruction_schedule_map + meas_length = inst_map.get("measure", (qubit,)).duration * dt + + # Compute the average duration of all circuits + # Remove measurement instructions + circuits = [] + for qc in cal_drag.circuits(): + qc.remove_final_measurements(inplace=True) + circuits.append(qc) + + # Schedule the circuits to obtain the duration of all the gates + executed_circs = transpile( + circuits, + backend, + initial_layout=[qubit], + scheduling_method="alap", + **cal_drag.transpile_options.__dict__, + ) + durations = [c.duration for c in executed_circs] + + tau = sum(durations) * dt / (len(durations)) + + n_circs = len(cal_drag.circuits()) + # can be obtained from backend.default_rep_delay on a backend from qiskit-ibm-provider + + delay_s = 0.0025 + delay_r = 1e-6 # restless delay + reset = 4e-6 # Estimated reset duration + speed_up = (meas_length + reset + delay_s + tau) / (meas_length + delay_r + tau) + print(f"The QPU will spend {speed_up:.1f}x less time running restless Drag.") + +The example above is applicable to other experiments and shows that restless +measurements can greatly speed-up characterization and calibration tasks. + +References +---------- + +.. [1] Max Werninghaus, Daniel J. Egger, Stefan Filipp, High-speed calibration and + characterization of superconducting quantum processors without qubit reset, + PRX Quantum **2**, 020324 (2021). https://arxiv.org/abs/2010.06576. + +.. [2] Caroline Tornow, Naoki Kanazawa, William E. Shanks, Daniel J. Egger, + Minimum quantum run-time characterization and calibration via restless + measurements with dynamic repetition rates, Physics Review Applied **17**, + 064061 (2022). https://arxiv.org/abs/2202.06981. + +.. [3] Andrew Wack, Hanhee Paik, Ali Javadi-Abhari, Petar Jurcevic, Ismael Faro, + Jay M. Gambetta, Blake R. Johnson, Quality, Speed, and Scale: three key + attributes to measure the performance of near-term quantum computers, + https://arxiv.org/abs/2110.14108. + +See also +-------- + +* API documentation: :mod:`~qiskit_experiments.framework.RestlessMixin` diff --git a/docs/manuals/verification/quantum_volume.rst b/docs/manuals/verification/quantum_volume.rst index 5c06e5f1e5..0497800881 100644 --- a/docs/manuals/verification/quantum_volume.rst +++ b/docs/manuals/verification/quantum_volume.rst @@ -25,17 +25,19 @@ probability` > 2/3 with confidence level > 0.977 (corresponding to z_value = 2), and at least 100 trials have been ran. .. note:: - This manual requires the :mod:`qiskit_aer` package to run simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: from qiskit_experiments.framework import BatchExperiment from qiskit_experiments.library import QuantumVolume - from qiskit_aer import AerSimulator # For simulation - from qiskit.providers.fake_provider import FakeSydneyV2 + from qiskit import Aer + from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakeSydneyV2 backend = AerSimulator.from_backend(FakeSydneyV2()) diff --git a/docs/manuals/verification/randomized_benchmarking.rst b/docs/manuals/verification/randomized_benchmarking.rst index 111e3f5ddc..50e7620356 100644 --- a/docs/manuals/verification/randomized_benchmarking.rst +++ b/docs/manuals/verification/randomized_benchmarking.rst @@ -11,6 +11,11 @@ error estimates for the quantum device, by calculating the Error Per Clifford. S `__ for an explanation on the RB method, which is based on Refs. [1]_ [2]_. +.. note:: + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. + .. jupyter-execute:: import numpy as np @@ -20,7 +25,7 @@ explanation on the RB method, which is based on Refs. [1]_ [2]_. # For simulation from qiskit_aer import AerSimulator - from qiskit.providers.fake_provider import FakePerth + from qiskit_ibm_runtime.fake_provider import FakePerth backend = AerSimulator.from_backend(FakePerth()) diff --git a/docs/manuals/verification/state_tomography.rst b/docs/manuals/verification/state_tomography.rst index f207365756..dd972041dc 100644 --- a/docs/manuals/verification/state_tomography.rst +++ b/docs/manuals/verification/state_tomography.rst @@ -8,15 +8,16 @@ of a quantum state by preparing the state many times and measuring them in a tom complete basis of measurement operators. .. note:: - This tutorial requires the :mod:`qiskit_aer` package for simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. We first initialize a simulator to run the experiments on. .. jupyter-execute:: from qiskit_aer import AerSimulator - from qiskit.providers.fake_provider import FakePerth + from qiskit_ibm_runtime.fake_provider import FakePerth backend = AerSimulator.from_backend(FakePerth()) diff --git a/docs/tutorials/getting_started.rst b/docs/tutorials/getting_started.rst index d702f0d72b..7ca6e32567 100644 --- a/docs/tutorials/getting_started.rst +++ b/docs/tutorials/getting_started.rst @@ -54,16 +54,17 @@ the experiment from the Qiskit Experiments library: from qiskit_experiments.library import T1 Experiments must be run on a backend. We're going to use a simulator, -:class:`~qiskit.providers.fake_provider.FakePerth`, for this example, but you can use any +:class:`~qiskit_ibm_runtime.fake_provider.FakePerth`, for this example, but you can use any backend, real or simulated, that you can access through Qiskit. .. note:: - This tutorial requires the :mod:`qiskit_aer` package to run simulations. - You can install it with ``python -m pip install qiskit-aer``. + This tutorial requires the :mod:`qiskit_aer` and :mod:`qiskit_ibm_runtime` + packages to run simulations. You can install them with ``python -m pip + install qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: - from qiskit.providers.fake_provider import FakePerth + from qiskit_ibm_runtime.fake_provider import FakePerth from qiskit_aer import AerSimulator backend = AerSimulator.from_backend(FakePerth()) @@ -419,4 +420,4 @@ Use the `broadcast` parameter to set analysis options to each of the child exper If the child experiment inherits from :class:`.CompositeExperiment` (such as :class:`.ParallelExperiment` and :class:`.BatchExperiment` classes), this process will continue to work recursively. -In this instance, the analysis will not generate a figure for the child experiment after the analysis. \ No newline at end of file +In this instance, the analysis will not generate a figure for the child experiment after the analysis. diff --git a/docs/tutorials/visualization.rst b/docs/tutorials/visualization.rst index 1c8b5ef05d..5dc5e39483 100644 --- a/docs/tutorials/visualization.rst +++ b/docs/tutorials/visualization.rst @@ -34,8 +34,9 @@ Generating and customizing a figure using a plotter First, we display the default figure from a :class:`.Rabi` experiment as a starting point: .. note:: - This tutorial requires the :mod:`qiskit_dynamics` package to run simulations. - You can install it with ``python -m pip install qiskit-dynamics``. + This tutorial requires the :mod:`qiskit_dynamics`, :mod:`qiskit_aer`, and + :mod:`qiskit_ibm_runtime` packages to run simulations. You can install them + with ``python -m pip install qiskit-dynamics qiskit-aer qiskit-ibm-runtime``. .. jupyter-execute:: @@ -191,8 +192,8 @@ until now in this tutorial: .. jupyter-execute:: from qiskit_experiments.library import T1 - from qiskit.providers.fake_provider import FakePerth from qiskit_aer import AerSimulator + from qiskit_ibm_runtime.fake_provider import FakePerth backend = AerSimulator.from_backend(FakePerth()) diff --git a/qiskit_experiments/test/mock_iq_backend.py b/qiskit_experiments/test/mock_iq_backend.py index 09094db37a..8626af8aac 100644 --- a/qiskit_experiments/test/mock_iq_backend.py +++ b/qiskit_experiments/test/mock_iq_backend.py @@ -19,9 +19,9 @@ from qiskit.circuit.library import XGate, SXGate from qiskit.result import Result from qiskit.providers.fake_provider import FakeOpenPulse2Q -from qiskit.providers.fake_provider.fake_backend import FakeBackendV2 - from qiskit.qobj.utils import MeasLevel +from qiskit_ibm_runtime.fake_provider.fake_backend import FakeBackendV2 + from qiskit_experiments.exceptions import QiskitError from qiskit_experiments.framework import Options from qiskit_experiments.test.utils import FakeJob diff --git a/requirements-dev.txt b/requirements-dev.txt index 934285c6eb..3594ba0434 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ +qiskit==0.45.3 # Linters black~=22.0 pylint~=3.0.2 @@ -12,6 +13,7 @@ testtools # Extra dependencies for tests/documentation code multimethod +qiskit-ibm-runtime>=0.18 # Documentation tools arxiv diff --git a/requirements.txt b/requirements.txt index 2bda6ad888..23690b345a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy>=1.17 scipy>=1.4 -qiskit>=0.45 +qiskit==0.45.3 # Temporary qiskit-ibm-experiment>=0.3.4 matplotlib>=3.4 uncertainties diff --git a/test/calibration/test_calibrations.py b/test/calibration/test_calibrations.py index 3b99cd7668..68c6a5de71 100644 --- a/test/calibration/test_calibrations.py +++ b/test/calibration/test_calibrations.py @@ -36,8 +36,8 @@ from qiskit.circuit.library import CXGate, XGate from qiskit.pulse.transforms import inline_subroutines, block_to_schedule from qiskit.providers import BackendV2, Options -from qiskit.providers.fake_provider import FakeArmonkV2, FakeBelemV2 from qiskit.transpiler import Target +from qiskit_ibm_runtime.fake_provider import FakeArmonkV2, FakeBelemV2 from qiskit_experiments.framework import BackendData from qiskit_experiments.calibration_management.calibrations import Calibrations, ParameterKey diff --git a/test/calibration/test_update_library.py b/test/calibration/test_update_library.py index 0cc8186dfc..027b21b511 100644 --- a/test/calibration/test_update_library.py +++ b/test/calibration/test_update_library.py @@ -14,8 +14,8 @@ from test.base import QiskitExperimentsTestCase import numpy as np -from qiskit.providers.fake_provider import FakeAthensV2 from qiskit.qobj.utils import MeasLevel +from qiskit_ibm_runtime.fake_provider import FakeAthensV2 from qiskit_experiments.framework import BackendData from qiskit_experiments.library import QubitSpectroscopy diff --git a/test/database_service/test_db_experiment_data.py b/test/database_service/test_db_experiment_data.py index 164e5160f7..57958ae34b 100644 --- a/test/database_service/test_db_experiment_data.py +++ b/test/database_service/test_db_experiment_data.py @@ -29,7 +29,7 @@ import matplotlib.pyplot as plt import numpy as np -from qiskit.providers.fake_provider import FakeMelbourneV2 +from qiskit_ibm_runtime.fake_provider import FakeMelbourneV2 from qiskit.result import Result from qiskit.providers import JobV1 as Job from qiskit.providers import JobStatus diff --git a/test/framework/test_backend_timing.py b/test/framework/test_backend_timing.py index c270795069..a7951b2c21 100644 --- a/test/framework/test_backend_timing.py +++ b/test/framework/test_backend_timing.py @@ -16,7 +16,7 @@ from ddt import data, ddt, unpack from qiskit import QiskitError -from qiskit.providers.fake_provider import FakeNairobiV2 +from qiskit_ibm_runtime.fake_provider import FakeNairobiV2 from qiskit_experiments.framework import BackendTiming diff --git a/test/framework/test_framework.py b/test/framework/test_framework.py index 105a5ffdf5..0d52da1d84 100644 --- a/test/framework/test_framework.py +++ b/test/framework/test_framework.py @@ -19,9 +19,10 @@ import ddt from qiskit import QuantumCircuit -from qiskit.providers.fake_provider import FakeVigoV2, FakeJob +from qiskit.providers.fake_provider import FakeJob from qiskit.providers.jobstatus import JobStatus from qiskit.exceptions import QiskitError +from qiskit_ibm_runtime.fake_provider import FakeVigoV2 from qiskit_experiments.exceptions import AnalysisError from qiskit_experiments.framework import ( diff --git a/test/library/calibration/test_drag.py b/test/library/calibration/test_drag.py index b66e735f3b..d870b83d3a 100644 --- a/test/library/calibration/test_drag.py +++ b/test/library/calibration/test_drag.py @@ -20,9 +20,9 @@ from qiskit import pulse from qiskit.circuit import Parameter from qiskit.exceptions import QiskitError -from qiskit.providers.fake_provider import FakeWashingtonV2 from qiskit.pulse import DriveChannel, Drag from qiskit.qobj.utils import MeasLevel +from qiskit_ibm_runtime.fake_provider import FakeWashingtonV2 from qiskit_experiments.library import RoughDrag, RoughDragCal from qiskit_experiments.library.characterization.analysis import DragCalAnalysis diff --git a/test/library/calibration/test_fine_amplitude.py b/test/library/calibration/test_fine_amplitude.py index 659e0f758a..7608f434b5 100644 --- a/test/library/calibration/test_fine_amplitude.py +++ b/test/library/calibration/test_fine_amplitude.py @@ -18,8 +18,8 @@ from qiskit import pulse from qiskit.circuit import Gate from qiskit.circuit.library import XGate, SXGate -from qiskit.providers.fake_provider import FakeArmonkV2 from qiskit.pulse import DriveChannel, Drag +from qiskit_ibm_runtime.fake_provider import FakeArmonkV2 from qiskit_experiments.library import ( FineXAmplitude, diff --git a/test/library/calibration/test_fine_drag.py b/test/library/calibration/test_fine_drag.py index 818152c07d..f592008c17 100644 --- a/test/library/calibration/test_fine_drag.py +++ b/test/library/calibration/test_fine_drag.py @@ -17,7 +17,7 @@ from qiskit import pulse from qiskit.circuit import Gate -from qiskit.providers.fake_provider import FakeArmonkV2 +from qiskit_ibm_runtime.fake_provider import FakeArmonkV2 from qiskit_experiments.library import FineDrag, FineXDrag, FineDragCal from qiskit_experiments.test.mock_iq_backend import MockIQBackend diff --git a/test/library/calibration/test_fine_frequency.py b/test/library/calibration/test_fine_frequency.py index 87aa30a175..e6d6f78d1d 100644 --- a/test/library/calibration/test_fine_frequency.py +++ b/test/library/calibration/test_fine_frequency.py @@ -17,7 +17,7 @@ from ddt import ddt, data from qiskit import pulse -from qiskit.providers.fake_provider import FakeArmonkV2 +from qiskit_ibm_runtime.fake_provider import FakeArmonkV2 from qiskit_experiments.library import ( FineFrequency, diff --git a/test/library/calibration/test_ramsey_xy.py b/test/library/calibration/test_ramsey_xy.py index 76bd953211..43ba1dbf67 100644 --- a/test/library/calibration/test_ramsey_xy.py +++ b/test/library/calibration/test_ramsey_xy.py @@ -16,8 +16,8 @@ from test.base import QiskitExperimentsTestCase from ddt import ddt, data, named_data -from qiskit.providers.fake_provider import FakeArmonkV2 from qiskit_aer import AerSimulator +from qiskit_ibm_runtime.fake_provider import FakeArmonkV2 from qiskit_experiments.calibration_management.calibrations import Calibrations from qiskit_experiments.calibration_management.basis_gate_library import FixedFrequencyTransmon diff --git a/test/library/characterization/test_cross_resonance_hamiltonian.py b/test/library/characterization/test_cross_resonance_hamiltonian.py index 540c0e0dc4..61176cca24 100644 --- a/test/library/characterization/test_cross_resonance_hamiltonian.py +++ b/test/library/characterization/test_cross_resonance_hamiltonian.py @@ -19,8 +19,8 @@ import io import numpy as np from ddt import ddt, data, unpack + from qiskit import QuantumCircuit, pulse, qpy, quantum_info as qi -from qiskit.providers.fake_provider import FakeBogotaV2 # TODO: remove old path after we stop supporting the relevant version of Qiskit try: @@ -29,6 +29,8 @@ from qiskit.extensions.hamiltonian_gate import HamiltonianGate from qiskit_aer import AerSimulator +from qiskit_ibm_runtime.fake_provider import FakeBogotaV2 + from qiskit_experiments.library.characterization import cr_hamiltonian diff --git a/test/library/characterization/test_half_angle.py b/test/library/characterization/test_half_angle.py index e90c6b6d96..d131fcae99 100644 --- a/test/library/characterization/test_half_angle.py +++ b/test/library/characterization/test_half_angle.py @@ -16,8 +16,8 @@ import copy from qiskit import pulse, transpile -from qiskit.providers.fake_provider import FakeAthens from qiskit.pulse import InstructionScheduleMap +from qiskit_ibm_runtime.fake_provider import FakeAthens from qiskit_experiments.test.mock_iq_backend import MockIQBackend from qiskit_experiments.test.mock_iq_helpers import MockIQHalfAngleHelper as HalfAngleHelper diff --git a/test/library/characterization/test_qubit_spectroscopy.py b/test/library/characterization/test_qubit_spectroscopy.py index 12ae08a4a5..8dc52bfeb9 100644 --- a/test/library/characterization/test_qubit_spectroscopy.py +++ b/test/library/characterization/test_qubit_spectroscopy.py @@ -16,7 +16,7 @@ from qiskit.qobj.utils import MeasLevel from qiskit.circuit.library import XGate -from qiskit.providers.fake_provider import FakeWashingtonV2 +from qiskit_ibm_runtime.fake_provider import FakeWashingtonV2 from qiskit_experiments.framework import ParallelExperiment from qiskit_experiments.framework import BackendData diff --git a/test/library/characterization/test_readout_error.py b/test/library/characterization/test_readout_error.py index ef4107d413..0e32e75d0e 100644 --- a/test/library/characterization/test_readout_error.py +++ b/test/library/characterization/test_readout_error.py @@ -19,9 +19,9 @@ from test.base import QiskitExperimentsTestCase import numpy as np from qiskit.quantum_info.operators.predicates import matrix_equal -from qiskit.providers.fake_provider import FakeParisV2 -from qiskit_ibm_experiment import IBMExperimentService from qiskit_aer import AerSimulator +from qiskit_ibm_experiment import IBMExperimentService +from qiskit_ibm_runtime.fake_provider import FakeParisV2 from qiskit_experiments.library.characterization import LocalReadoutError, CorrelatedReadoutError from qiskit_experiments.framework import ExperimentData from qiskit_experiments.framework import ParallelExperiment diff --git a/test/library/characterization/test_t1.py b/test/library/characterization/test_t1.py index 6c49a9130d..475e1d82e9 100644 --- a/test/library/characterization/test_t1.py +++ b/test/library/characterization/test_t1.py @@ -16,7 +16,7 @@ from test.base import QiskitExperimentsTestCase import numpy as np from qiskit.qobj.utils import MeasLevel -from qiskit.providers.fake_provider import FakeAthensV2 +from qiskit_ibm_runtime.fake_provider import FakeAthensV2 from qiskit_experiments.test.noisy_delay_aer_simulator import NoisyDelayAerBackend from qiskit_experiments.framework import ExperimentData, ParallelExperiment from qiskit_experiments.library import T1 diff --git a/test/library/characterization/test_t2hahn.py b/test/library/characterization/test_t2hahn.py index 8e3d124e48..6c068a0e75 100644 --- a/test/library/characterization/test_t2hahn.py +++ b/test/library/characterization/test_t2hahn.py @@ -18,8 +18,8 @@ import numpy as np from ddt import ddt, data, named_data, unpack -from qiskit.providers.fake_provider import FakeVigoV2 from qiskit_aer import AerSimulator +from qiskit_ibm_runtime.fake_provider import FakeVigoV2 from qiskit_experiments.framework import ParallelExperiment from qiskit_experiments.library.characterization.t2hahn import T2Hahn diff --git a/test/library/characterization/test_t2ramsey.py b/test/library/characterization/test_t2ramsey.py index 599c9a547a..ca6a961981 100644 --- a/test/library/characterization/test_t2ramsey.py +++ b/test/library/characterization/test_t2ramsey.py @@ -18,8 +18,8 @@ import numpy as np from ddt import ddt, named_data -from qiskit.providers.fake_provider import FakeVigoV2 from qiskit_aer import AerSimulator +from qiskit_ibm_runtime.fake_provider import FakeVigoV2 from qiskit_experiments.framework import ParallelExperiment from qiskit_experiments.library import T2Ramsey diff --git a/test/library/characterization/test_zz_ramsey.py b/test/library/characterization/test_zz_ramsey.py index b2d45675c8..10b12950a0 100644 --- a/test/library/characterization/test_zz_ramsey.py +++ b/test/library/characterization/test_zz_ramsey.py @@ -21,8 +21,8 @@ from ddt import ddt, idata, named_data, unpack from qiskit import QuantumCircuit -from qiskit.providers.fake_provider import FakeVigoV2 from qiskit_aer import AerSimulator +from qiskit_ibm_runtime.fake_provider import FakeVigoV2 from qiskit_experiments.library import ZZRamsey from qiskit_experiments.test.mock_iq_backend import MockIQBackend diff --git a/test/library/driven_freq_tuning/test_stark_p1_spect.py b/test/library/driven_freq_tuning/test_stark_p1_spect.py index 00ddbd5c6f..ed3be9c25b 100644 --- a/test/library/driven_freq_tuning/test_stark_p1_spect.py +++ b/test/library/driven_freq_tuning/test_stark_p1_spect.py @@ -19,7 +19,7 @@ from qiskit import pulse from qiskit.circuit import QuantumCircuit, Gate from qiskit.providers import QubitProperties -from qiskit.providers.fake_provider import FakeHanoiV2 +from qiskit_ibm_runtime.fake_provider import FakeHanoiV2 from qiskit_experiments.framework import ExperimentData, AnalysisResultData from qiskit_experiments.library import StarkP1Spectroscopy diff --git a/test/library/driven_freq_tuning/test_stark_ramsey_xy.py b/test/library/driven_freq_tuning/test_stark_ramsey_xy.py index dd0fd59e4a..3791ce9d7a 100644 --- a/test/library/driven_freq_tuning/test_stark_ramsey_xy.py +++ b/test/library/driven_freq_tuning/test_stark_ramsey_xy.py @@ -18,7 +18,7 @@ from ddt import ddt, unpack, named_data from qiskit import pulse -from qiskit.providers.fake_provider import FakeHanoiV2 +from qiskit_ibm_runtime.fake_provider import FakeHanoiV2 from qiskit_experiments.library import StarkRamseyXY, StarkRamseyXYAmpScan from qiskit_experiments.library.driven_freq_tuning.ramsey_amp_scan_analysis import ( diff --git a/test/library/randomized_benchmarking/test_interleaved_rb.py b/test/library/randomized_benchmarking/test_interleaved_rb.py index 1f7b567a23..f01fd6a764 100644 --- a/test/library/randomized_benchmarking/test_interleaved_rb.py +++ b/test/library/randomized_benchmarking/test_interleaved_rb.py @@ -20,10 +20,10 @@ from qiskit.circuit import Delay, QuantumCircuit, Parameter, Gate from qiskit.circuit.library import SXGate, CXGate, TGate, CZGate from qiskit.exceptions import QiskitError -from qiskit.providers.fake_provider import FakeManila, FakeManilaV2, FakeWashington from qiskit.transpiler import InstructionProperties from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel, depolarizing_error +from qiskit_ibm_runtime.fake_provider import FakeManila, FakeManilaV2, FakeWashington from qiskit_experiments.library import randomized_benchmarking as rb diff --git a/test/library/randomized_benchmarking/test_standard_rb.py b/test/library/randomized_benchmarking/test_standard_rb.py index fde71cc5e3..2ccd5a47df 100644 --- a/test/library/randomized_benchmarking/test_standard_rb.py +++ b/test/library/randomized_benchmarking/test_standard_rb.py @@ -19,10 +19,10 @@ from qiskit.circuit.library import SXGate from qiskit.exceptions import QiskitError -from qiskit.providers.fake_provider import FakeManilaV2 from qiskit.pulse import Schedule, InstructionScheduleMap from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel, depolarizing_error +from qiskit_ibm_runtime.fake_provider import FakeManilaV2 from qiskit_experiments.framework.composite import ParallelExperiment from qiskit_experiments.library import randomized_benchmarking as rb @@ -372,7 +372,7 @@ def test_poor_experiment_result(self): This is a special case that fit outcome is very sensitive to initial guess. Perhaps generated initial guess is close to a local minima. """ - from qiskit.providers.fake_provider import FakeVigoV2 + from qiskit_ibm_runtime.fake_provider import FakeVigoV2 backend = FakeVigoV2() backend.set_options(seed_simulator=123)