diff --git a/doc/source/conf.py b/doc/source/conf.py index 193a84e86..a73900996 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -33,6 +33,13 @@ # master_doc = "index" autodoc_mock_imports = ["qm"] +autodoc_default_options = { + "members": True, + "undoc-members": True, + "private-members": True, + "inherited-members": True, + "exclude-members": "load, execution_parameters, classify", +} # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom diff --git a/doc/source/getting-started/index.rst b/doc/source/getting-started/index.rst index b2b497296..460a01344 100644 --- a/doc/source/getting-started/index.rst +++ b/doc/source/getting-started/index.rst @@ -11,5 +11,5 @@ your quantum hardware. installation interface runcard - protocols + ../protocols/index example diff --git a/doc/source/getting-started/protocols.rst b/doc/source/getting-started/protocols.rst deleted file mode 100644 index 6d35cc39a..000000000 --- a/doc/source/getting-started/protocols.rst +++ /dev/null @@ -1,16 +0,0 @@ -Protocols -========= - -Here is a scheme with the protocols currently available in Qibocal. - - -.. image:: qpu_characterization.svg - - -The source code for each protocol is available in the :ref:`Components`. - -.. toctree:: - :maxdepth: 2 - :caption: Protocols - - ../protocols/index diff --git a/doc/source/getting-started/runcard.rst b/doc/source/getting-started/runcard.rst index 22ff26f29..0854d5cf6 100644 --- a/doc/source/getting-started/runcard.rst +++ b/doc/source/getting-started/runcard.rst @@ -1,7 +1,7 @@ .. _runcard: How to execute calibration protocols in ``Qibocal``? -================================================ +==================================================== In ``Qibocal`` we adopt a declarative programming paradigm, i.e. the user should specify directly what he wants to do without caring about the underlying implementation. diff --git a/doc/source/protocols/allxy.png b/doc/source/protocols/allxy.png new file mode 100644 index 000000000..c07c23616 Binary files /dev/null and b/doc/source/protocols/allxy.png differ diff --git a/doc/source/protocols/allxy.rst b/doc/source/protocols/allxy.rst new file mode 100644 index 000000000..932b1396b --- /dev/null +++ b/doc/source/protocols/allxy.rst @@ -0,0 +1,28 @@ +All-XY +====== + +The All-XY experiment is commonly used to evaluate the quality of the single qubit rotations :cite:p:`gao2021practical`. In this protocol, a sequence +of single qubit rotations pairs are performed, such that the resulting states form a staircase pattern where only :math:`\ket{0}`, +:math:`\ket{1}` or a superposition of the two are present. + +Parameters +^^^^^^^^^^ + +.. autoclass:: + qibocal.protocols.allxy.allxy.AllXYParameters + :noindex: + +Example +^^^^^^^ +It follows a runcard example of this experiment. + +.. code-block:: yaml + + - id: allxy + operation: allxy + parameters: + nshots: 2000 + +The expected output is the following: + +.. image:: allxy.png diff --git a/doc/source/protocols/classification.png b/doc/source/protocols/classification.png index aa4c22b68..fbb00b9cc 100644 Binary files a/doc/source/protocols/classification.png and b/doc/source/protocols/classification.png differ diff --git a/doc/source/protocols/dispersive_shift.png b/doc/source/protocols/dispersive_shift.png new file mode 100644 index 000000000..5ca9652f5 Binary files /dev/null and b/doc/source/protocols/dispersive_shift.png differ diff --git a/doc/source/protocols/dispersive_shift.rst b/doc/source/protocols/dispersive_shift.rst new file mode 100644 index 000000000..d4a19e67c --- /dev/null +++ b/doc/source/protocols/dispersive_shift.rst @@ -0,0 +1,65 @@ +.. _dispersive_shift: + +Dispersive shift +================ + +In this section we present the dispersive shift routines provided by Qibocal. + +Theory +------ + +A system with a qubit and a resonator, interacting with each other, is described by the James-Cummings Hamiltonian. +Restricting the qubit states to the first two levels, we get + +.. math:: + \hat{H}_{\text{JC}} = \hbar \omega_r \hat{a}^\dagger \hat{a} + \frac{\hbar \omega_q}{2} \hat{\sigma}_z + \hbar g (\hat{a}^\dagger \hat{\sigma}_- + \hat{a} \hat{\sigma}_+) + +where :math:`\omega_r` and :math:`\omega_q` are respectively the resonator and the qubit frequencies, and :math:`g` is the coupling +constant between the qubit and the resonator. +In the dispersive regime :math:`g \ll \lvert \omega_r - \omega_q \rvert`, the Hamiltonian can be rewritten as + +.. math:: + :label: eq_1 + + \hat{H}_{\text{eff}} = \hbar \hat{a}^\dagger \hat{a} (\omega_r - \chi \hat{\sigma}_z) + \frac{\hbar}{2} (\omega_q + \chi) \hat{\sigma}_z + +where we introduced the dispersive shift + +.. math:: + \chi = \frac{g^2}{\lambda}. + +Equation :eq:`eq_1` shows that the resonator frequency is :math:`\omega_{r,0} = \omega_r - \chi` (:math:`\omega_{r,1} = \omega_r + \chi`) when the +qubit is in the ground (excited) state. The separation between the two freqiencies is :math:`\lvert 2 \chi \rvert`. + +Routine description +^^^^^^^^^^^^^^^^^^^ +After collecting the data from the two spectroscopies, for each readout frequency the distance of the centers of the blobs for +:math:`\ket{0}` and :math:`\ket{1}` states are evaluated. The best readout frequency is the one maximizing the distance between the two blobs. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.dispersive_shift.DispersiveShiftParameters + :noindex: + +Example +^^^^^^^ +It follows an example of the experiment parameters. + +.. code-block:: yaml + + - id: dispersive shift qt + operation: dispersive_shift_qutrit + parameters: + freq_step: 200000 + freq_width: 1000000 + + +After running `qq auto`, the experiment is executed and the result will looks like +the following picture. + +.. image:: dispersive_shift.png + +Requirements +^^^^^^^^^^^^ +- :ref:`rabi` diff --git a/doc/source/protocols/flipping.png b/doc/source/protocols/flipping.png new file mode 100644 index 000000000..4edbcca18 Binary files /dev/null and b/doc/source/protocols/flipping.png differ diff --git a/doc/source/protocols/flipping.rst b/doc/source/protocols/flipping.rst new file mode 100644 index 000000000..2b39ae8cf --- /dev/null +++ b/doc/source/protocols/flipping.rst @@ -0,0 +1,56 @@ +Flipping +======== + +The flipping experiment corrects the amplitude in the qubit drive pulse. In this experiment, +we applying an :math:`R_x(\pi/2)` rotation followed by :math:`N` flips (two :math:`R_x(\pi)` rotations) +and we measure the qubit state. +The first :math:`R_x(\pi/2)` is necessary to discriminate the over rotations and under rotations of the :math:`R_x(\pi)` pulse: +without it the difference between the two cases is just a global phase, i.e., the +probabilities are the same. With the :math:`R_x(\pi/2)` pulse, in case of under rotations the state will be closer to :math:`\ket{0}` +after the initial flip, in the over rotations one the final state will be closer to :math:`\ket{1}`. + +By fitting the resulting data with a sinusoidal function, we can determine the delta amplitude, which allows us to refine the +:math:`\pi` pulse amplitue. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.flipping.FlippingParameters + :noindex: + +Example +^^^^^^^ +It follows a runcard example of this experiment. + +.. code-block:: yaml + + - id: flipping + operation: flipping + parameters: + detuning: 0.05 + nflips_max: 30 + nflips_step: 1 + +The expected output is the following: + +.. image:: flipping.png + +Qibocal provides also a "signal" version of this routine, it follows a possible runcard +with its report. + +.. code-block:: yaml + + - id: flipping + operation: flipping_signal + parameters: + detuning: -0.5 + nflips_max: 20 + nflips_step: 1 + +.. image:: flipping_signal.png + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` +- :ref:`single_shot` diff --git a/doc/source/protocols/flipping_signal.png b/doc/source/protocols/flipping_signal.png new file mode 100644 index 000000000..9427aa7fa Binary files /dev/null and b/doc/source/protocols/flipping_signal.png differ diff --git a/doc/source/protocols/flux/crosstalk.rst b/doc/source/protocols/flux/crosstalk.rst new file mode 100644 index 000000000..dc5226c58 --- /dev/null +++ b/doc/source/protocols/flux/crosstalk.rst @@ -0,0 +1,111 @@ +Flux crosstalk experiments +========================== + +In this section we show how to run flux crosstalk experiments. + +As we saw in :ref:`flux` the external flux affecting a qubit line :math:`i` +will receive contributions from other qubits + +.. math:: + + \Phi_i = \sum_{j} C_{ij} V_j + \Phi_i^{\text{offset}} \quad , + +which means that the transmon frequency can change when current is applied +on other qubits. + +.. _qubit_crosstalk: + +Qubit crosstalk +--------------- + +It is possible to measure qubit crosstalk by running a `qubit_crosstalk` experiment. +Assuming that the target qubit is at the sweetspot, in order to measure crosstalk +effects it is suggested to bias the qubit away. + +Here is a possible runcard where we measure the crosstalk on qubit 2 +caused by qubit 3 and 0. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.flux_dependence.qubit_crosstalk.QubitCrosstalkParameters + :noindex: + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: qubit crosstalk + operation: qubit_crosstalk + targets: [2] + parameters: + bias_point: + 2: 0.25 + bias_step: 0.001 + bias_width: 0.05 + drive_amplitude: 0.002 + drive_duration: 4000 + flux_qubits: [0, 3] + freq_step: 200000 + freq_width: 10000000 + nshots: 1024 + relaxation_time: 20000 + + +.. image:: qubit_crosstalk.png + +The previous runcard aims at extracting the crosstalk coefficients +:math:`C_{20}` and :math:`C_{23}`. + +Requirements +^^^^^^^^^^^^ + +- :ref:`qubit_flux` + +.. _resonator_crosstalk: + +Resonator crosstalk +------------------- + +In a similar fashion it is possible to repeat the previous experiment +by sweeping the readout frequency. Note that in this case it will be +necessary to bias the qubit away from its sweetspot more to observe +significant variations. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.flux_dependence.resonator_crosstalk.ResCrosstalkParameters + :noindex: + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: resonator crosstalk + operation: resonator_crosstalk + targets: [2] + parameters: + bias_point: + 2: 0.5 + bias_step: 0.01 + bias_width: 0.4 + flux_qubits: [0, 3] + freq_step: 100000 + freq_width: 6000000 + nshots: 2000 + +.. image:: resonator_crosstalk.png + +As we can see, even by biasing the qubit away from its sweetspot we are not able to see +a dependence ( a deviation from the straight line) but only a shift. + +The protocols aims at extracting the crosstalk coefficients +:math:`C_{20}` and :math:`C_{23}`. + +Requirements +^^^^^^^^^^^^ + +- :ref:`resonator_flux` diff --git a/doc/source/protocols/flux/qubit_crosstalk.png b/doc/source/protocols/flux/qubit_crosstalk.png new file mode 100644 index 000000000..a4c430df6 Binary files /dev/null and b/doc/source/protocols/flux/qubit_crosstalk.png differ diff --git a/doc/source/protocols/flux/qubit_flux.png b/doc/source/protocols/flux/qubit_flux.png new file mode 100644 index 000000000..560b388b7 Binary files /dev/null and b/doc/source/protocols/flux/qubit_flux.png differ diff --git a/doc/source/protocols/flux/resonator_crosstalk.png b/doc/source/protocols/flux/resonator_crosstalk.png new file mode 100644 index 000000000..1024aaa93 Binary files /dev/null and b/doc/source/protocols/flux/resonator_crosstalk.png differ diff --git a/doc/source/protocols/flux/resonator_flux.png b/doc/source/protocols/flux/resonator_flux.png new file mode 100644 index 000000000..6b0565da2 Binary files /dev/null and b/doc/source/protocols/flux/resonator_flux.png differ diff --git a/doc/source/protocols/flux/single.rst b/doc/source/protocols/flux/single.rst new file mode 100644 index 000000000..07ae5ca47 --- /dev/null +++ b/doc/source/protocols/flux/single.rst @@ -0,0 +1,173 @@ +.. _flux: + +Frequency vs flux experiments +============================= + +In this section we show how to run experiments to study +the flux dependence. + +Flux-tunable transmons +---------------------- + +It can be shown for flux-tunable transmons that applying an external flux +:math:`\Phi` induces to a detuning on the transmon frequency :cite:p:`Koch_2007`. +By applying short flux pulses it is possible to tune the transmon frequency in order +of GHz, which leads to several applications including quantum logical gates. + +The transmon frequency as a function of the external flux can be expressed as :cite:p:`Barrett_2023` + +.. math:: + + f_q(\Phi) = \Bigg( f_q^{\text{max}} + \frac{E_C}{h} \Bigg) \sqrt[4]{d^2 + (1-d^2)\cos^2\Big( \pi \frac{\Phi}{\Phi_0}\Big)} - \frac{E_C}{h} \, + +where :math:`f_{\text{max}} = ( \sqrt{8 E_C E_J} - E_C) / h` is the maximum qubit frequency, +:math:`d` is the junctions asymmetry, :math:`E_C` is the charging energy, +:math:`E_J` is the Josephson energy and :math:`\Phi_0 = h / (2e)` is the flux quanta. + +The resonator detuning in the transmon regime :math:`E_J \gg E_C` can be computed as + +.. math:: + + f_r(\Phi) = f_r^{\text{bare}} + g_0^2 \frac{\sqrt[4]{d^2 + (1-d^2)\cos^2\Big( \pi \frac{\Phi}{\Phi_0}\Big)}}{f_r^{\text{bare}} - f_q(\Phi)} \, + +where :math:`f_r^{\text{bare}}` is the bare frequency of the resonator and :math:`g_0^2` is the +coupling between the transmon and the resonator. + +In Qibocal we provide two experiments to measure and fit the curves described by the two equations +above. To measure the qubit detuning a 2D sweep is performed probing the systems at different drive frequencies +and at different flux (bias) offset values. For the resonator we perform the same experiment +by sweeping the readout frequency instead of the drive frequency. + +.. _qubit_flux: + +Qubit flux dependence +--------------------- + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.flux_dependence.qubit_flux_dependence.QubitFluxParameters + :noindex: + +Example +^^^^^^^ + +A possible runcard to assess how the qubit frequency changes by varying flux is the following: + +.. code-block:: yaml + + - id: qubit flux dependence + operation: qubit_flux + parameters: + bias_step: 0.001 + bias_width: 0.05 + drive_amplitude: 0.002 + drive_duration: 4000 + freq_step: 200000 + freq_width: 10000000 + nshots: 1024 + relaxation_time: 20000 + + +The expected output is the following: + +.. image:: qubit_flux.png + +From the acquired data this protocol estimates the flux insensitive point "sweetspot", +which corresponds to the flux value where the frequency is maximed, as well as the drive frequency +and the diagonal crosstalk coefficient :math:`V_{ii}`. +Both the sweetspot and the :math:`C_{ii}` can be understood by writing the full expression for +the flux felt by qubit :math:`i` :cite:p:`Barrett_2023`: + +.. math:: + + \Phi_i = \sum_{j} C_{ij} V_j + \Phi_i^{\text{offset}} \, + +where :math:`C_{ij}` is known in the literature as the crosstalk matrix, while +:math:`V_{i}` is the applied voltage. + +Requirements +^^^^^^^^^^^^ + +- :ref:`qubit-spectroscopy` + +.. _resonator_flux: + +Resonator flux dependence +------------------------- + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.flux_dependence.resonator_flux_dependence.ResonatorFluxParameters + :noindex: + +Example +^^^^^^^ + +A possible runcard to assess how the resonator frequency changes by varying flux is the following: + +.. code-block:: yaml + + - id: resonator flux dependence + operation: resonator_flux + parameters: + bias_step: 0.01 + bias_width: 0.4 + freq_step: 100000 + freq_width: 6000000 + nshots: 2000 + relaxation_time: 1000 + + +From this protocol it is possible to extract both the bare and the dressed resonator frequency +as well as an estimate for the coupling :math:`g_0`. +It is suggested to run this protocol only after executing the qubit flux dependence experiment +since some of the coefficients required can be computed with that experiment. + + +.. image:: resonator_flux.png + +Requirements +^^^^^^^^^^^^ + +- :ref:`resonator_punchout` +- :ref:`qubit_flux` + +Qubit flux dependence (tracking) +-------------------------------- + +As we saw above both the resonator and the qubit are affected by an external flux. +In the qubit flux dependence the measurement is performed at fixed readout frequency. +To take into account how the transmon shifts in frequency when probing the qubit we have +another experiment `qubit_flux_tracking`. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.flux_dependence.qubit_flux_tracking.QubitFluxTrackParameters + :noindex: + +Example +^^^^^^^ + +Here is a possible runcard: + +.. code-block:: yaml + + - id: qubit flux dependence + operation: qubit_flux_tracking + parameters: + bias_step: 0.001 + bias_width: 0.05 + drive_amplitude: 0.002 + drive_duration: 4000 + freq_step: 200000 + freq_width: 10000000 + nshots: 1024 + relaxation_time: 20000 + +Requirements +^^^^^^^^^^^^ + +- :ref:`resonator_flux` diff --git a/doc/source/protocols/index.rst b/doc/source/protocols/index.rst index ecacc6dd4..8bb07a88e 100644 --- a/doc/source/protocols/index.rst +++ b/doc/source/protocols/index.rst @@ -1,10 +1,30 @@ Protocols ========= +Here is a scheme with the protocols currently available in Qibocal. + + +.. image:: ../getting-started/qpu_characterization.svg + In this section we introduce the basics of all protocols supported by ``qibocal``. .. toctree:: :maxdepth: 1 + signal/time_of_flight + signal/calibrate_kernel resonator_spectroscopy resonator_punchout + qubit_spectroscopy/qubit_spectroscopy + ramsey/ramsey + t1/t1 + t2/t2 + t2_echo/t2_echo + flux/single + flux/crosstalk + rabi/rabi + singleshot + dispersive_shift + allxy + flipping + references diff --git a/doc/source/protocols/qubit_spectroscopy/qubit_spec.png b/doc/source/protocols/qubit_spectroscopy/qubit_spec.png new file mode 100644 index 000000000..9d9dbaee3 Binary files /dev/null and b/doc/source/protocols/qubit_spectroscopy/qubit_spec.png differ diff --git a/doc/source/protocols/qubit_spectroscopy/qubit_spectroscopy.rst b/doc/source/protocols/qubit_spectroscopy/qubit_spectroscopy.rst new file mode 100644 index 000000000..fa648ae18 --- /dev/null +++ b/doc/source/protocols/qubit_spectroscopy/qubit_spectroscopy.rst @@ -0,0 +1,130 @@ +.. _qubit-spectroscopy: + +Qubit spectroscopies +==================== + +In this section we are going to present how to run with qibocal some +qubit spectroscopy experiments. + +.. _qubit_spectroscopy: + +Qubit Spectroscopy +------------------ + +To measure the resonance frequency of the qubit it is possible to perform +a `qubit spectroscopy` experiment. +After having obtained an initial guess for the readout amplitude and the readout +frequency through a :ref:`resonator_punchout` this experiment aims at extracting the frequency of the qubit. + +In this protocol the qubit is probed by sending a drive pulse at +variable frequency :math:`w` before measuring. When :math:`w` is close +to the transition frequency :math:`w_{01}` some of the population will +move to the excited state. If the drive pulse is long enough it will be +generated a maximally mixed state with :math:`\rho \propto I` :cite:p:`Baur2012RealizingQG, gao2021practical`. + + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.qubit_spectroscopy.QubitSpectroscopyParameters + + +How to execute a qubit spectroscopy experiment +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A possible runcard to launch a qubit spectroscopy experiment could be the following: + +.. code-block:: yaml + + - id: qubit spectroscopy 01 + operation: qubit_spectroscopy + parameters: + drive_amplitude: 0.01 # drive power + drive_duration: 4000 # ns + freq_width: 20_000_000 + freq_step: 1_000_000 + nshots: 1024 + relaxation_time: 20_000 + + +Here is the corresponding plot: + +.. image:: qubit_spec.png + + +To extract the qubit frequency a Lorentzian fit is performed. +After the post-processing the following parameters will be updated: + +* qubit.drive_frequency +* qubit.native_gates.RX.frequency + +Requirements +^^^^^^^^^^^^ + +- :ref:`resonator_spectroscopy` +- :ref:`resonator_punchout` + +.. _qubit_spectroscopy_ef: + +Qubit spectroscopy for higher excited states +-------------------------------------------- + +Through a qubit spectroscopy experiment it is possible to target also the transition +frequencies towards higher energy level other than the first excited state. + +To visualize these secondary excitations it is necessary to provide a considerable +amount of drive power, which might be outside the limit of the experimental setup. + +Another way to address the higher levels is to first excite the qubit to state +:math:`\ket{1}` followed by the sequence previously presented for the qubit spectroscopy. +In this way it is possible to induce a transition between :math:`\ket{1}\leftrightarrow\ket{2}`. + +Such frequency :math:`\omega_{12}` should be below :math:`\omega_{01}` by around :math:`200 - 300` MHz +for flux tunable transmons. +From :math:`\omega_{12}` and :math:`\omega_{01}` it is possible to compute the anharmonicity +:math:`\alpha` as :cite:p:`Koch_2007`: + +.. math:: + + \alpha = \omega_{12} - \omega_{01} + +In the literature the energy levels can be expressed as :math:`\ket{g}, \ket{e}, \ket{f}`, to +address the ground state, the excited state and the first excited state above the excited state. +For this reason the experiments has been labelled ``qubit_spectroscopy_ef``. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.qubit_spectroscopy_ef.QubitSpectroscopyEFParameters + +How to execute a qubit spectroscopy experiment +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A possible runcard to launch a qubit spectroscopy experiment could be the following: + +.. code-block:: yaml + + - id: qubit spectroscopy 12 + operation: qubit_spectroscopy_ef + parameters: + drive_amplitude: 0.01 # drive power + drive_duration: 4000 # ns + freq_width: 20_000_000 + freq_step: 1_000_000 + nshots: 1024 + relaxation_time: 20_000 + + +Here is the corresponding plot: + +.. image:: qubit_spectroscopy_ef.png + +To extract :math:`\omega_{12}` a lorentzian fit is performed. +After the post-processing both the anharmonicity and the frequency of +the `RX12` pulse (which is the pulse that allows to drive a qubit +from state :math:`\ket{1}` to state :math:`\ket{2}`) are updated. + +Requirements +^^^^^^^^^^^^ + +- :ref:`single_shot` diff --git a/doc/source/protocols/qubit_spectroscopy/qubit_spectroscopy_ef.png b/doc/source/protocols/qubit_spectroscopy/qubit_spectroscopy_ef.png new file mode 100644 index 000000000..f6d9f4ba4 Binary files /dev/null and b/doc/source/protocols/qubit_spectroscopy/qubit_spectroscopy_ef.png differ diff --git a/doc/source/protocols/rabi/rabi.rst b/doc/source/protocols/rabi/rabi.rst new file mode 100644 index 000000000..360d03093 --- /dev/null +++ b/doc/source/protocols/rabi/rabi.rst @@ -0,0 +1,140 @@ +.. _rabi: + +Rabi experiments +================ + +In this section we present all Rabi experiments provided by Qibocal. + +Rabi lenght and amplitude +------------------------- + +The goal of the Rabi experiment is to tune the amplitude (duration) of the drive pulse, in order +to excite the qubit from the ground state up to state :math:`\ket{1}`. + +In the Rabi experiment, the qubit is probed with a drive pulse at the qubit frequency :math:`w_{01}` +before measuring. This pulse sequence is repeated multiple times changing the amplitude (duration) of the pulse. +The qubit starts in the ground state, changing one of the two parameters of the drive pulse, the probability of being in the first +excited state increases following a sinusoidal pattern. + +For the amplitude version, we expect: + +.. math:: + p_e(t) =\frac{1}{2} \left( 1 - \cos\left(\Omega_R t \right) \right) + +For the time version, we have to take into account the dephasing and the energy decay. In case the +Rabi rate is larger than the decay and the pure dephasing rate, + +.. math:: + p_e(t) = \frac{1}{2} \left(1- e^{-t/\tau} \cos\left(\Omega_R \frac{t}{2}\right)\right) + +where :math:`\Omega_R` is the Rabi frequency and :math:`\tau` the decay time. + +Parameters +^^^^^^^^^^ + +.. autoclass:: + qibocal.protocols.rabi.amplitude.RabiAmplitudeParameters + :noindex: + +.. autoclass:: + qibocal.protocols.rabi.length.RabiLengthParameters + :noindex: + +Example +^^^^^^^ +It follows an example of the experiment parameters. + +.. code-block:: yaml + + - id: Rabi amplitude + operation: rabi_amplitude + parameters: + min_amp_factor: 0.1 + max_amp_factor: 1. + step_amp_factor: 0.01 + pulse_length: 40 + nshots: 3000 + relaxation_time: 50000 + + +To run properly this experiment it is important to set the +`relaxation_time` higher than the qubit `T1`. + +After running `qq auto`, the experiment is executed and the result will looks like +the following picture. + +.. image:: rabi_amplitude.png + +Regarding the time version of this experiment, this is an example + + +.. code-block:: yaml + + - id: Rabi length + operation: rabi_length + parameters: + pulse_duration_start: 16 + pulse_duration_end: 100 + pulse_duration_step: 4 + pulse_amplitude: 0.22 + nshots: 3000 + relaxation_time: 50000 + +.. image:: rabi_length.png + +For each Rabi experiment Qibocal provides the `signal` version, where just the readout signal is acquired, without +performing state discrimination :class:`qibocal.protocols.rabi.amplitude_signal.rabi_amplitude_signal`, +:class:`qibocal.protocols.rabi.length_signal.rabi_length_signal`. + +It follows an example runcard and plot for the signal exepriment + +.. code-block:: yaml + + + - id: Rabi signal + operation: rabi_amplitude_signal + parameters: + min_amp_factor: 0.2 + max_amp_factor: 1. + step_amp_factor: 0.01 + pulse_length: 40 + nshots: 3000 + relaxation_time: 50000 + +.. image:: rabi_signal.png + +Requirements +^^^^^^^^^^^^ +- :ref:`qubit-spectroscopy` +- :ref:`resonator_spectroscopy` + +Rabi ef +------- + +This experiment is used to characterized the :math:`\pi_{12}` pulse, in order to change the qubit state from :math:`\ket{1}` +to :math:`\ket{2}`. The experiment is similar to the Rabi experiment, but at the beginning the state should be prepared in the +:math:`\ket{1}` state through a :math:`\pi_{01}` pulse. + +Example +^^^^^^^ + +It follows an example of runcard and a generated report. + +.. code-block:: yaml + + - id: Rabi ef + operation: rabi_amplitude_ef + parameters: + min_amp_factor: 0.2 + max_amp_factor: 1. + step_amp_factor: 0.01 + pulse_length: 400 + nshots: 3000 + relaxation_time: 50000 + +.. image:: rabi_ef.png + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` diff --git a/doc/source/protocols/rabi/rabi_amplitude.png b/doc/source/protocols/rabi/rabi_amplitude.png new file mode 100644 index 000000000..2be84089f Binary files /dev/null and b/doc/source/protocols/rabi/rabi_amplitude.png differ diff --git a/doc/source/protocols/rabi/rabi_ef.png b/doc/source/protocols/rabi/rabi_ef.png new file mode 100644 index 000000000..6e2749d18 Binary files /dev/null and b/doc/source/protocols/rabi/rabi_ef.png differ diff --git a/doc/source/protocols/rabi/rabi_length.png b/doc/source/protocols/rabi/rabi_length.png new file mode 100644 index 000000000..7049f95a7 Binary files /dev/null and b/doc/source/protocols/rabi/rabi_length.png differ diff --git a/doc/source/protocols/rabi/rabi_signal.png b/doc/source/protocols/rabi/rabi_signal.png new file mode 100644 index 000000000..b1b9cabef Binary files /dev/null and b/doc/source/protocols/rabi/rabi_signal.png differ diff --git a/doc/source/protocols/rabi_amplitude.png b/doc/source/protocols/rabi_amplitude.png deleted file mode 100644 index 5998fed57..000000000 Binary files a/doc/source/protocols/rabi_amplitude.png and /dev/null differ diff --git a/doc/source/protocols/ramsey/ramsey.png b/doc/source/protocols/ramsey/ramsey.png new file mode 100644 index 000000000..b0b58c561 Binary files /dev/null and b/doc/source/protocols/ramsey/ramsey.png differ diff --git a/doc/source/protocols/ramsey/ramsey.rst b/doc/source/protocols/ramsey/ramsey.rst new file mode 100644 index 000000000..ed35278de --- /dev/null +++ b/doc/source/protocols/ramsey/ramsey.rst @@ -0,0 +1,105 @@ +Ramsey experiments +================== + +In this section we show how to run Ramsey experiments using Qibocal + +.. _ramsey: + +Ramsey +------ + +To measure the decoherence time of a qubit it is possible to perform a Ramsey experiment. +In this protocol two short :math:`\pi /2` are sent separated by a waiting time :math:`\tau`. +The first :math:`\pi /2` pulse will project the qubit from :math:`\ket{0}` onto the xy +plane of the Bloch sphere. During the waiting time :math:`\tau` the qubit will decohere around +the z axis, after the second :math:`\pi /2` we peform a measurement. +By changing the waiting time :math:`\tau` we should observe an exponential decay +in the probability of measuring :math:`\ket{1}` which will give us an estimate of :math:`T_2*`. +In the case where there is a difference between the qubit frequency and the frequency of +the drive pulse the final state will show a sinusoidal dependence from which we can extract +a correction on the qubit frequency :cite:p:`Baur2012RealizingQG`: + +.. math:: + + p_e = \frac{1}{2} + \frac{1}{2} e^{-\tau/T_2} \cos(\Delta \omega \pm \pi/2) + +In order to obtain the correction on the qubit frequency reliably usually the +drive pulse it is detuned on purpose to generate oscillations. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.ramsey.ramsey.RamseyParameters + + +Example +^^^^^^^ + +A possible runcard to launch a Ramsey experiment could be the following: + +.. code-block:: yaml + + - id: ramsey + operation: ramsey + parameters: + delay_between_pulses_end: 2000 + delay_between_pulses_start: 50 + delay_between_pulses_step: 50 + detuning: -1000000 + nshots: 1024 + + +The expected output is the following: + +.. image:: ramsey.png + +:math:`T_2` and :math:`\Delta \omega` are determined by fitting the output signal using +the formula presented above. + +If the protocols is successful the drive frequency will be updated. For updating :math:`T_2` +the user is invited to run ``T2 experiment``. + +Requirements +^^^^^^^^^^^^ + +- :ref:`single-shot` + +.. _ramsey_signal: + +Ramsey with raw signal +---------------------- + +A standard Ramsey experiment will try to compute the probability of the qubit +being measured in state :math:`\ket{1}`. It is possible to perform a Ramsey experiment +without performing single shot classification by running an experiment called ``ramsey_signal``. + +The acquisition and the fitting procedure are exactly the same, the only difference being +that on the y axis it will be displayed the raw measurements from the instruments. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.ramsey.ramsey_signal.RamseySignalParameters + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: ramsey with signal + operation: ramsey_signal + parameters: + delay_between_pulses_end: 25000 + delay_between_pulses_start: 50 + delay_between_pulses_step: 1000 + nshots: 1024 + + +.. image:: ramsey_signal.png + +Note that in this case error bars will not be provided. + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` diff --git a/doc/source/protocols/ramsey/ramsey_signal.png b/doc/source/protocols/ramsey/ramsey_signal.png new file mode 100644 index 000000000..99b3bcad1 Binary files /dev/null and b/doc/source/protocols/ramsey/ramsey_signal.png differ diff --git a/doc/source/protocols/references.rst b/doc/source/protocols/references.rst new file mode 100644 index 000000000..9ab98fbce --- /dev/null +++ b/doc/source/protocols/references.rst @@ -0,0 +1,9 @@ +References +========== + +In this page we collect the references used to describe the calibration +experiments. + + +.. bibliography:: + :style: plain diff --git a/doc/source/protocols/resonator_punchout.rst b/doc/source/protocols/resonator_punchout.rst index 3cf23f562..f910667e3 100644 --- a/doc/source/protocols/resonator_punchout.rst +++ b/doc/source/protocols/resonator_punchout.rst @@ -1,3 +1,5 @@ +.. _resonator_punchout: + Resonator punchout ================== @@ -15,15 +17,18 @@ particular we expect it to be fixed at first (in the high power regime) then und transition phase and then be fixed again at a different frequency because of the coupling with the qubit. -This is and example of a runcard for a resonator punchout: +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.resonator_punchout.ResonatorPunchoutParameters + :noindex: -.. code-block:: yaml - platform: - qubits: [0] +Example +^^^^^^^ - actions: +.. code-block:: yaml - id: resonator punchout @@ -103,17 +108,16 @@ state has changed). It is also possible to run the punchout experiment with attenuation: -.. image:: resonator_punchout_attenuation.png +Parameters +^^^^^^^^^^ -This is and example of a runcard for a resonator punchout with attenuation: +.. autoclass:: qibocal.protocols.resonator_punchout_attenuation.ResonatorPunchoutAttenuationParameters + :noindex: -.. code-block:: yaml +Example +^^^^^^^ - platform: - - qubits: [0] - - actions: +.. code-block:: yaml - id: resonator_punchout_attenuation @@ -127,8 +131,10 @@ This is and example of a runcard for a resonator punchout with attenuation: step_att: 4 nshots: 2048 -.. rubric:: References +.. image:: resonator_punchout_attenuation.png + +Requirements +^^^^^^^^^^^^ -.. bibliography:: - :cited: - :style: plain +- :ref:`Time Of Flight` +- :ref:`resonator_spectroscopy` (high power) diff --git a/doc/source/protocols/resonator_spectroscopy.rst b/doc/source/protocols/resonator_spectroscopy.rst index de545791f..798b84275 100644 --- a/doc/source/protocols/resonator_spectroscopy.rst +++ b/doc/source/protocols/resonator_spectroscopy.rst @@ -1,3 +1,5 @@ +.. _resonator_spectroscopy: + Resonator spectroscopy ====================== @@ -25,13 +27,17 @@ elements to take into consideration: The bare resonator frequency can be found setting a large value for the amplitude, e.g.: -.. code-block:: yaml +Parameters +^^^^^^^^^^ - platform: +.. autoclass:: qibocal.protocols.resonator_spectroscopy.ResonatorSpectroscopyParameters + :noindex: - targets: [0] - actions: +Example +^^^^^^^ + +.. code-block:: yaml - id: resonator_spectroscopy high power @@ -59,13 +65,10 @@ The bare resonator frequency can be found setting a large value for the amplitud Lowering the amplitude we can see a shift in the peak, e.g.: -.. code-block:: yaml - - platform: +Example +^^^^^^^ - targets: [0] - - actions: +.. code-block:: yaml - id: resonator_spectroscopy low power @@ -143,8 +146,7 @@ and also here: bare_resonator_frequency: readout_frequency: -.. rubric:: References +Requirements +^^^^^^^^^^^^ -.. bibliography:: - :filter: docname in docnames - :style: plain +- :ref:`Time Of Flight` diff --git a/doc/source/protocols/signal/calibrate_kernel.rst b/doc/source/protocols/signal/calibrate_kernel.rst new file mode 100644 index 000000000..a77d03edf --- /dev/null +++ b/doc/source/protocols/signal/calibrate_kernel.rst @@ -0,0 +1,38 @@ +Calibrate Discrimination Kernels +================================ + +This experiment is quite similar to the :ref:`Time Of Flight` experiment but has a different objective. + +In the time-of-flight experiment, we were only interested in the timing of the pulse, regardless of the current qubit state. Here, on the other hand, we want to build a "vector of weights," with a value for each point in the measurement, to maximize the differences between :math:`\ket{0}` and :math:`\ket{1}`. Points that are further away, considering the two states, are given a higher weight since they are "more interesting" for discrimination purposes. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.signal_experiments.calibrate_state_discrimination.CalibrateStateDiscriminationParameters + :noindex: + + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: calibrate kernels # custom ID of the experiment + operation: calibrate_state_discrimination # unique name of the routine + parameters: + nshots: 1024 + relaxation_time: 20_000 + +.. image:: kernel.png + +The fit procedure (:func:`qibocal.protocols.signal_experiments.calibrate_state_discrimination._fit`) uses the numpy conjugate function, as it takes the conjugate of the differences of the two RAW traces acquired (one for the ground state and one for the excited state) as the kernel, after normalization. + +The kernel is also updated in the platform runcard after successful fitting. + +Requirements +^^^^^^^^^^^^ + +This experiment requires the calibration of a pi-pulse, since in the pulse sequence, we need to use the X gate. +Therefore, before this experiment, we need to run at least a: + +- :ref:`rabi` diff --git a/doc/source/protocols/signal/kernel.png b/doc/source/protocols/signal/kernel.png new file mode 100644 index 000000000..2e7e99ade Binary files /dev/null and b/doc/source/protocols/signal/kernel.png differ diff --git a/doc/source/protocols/signal/time_of_flight.png b/doc/source/protocols/signal/time_of_flight.png new file mode 100644 index 000000000..225a919c0 Binary files /dev/null and b/doc/source/protocols/signal/time_of_flight.png differ diff --git a/doc/source/protocols/signal/time_of_flight.rst b/doc/source/protocols/signal/time_of_flight.rst new file mode 100644 index 000000000..0d2561b60 --- /dev/null +++ b/doc/source/protocols/signal/time_of_flight.rst @@ -0,0 +1,67 @@ +.. _Time Of Flight: + +Time Of Flight (Readout) +======================== + +In this section, we present the time-of-flight experiment for qibocal (see Fig.12 :cite:p:`gao2021practical`). + +In the `time of flight` experiment, we measure the time it takes for a readout pulse to travel to the qubit and back, being acquired by the control instrument ADCs. + +Carefully calibrating this delay time is important to optimize the readout. In particular, it is useful to acquire just for the duration of the readout pulse, where differences between the two states really appear (both in amplitude and phase). + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.signal_experiments.time_of_flight_readout.TimeOfFlightReadoutParameters + :noindex: + + +How to execute the experiment +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: yaml + + - id: time of flight experiment # custom ID of the experiment + operation: time_of_flight_readout # unique name of the routine + parameters: + readout_amplitude: 1 # usually high + window_size: 10 + nshots: 1024 + relaxation_time: 20_000 + +Although it is possible to avoid setting a specific readout amplitude, it is generally useful to set a high value here. Indeed, we are not looking for the optimal amplitude but we want to have a signal with enough power so that it is clear when it starts. + +Acquisition +^^^^^^^^^^^ + +.. testcode:: + :hide: + + from qibolab.execution_parameters import AcquisitionType + +It is important to note that this experiment makes use of the RAW acquisition mode (see `Qibolab documentation `_), which may require some specific care depending on the instrument employed (for some devices demodulation could be used, or this mode could be available for just a single qubit at a time). + +For a 3D cavity we expect a plot (considering demodulation) as the following: + +.. image:: time_of_flight.png + +In this image, for example, we can see that the fit procedure did not find the correct pulse starting point (that is around 200). This could be improved increasing the window size. + +For a 2D resonator, some more oscillation could appear: + +.. image:: time_of_flight_2d.png + +Just as an example, we provide here also a plot for a 2D resonator case, where the demodulation is not carried out. +As we can see the plot is very different, but the starting point of the signal is still clearly visible. + +.. image:: time_of_flight_2d_nodem.png + +Fit +^^^ + +The fit procedure (:func:`qibocal.protocols.signal_experiments.time_of_flight_readout._fit`) employs a moving average, returning the time when it is maximum, namely when the signal starts being acquired. + +Requirements +^^^^^^^^^^^^ + +Before this experiment, nothing in particular is required. This can indeed be done as a first test of the connections. diff --git a/doc/source/protocols/signal/time_of_flight_2d.png b/doc/source/protocols/signal/time_of_flight_2d.png new file mode 100644 index 000000000..19495b6b3 Binary files /dev/null and b/doc/source/protocols/signal/time_of_flight_2d.png differ diff --git a/doc/source/protocols/signal/time_of_flight_2d_nodem.png b/doc/source/protocols/signal/time_of_flight_2d_nodem.png new file mode 100644 index 000000000..a6c327e4e Binary files /dev/null and b/doc/source/protocols/signal/time_of_flight_2d_nodem.png differ diff --git a/doc/source/protocols/singleshot.png b/doc/source/protocols/singleshot.png new file mode 100644 index 000000000..5c485e871 Binary files /dev/null and b/doc/source/protocols/singleshot.png differ diff --git a/doc/source/protocols/singleshot.rst b/doc/source/protocols/singleshot.rst new file mode 100644 index 000000000..1d58130e4 --- /dev/null +++ b/doc/source/protocols/singleshot.rst @@ -0,0 +1,64 @@ +.. _single-shot: + +Single Shot Experiments +======================= + +In this section we describe the single single shot exepriments for qubit and qutrits. + +Qubit Single Shot +----------------- + +Acquisition +^^^^^^^^^^^ + +In this experiment, the qubit is preapared multiple times in state :math:`\ket{0}` and :math:`\ket{1}`, +for each shot the `I` and `Q` values are acquired. According to the theory, if we take into account +the noise, for each state we should observe a Gaussian blob in the `IQ-plane`:cite:`Krantz_2019`. + +Fit +^^^ +This method evaluates the axis which passes through the centroids of the two clusters in +the training set, and determines the optimal threshold that maximizes the difference between +the cumulative distributions of the projections along the axis. Predicting the state of a new +point involves determining its relative position to the threshold based on its projection along +the axis. Due to its small complexity, it has high interpretability, but it does not evaluate the +probabilities. + +This line is defined in terms of the `angle` :math:`\theta` and `threshold` coordinates. The first one is the angle in radiants formed by the line +connecting the centers of the blobs and the Q-axis. After performing the rotation with angle :math:`-\theta` and translating such that the coordinate +center coincides with the ground state Gaussian center, the `threshold` is the distance from the center along x-axis that maximize the fidelity :cite:`gao2021practical`. + +.. math:: + + \mathcal{F} = 1 - \frac{1}{2} (P(0,1) + P(1,0)) + +where :math:`P(i,j)` is the probability of measuring the qubit in state `i` but prepeared in state `j`. +With this routine is possible to train different classifiers, plot their ROC curves and evaluating the Area Under the Curves :cite:`pedicillo2023`. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.classification.SingleShotClassificationParameters + :noindex: + +Example +^^^^^^^ + +A possible choice of parameters is the following + +.. code-block:: yaml + + - id: single shot classification + operation: single_shot_classification + parameters: + nshots: 5000 + classifiers_list: ["qubit_fit", "naive_bayes"] + +the result should looks like this + +.. image:: singleshot.png + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` diff --git a/doc/source/protocols/t1/t1.rst b/doc/source/protocols/t1/t1.rst new file mode 100644 index 000000000..8b973a769 --- /dev/null +++ b/doc/source/protocols/t1/t1.rst @@ -0,0 +1,132 @@ +T1 experiments +============== + +In this section we show how to run T1 experiments. + +T1 +-- + +Due to coupling to the environment the qubit in state :math:`\ket{1}` +will decay to the state :math:`\ket{0}`. To measure such decay we can perform +a simple experiment by initializing the qubit in :math:`\ket{1}` through a +:math:`\pi`-pulse previously calibrated, we then measure the population of +the excited state for different waiting times :math:`\Delta \tau`. +We expect to measure an exponential decay which is fitted with the following formula: + + + + +.. math:: + + p_e(t) = A + B e^{ - t / T_1} + +:math:`A` and :math:`B` are introduced to improve the performance of the fit. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.coherence.t1.T1Parameters + :noindex: + + +Example +^^^^^^^ + +A possible runcard to launch a T1 experiment could be the following: + +.. code-block:: yaml + + - id: t1 + operation: t1 + parameters: + delay_before_readout_end: 10000 + delay_before_readout_start: 4 + delay_before_readout_step: 100 + nshots: 1000 + + +The expected output is the following: + +.. image:: t1_prob.png + +:math:`T_1` is determined by fitting the output signal using +the formula presented above. + +Requirements +^^^^^^^^^^^^ + +- :ref:`single-shot` + +T1 with raw signal +------------------ + +A standard :math:`T_1` experiment will try to compute the probability of the qubit +being measured in state :math:`\ket{1}`. It is possible to perform a :math:`T_1` experiment +without performing single shot calibration by running an experiment called ``t1_signal``. + +The acquisition and the fitting procedure are exactly the same, the only difference being +that on the y axis it will be displayed the raw measurements from the instruments. + + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.coherence.t1_signal.T1SignalParameters + :noindex: + + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: T1 with signal + operation: t1_signal + parameters: + delay_before_readout_end: 100008 + delay_before_readout_start: 16 + delay_before_readout_step: 1000 + nshots: 2048 + + +.. image:: t1_signal.png + +Note that in this case error bands will not be provided. + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` + +T1 with for loops +----------------- + +If the instrument driver is not able to perform duration sweepers in real time, we provide +a protocol where the different waiting time are swept through a python for loop. Such +execution will be usually slower compared to the one where sweepers are supported but it +could be useful for debugging purposes. + + +Here is a possible runcard: + +.. code-block:: yaml + + - id: T1 with for loops + operation: t1_sequences + parameters: + delay_before_readout_end: 100008 + delay_before_readout_start: 16 + delay_before_readout_step: 1000 + nshots: 2048 + + +.. note:: + + For ``t1_sequences`` on the y-axis it will be shown the raw output from instruments, + not the population of :math:`\ket{1}`. + + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` diff --git a/doc/source/protocols/t1/t1_prob.png b/doc/source/protocols/t1/t1_prob.png new file mode 100644 index 000000000..e67fd0a3d Binary files /dev/null and b/doc/source/protocols/t1/t1_prob.png differ diff --git a/doc/source/protocols/t1/t1_signal.png b/doc/source/protocols/t1/t1_signal.png new file mode 100644 index 000000000..177ee6394 Binary files /dev/null and b/doc/source/protocols/t1/t1_signal.png differ diff --git a/doc/source/protocols/t2/t2.png b/doc/source/protocols/t2/t2.png new file mode 100644 index 000000000..572062262 Binary files /dev/null and b/doc/source/protocols/t2/t2.png differ diff --git a/doc/source/protocols/t2/t2.rst b/doc/source/protocols/t2/t2.rst new file mode 100644 index 000000000..92da06b35 --- /dev/null +++ b/doc/source/protocols/t2/t2.rst @@ -0,0 +1,122 @@ +T2 experiments +============== + +In this section we show how to run T2 experiments using Qibocal + +T2 +-- + +The acquisition for the :math:`T_2` experiment is the same one as for the ``Ramsey`` experiment, +the only difference is that in this experiment the drive pulse is not detuned. This protocol +is assuming that any error on the drive frequency has been already corrected through a ``Ramsey`` experiment. +For this reason we expect to see just an exponential behavior: + +.. math:: + + p_e(t) = A + B e^{ - t / T_2} + +The reason why there are two distinct experiment is that in order to correct the drive frequency +if the pulse is detuned enough we can proceed with short scans, while to extract reliably :math:`T_2` +it will be necessary to perform longer scans. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.coherence.t2.T2Parameters + :noindex: + + +Example +^^^^^^^ + +A possible runcard to launch a :math:`T_2` experiment could be the following: + +.. code-block:: yaml + + - id: T2 + operation: t2 + parameters: + delay_between_pulses_end: 100000 + delay_between_pulses_start: 4 + delay_between_pulses_step: 1000 + nshots: 1000 + +The expected output is the following: + +.. image:: t2.png + +:math:`T_2` is determined by fitting the output signal using +the formula presented above. + +Requirements +^^^^^^^^^^^^ + +- :ref:`single-shot` + + +T2 with raw signal +------------------ + +A standard :math:`T_2` will try to compute the probability of the qubit +being measured in state :math:`\ket{1}`. It is possible to perform a :math:`T_2` experiment +without performing single shot calibration by running an experiment called ``t2_signal``. + +The acquisition and the fitting procedure are exactly the same, the only difference being +that on the y axis it will be displayed the raw measurements from the instruments. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.coherence.t2_signal.T2SignalParameters + :noindex: + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: T2 with signal + operation: t2_signal + parameters: + delay_between_pulses_end: 200000 + delay_between_pulses_start: 4 + delay_between_pulses_step: 4000 + nshots: 5000 + relaxation_time: 300000 + + +.. image:: t2_signal.png + +Note that in this case error bars will not be provided. + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` + +T2 with for loops +----------------- + +If the instrument driver is not able to perform duration sweepers in real time, we provide +a protocol where the different waiting time are swept through a python for loop. Such +execution will be usually slower compared to the one where sweepers are supported but it +could be useful for debugging purposes. + +Here is a possible runcard: + +.. code-block:: yaml + + - id: T2 with for loops + operation: t2_sequences + parameters: + delay_between_pulses_end: 200000 + delay_between_pulses_start: 4 + delay_between_pulses_step: 4000 + nshots: 5000 + relaxation_time: 300000 + + +.. note:: + + For ``t2_sequences`` on the y-axis it will be shown the raw output from instruments, + not the population of :math:`\ket{1}`. diff --git a/doc/source/protocols/t2/t2_signal.png b/doc/source/protocols/t2/t2_signal.png new file mode 100644 index 000000000..314ce882d Binary files /dev/null and b/doc/source/protocols/t2/t2_signal.png differ diff --git a/doc/source/protocols/t2_echo/t2_echo.png b/doc/source/protocols/t2_echo/t2_echo.png new file mode 100644 index 000000000..7dfaa0144 Binary files /dev/null and b/doc/source/protocols/t2_echo/t2_echo.png differ diff --git a/doc/source/protocols/t2_echo/t2_echo.rst b/doc/source/protocols/t2_echo/t2_echo.rst new file mode 100644 index 000000000..016481e02 --- /dev/null +++ b/doc/source/protocols/t2_echo/t2_echo.rst @@ -0,0 +1,99 @@ +Hahn echo experiments +===================== + +In this section we show how to run Hahn echo experiments using Qibocal + +Spin-echo +--------- + +The acquisition for the :math:`T_2^{\text{Echo}}` experiment is similar to a ``Ramsey`` experiment, +with the difference that between the two :math:`\pi / 2` pulses we apply a :math:`\pi` pulse. +Such :math:`\pi` pulse is applied exactly at :math:`\tau / 2` where :math:`\tau` is the +waiting time between the two :math:`\pi / 2` pulses. + +By applying this extra pulse we can mitigate the qubit dephasing :cite:p:`Krantz_2019, Chen2018MetrologyOQ` since any phase accumulated in +first half of the sequence will be reversed in the second half. This is also why usually :math:`T_2^{\text{Echo}} \ge T_2`. + +The fit is again a dumped exponential of the following form: + +.. math:: + + p_e(t) = A + B e^{ - t / T_2^{\text{Echo}}} + +The reason why there are two distinct experiment is that in order to correct the drive frequency +if the pulse is detuned enough we can proceed with short scans, while to extract reliably :math:`T_2` +it will be necessary to perform longer scans. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.coherence.spin_echo.SpinEchoParameters + :noindex: + +Example +^^^^^^^ + +A possible runcard to launch a :math:`T_2^{\text{Echo}}` experiment could be the following: + +.. code-block:: yaml + + - id: T2 echo + operation: spin_echo + parameters: + delay_between_pulses_end: 100000 + delay_between_pulses_start: 4 + delay_between_pulses_step: 1000 + nshots: 1000 + +The expected output is the following: + +.. image:: t2_echo.png + +:math:`T_2^{\text{Echo}}` is determined by fitting the output signal using +the formula presented above. + +Requirements +^^^^^^^^^^^^ + +- :ref:`single-shot` + + +Spin-echo with raw signal +------------------------- + +A standard :math:`T_2^{\text{Echo}}` will try to compute the probability of the qubit +being measured in state :math:`\ket{1}`. It is possible to perform a :math:`T_2^{\text{Echo}}` experiment +without performing single shot calibration by running an experiment called ``spin_echo_signal``. + +The acquisition and the fitting procedure are exactly the same, the only difference being +that on the y axis it will be displayed the raw measurements from the instruments. + +Parameters +^^^^^^^^^^ + +.. autoclass:: qibocal.protocols.coherence.spin_echo_signal.SpinEchoSignalParameters + :noindex: + +Example +^^^^^^^ + +.. code-block:: yaml + + - id: Spin Echo with signal + operation: spin_echo_signal + parameters: + delay_between_pulses_end: 200000 + delay_between_pulses_start: 4 + delay_between_pulses_step: 4000 + nshots: 5000 + relaxation_time: 300000 + + +.. image:: t2_echo_signal.png + +Note that in this case error bars will not be provided. + +Requirements +^^^^^^^^^^^^ + +- :ref:`rabi` diff --git a/doc/source/protocols/t2_echo/t2_echo_signal.png b/doc/source/protocols/t2_echo/t2_echo_signal.png new file mode 100644 index 000000000..5266ed711 Binary files /dev/null and b/doc/source/protocols/t2_echo/t2_echo_signal.png differ diff --git a/doc/source/refs.bib b/doc/source/refs.bib index 6f3fa52b3..3f0207b3d 100644 --- a/doc/source/refs.bib +++ b/doc/source/refs.bib @@ -64,3 +64,53 @@ @article{Krantz_2019 author={Krantz, P. and Kjaergaard, M. and Yan, F. and Orlando, T. P. and Gustavsson, S. and Oliver, W. D.}, year={2019}, month=jun } + +@misc{Baur2012RealizingQG, + title={Realizing quantum gates and algorithms with three superconducting qubits}, + author={Matthias Baur}, + year={2012}, + url={https://api.semanticscholar.org/CorpusID:59065808} +} + +@article{Koch_2007, + title={Charge-insensitive qubit design derived from the Cooper pair box}, + volume={76}, + ISSN={1094-1622}, + url={http://dx.doi.org/10.1103/PhysRevA.76.042319}, + DOI={10.1103/physreva.76.042319}, + number={4}, + journal={Physical Review A}, + publisher={American Physical Society (APS)}, + author={Koch, Jens and Yu, Terri M. and Gambetta, Jay and Houck, A. A. and Schuster, D. I. and Majer, J. and Blais, Alexandre and Devoret, M. H. and Girvin, S. M. and Schoelkopf, R. J.}, + year={2007}, + month=oct } + +@misc{Chen2018MetrologyOQ, + title={Metrology of Quantum Control and Measurement in Superconducting Qubits}, + author={Zijun Chen}, + year={2018}, + url={https://api.semanticscholar.org/CorpusID:196194358} +} + + +@article{Barrett_2023, + title={Learning-Based Calibration of Flux Crosstalk in Transmon Qubit Arrays}, + volume={20}, + ISSN={2331-7019}, + url={http://dx.doi.org/10.1103/PhysRevApplied.20.024070}, + DOI={10.1103/physrevapplied.20.024070}, + number={2}, + journal={Physical Review Applied}, + publisher={American Physical Society (APS)}, + author={Barrett, Cora N. and Karamlou, Amir H. and Muschinske, Sarah E. and Rosen, Ilan T. and Braumüller, Jochen and Das, Rabindra and Kim, David K. and Niedzielski, Bethany M. and Schuldt, Meghan and Serniak, Kyle and Schwartz, Mollie E. and Yoder, Jonilyn L. and Orlando, Terry P. and Gustavsson, Simon and Grover, Jeffrey A. and Oliver, William D.}, + year={2023}, + month=aug } + +@misc{pedicillo2023, + title={Benchmarking machine learning models for quantum state classification}, + author={Edoardo Pedicillo and Andrea Pasquale and Stefano Carrazza}, + year={2023}, + eprint={2309.07679}, + archivePrefix={arXiv}, + primaryClass={id='quant-ph' full_name='Quantum Physics' is_active=True alt_name=None in_archive='quant-ph' is_general=False description=None} +} diff --git a/doc/source/tutorials/basic.rst b/doc/source/tutorials/basic.rst index 50ef182ba..5f6d76784 100644 --- a/doc/source/tutorials/basic.rst +++ b/doc/source/tutorials/basic.rst @@ -356,9 +356,3 @@ randomized benchmarking. nshots: 128 .. image:: ../protocols/rb.png - -.. rubric:: References - -.. bibliography:: - :filter: docname in docnames - :style: plain diff --git a/pyproject.toml b/pyproject.toml index 27f7100d5..7aa11e208 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "qibocal" version = "0.0.10" description = "Qibo's quantum calibration, characterization and validation module." -authors = ["andrea-pasquale "] +authors = ["The Qibo team"] license = "Apache License 2.0" readme = "README.md" homepage = "https://qibo.science/" diff --git a/src/qibocal/protocols/classification.py b/src/qibocal/protocols/classification.py index 53f32238d..5f580ed3a 100644 --- a/src/qibocal/protocols/classification.py +++ b/src/qibocal/protocols/classification.py @@ -152,12 +152,12 @@ def _acquisition( Example: .. code-block:: yaml - - id: single_shot_classification_1 - operation: single_shot_classification - parameters: - nshots: 5000 - savedir: "single_shot" - classifiers_list: ["qubit_fit","naive_bayes", "linear_svm"] + - id: single_shot_classification_1 + operation: single_shot_classification + parameters: + nshots: 5000 + savedir: "single_shot" + classifiers_list: ["qubit_fit","naive_bayes", "linear_svm"] """ diff --git a/src/qibocal/protocols/coherence/t2.py b/src/qibocal/protocols/coherence/t2.py index 6ddbe4a43..0b2be1f16 100644 --- a/src/qibocal/protocols/coherence/t2.py +++ b/src/qibocal/protocols/coherence/t2.py @@ -105,9 +105,10 @@ def _acquisition( def _fit(data: T2Data) -> T2Results: - r""" - Fitting routine for Ramsey experiment. The used model is + """The used model is + .. math:: + y = p_0 - p_1 e^{-x p_2}. """ t2s, fitted_parameters, pcovs, chi2 = utils.exponential_fit_probability(data) diff --git a/src/qibocal/protocols/coherence/t2_signal.py b/src/qibocal/protocols/coherence/t2_signal.py index 7b44b8f90..d832a971c 100644 --- a/src/qibocal/protocols/coherence/t2_signal.py +++ b/src/qibocal/protocols/coherence/t2_signal.py @@ -120,9 +120,10 @@ def _acquisition( def _fit(data: T2SignalData) -> T2SignalResults: - r""" - Fitting routine for Ramsey experiment. The used model is + """The used model is + .. math:: + y = p_0 - p_1 e^{-x p_2}. """ data = data.average diff --git a/src/qibocal/protocols/qubit_spectroscopy_ef.py b/src/qibocal/protocols/qubit_spectroscopy_ef.py index bda42c901..4817bb949 100644 --- a/src/qibocal/protocols/qubit_spectroscopy_ef.py +++ b/src/qibocal/protocols/qubit_spectroscopy_ef.py @@ -41,7 +41,7 @@ class QubitSpectroscopyEFData(QubitSpectroscopyData): drive_frequencies: dict[QubitId, float] = field(default_factory=dict) -def _fit_ef(data: QubitSpectroscopyEFData) -> QubitSpectroscopyEFResults: +def fit_ef(data: QubitSpectroscopyEFData) -> QubitSpectroscopyEFResults: results = _fit(data) anharmoncities = { qubit: results.frequency[qubit] - data.drive_frequencies[qubit] @@ -200,5 +200,5 @@ def _update(results: QubitSpectroscopyEFResults, platform: Platform, target: Qub update.anharmonicity(results.anharmonicity[target], platform, target) -qubit_spectroscopy_ef = Routine(_acquisition, _fit_ef, _plot, _update) +qubit_spectroscopy_ef = Routine(_acquisition, fit_ef, _plot, _update) """QubitSpectroscopyEF Routine object.""" diff --git a/src/qibocal/protocols/ramsey/ramsey.py b/src/qibocal/protocols/ramsey/ramsey.py index 734b11b09..99e37014d 100644 --- a/src/qibocal/protocols/ramsey/ramsey.py +++ b/src/qibocal/protocols/ramsey/ramsey.py @@ -172,9 +172,9 @@ def _acquisition( def _fit(data: RamseyData) -> RamseyResults: - r""" - Fitting routine for Ramsey experiment. The used model is + r"""Fitting routine for Ramsey experiment. The used model is .. math:: + y = p_0 + p_1 sin \Big(p_2 x + p_3 \Big) e^{-x p_4}. """ qubits = data.qubits diff --git a/src/qibocal/protocols/ramsey/ramsey_signal.py b/src/qibocal/protocols/ramsey/ramsey_signal.py index a1bfb0c2f..a9ce335ca 100644 --- a/src/qibocal/protocols/ramsey/ramsey_signal.py +++ b/src/qibocal/protocols/ramsey/ramsey_signal.py @@ -176,9 +176,9 @@ def _acquisition( def _fit(data: RamseySignalData) -> RamseySignalResults: - r""" - Fitting routine for Ramsey experiment. The used model is + r"""Fitting routine for Ramsey experiment. The used model is .. math:: + y = p_0 + p_1 sin \Big(p_2 x + p_3 \Big) e^{-x p_4}. """ qubits = data.qubits