Skip to content

Commit

Permalink
Merge pull request #983 from qiboteam/protocol_docs
Browse files Browse the repository at this point in the history
Protocol docs
  • Loading branch information
scarrazza committed Sep 27, 2024
2 parents 7d6024c + 22eddc5 commit c811d5c
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 0 deletions.
Binary file added doc/source/protocols/avoided_crossing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions doc/source/protocols/avoided_crossing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Avoided crossing
================

In the avoided crossing experiment the goal is to study the qubit-flux dependency
of a couple of qubits to precisely tune the interaction between them at specific
frequencies in order to calibrate the CZ and the iSWAP gates.

In the avoided crossing experiment for CZ qubit gates, the interaction between
two qubits is controlled by tuning their energy levels such that the :math:`\ket{11}`
(both qubits in the excited state) and :math:`\ket{02}` (one qubit in the ground state and
the other in the second excited state) states come into resonance.
At this resonance point, the energy levels of these states experience an avoided
crossing, a key phenomenon that enables the controlled-Z (CZ) gate operation.
By observing the avoided crossing, one can confirm that the coupling between the
qubits is strong enough to facilitate the necessary interaction for the CZ gate.
Hence, precise tuning of these states is essential for achieving the correct gate
operation.

In the avoided crossing experiment for iSWAP qubit gates, the key focus is on
the interaction between the :math:`\ket{10}` and :math:`\ket{01}` states.
When tuning the qubits' energy levels, these two states come into resonance,
creating an avoided crossing, which is the fundamental operation of
the iSWAP gate.

In this protocol, for each qubit pair we execute a qubit flux dependency of the
01 and 02 transitions on the qubit with higher frequency and we fit the data to
find the flux-frequency relationship that we use to estimate the bias needed to
reach the CZ and iSWAP interaction points.

Parameters
^^^^^^^^^^

.. autoclass::
qibocal.protocols.flux_dependence.avoided_crossing.AvoidedCrossingParameters
:noindex:

Example
^^^^^^^

It follows a runcard example of this experiment.

.. code-block:: yaml
- id: avoided crossing
operation: avoided_crossing
parameters:
bias_step: 0.01
bias_width: 0.2
drive_amplitude: 0.5
freq_step: 500000
freq_width: 100000000
The expected output is the following:

.. image:: avoided_crossing.png
4 changes: 4 additions & 0 deletions doc/source/protocols/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ In this section we introduce the basics of all protocols supported by ``qibocal`
dispersive_shift
allxy
flipping
readout_mitigation_matrix
avoided_crossing
readout_optimization
standard_rb
references
Binary file added doc/source/protocols/readout_amplitude.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions doc/source/protocols/readout_mitigation_matrix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Readout mitigation matrix
=========================

The idea behind this protocol is that we can correct the qubit readout errors
by applying a corrective linear transformation to the readout results, in formula

.. math::
O_{noisy} = M O_{ideal},
where :math:`O_{noisy}` is the readout probabilities on the noisy device,
:math:`O_{ideal}` is the expected one and :math:`M` is the readout mitigation matrix.
The matrix :math:`M^{-1}` can be used to correct the noisy readouts.

This protocol evaluates the readout matrix by preparing the qubit(s) in the
computational base and measuring their states.

Pramateters
^^^^^^^^^^^

.. autoclass:: qibocal.protocols.readout_mitigation_matrix.ReadoutMitigationMatrixParameters
:noindex:

Example
^^^^^^^

.. code-block:: yaml
- id: readout_mitigation_matrix
operation: readout_mitigation_matrix
parameters:
nshots: 1000
pulses: true
After the protocol execution, the result is the following

.. image:: readout_mitigation_matrix.png
32 changes: 32 additions & 0 deletions doc/source/protocols/readout_optimization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Readout optimization
====================

Qibocal provides a protocol to improve the readout pulse amplitude by optimize
the assignment fidelity.

Parameters
^^^^^^^^^^

.. autoclass:: qibocal.protocols.readout_optimization.resonator_amplitude.ResonatorAmplitudeParameters
:noindex:


Example
^^^^^^^

It follows an example runcard of the resonator amplitude routine with the plot
generated in the report.

.. code-block:: yaml
- id: resonator_amplitude
operation: resonator_amplitude
parameters:
amplitude_step: 0.0005
amplitude_start: 0.001
amplitude_stop: 0.005
As shown in the picture below, the protocol sweeps the readout amplitude and evaluates
the probability errors

.. image:: readout_amplitude.png
Binary file added doc/source/protocols/standard_rb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions doc/source/protocols/standard_rb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Standard Randomize Benchmarking
===============================

An approach to obtain the average gate fidelity is to perform randomized
benchmarking :cite:p:`Emerson_2005`.
The key idea is that if we average the error process over the uniform space of
unitaries the result is a depolarizing channel that maps any pure state to the
maximally mixed state.
Such uniform space of unitaries is known as *Haar measure*.
It can be shown :cite:p:`Emerson_2005` that the average induced error is proportional
to the depolarization probability.
However, this approach is inefficient because we sample randomly from the Haar measure.
A simplification was proposed in :cite:p:`Knill2008` by restricting the unitaries
to the Clifford group, which consists of unitary rotations mapping the group
of Pauli operators in itself.
Among the advantages of such group are the fact of the number of Clifford
gates is finite given the Hilbert space and being a group we can easily found
the inverse within the group.
The generic procedure to perform a randomized benchmarking is the following:

1. initialize the system in ground state
2. for each sequence length :math:`m` draw sequence of Clifford group elements
3. calculate inverse gate
4. measure sequence and inverse gate
5. repeat the process for multiple sequence of same length and varying the length

The previous approach works because it has been shown :cite:p:`Nielsen_2002` that
randomization with Clifford gates provides again a depolarized noise channel

.. math::
:name: eq:1
\rho \rightarrow \frac{d}{2} I + ( 1 - d) \rho
with depolarization probability :math:`d`.
If we follow the previous procedure and we measure the survival probability, i.e.
the probability of measuring the qubit in :math:`\ket{0}`, for
different sequence length :math:`m` we expect the following behavior

.. math::
:name: eq:2
F(m) = A p^m + B
where :math:`1-p` is the rate of depolarization while :math:`A` and :math:`B`
capture state preparation and measurement errors.
Finally, we can extract the average error per Clifford as

.. math::
:name: eq:3
\epsilon_\text{Clifford} = \frac{1 - p}{1 - 2^{-n}}
where :math:`n` is the number of qubits. The error per gate can be derived by dividing
the Clifford error by the physical gates per Clifford which usually is 1.875.
One of the main feature of RB is the possibility to estimate the gate fidelity
alone without taking into account both state preparation and measurement errors
which can be computed using the :math:`A` and :math:`B` terms in :ref:`Eq. 2 <eq:2>`.

Parameters
^^^^^^^^^^


.. autoclass::
qibocal.protocols.randomized_benchmarking.standard_rb.StandardRBParameters
:noindex:


Example
^^^^^^^

It follows a runcard where we execute a standard RB.

.. code-block:: yaml
- id: standard rb
operation: standard_rb
parameters:
depths: [1,5,10,20,50,100]
niter: 20
nshots: 100
The expected output is the following:

.. image:: standard_rb.png
40 changes: 40 additions & 0 deletions doc/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,43 @@ @misc{pedicillo2023
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}
}

@article{Knill2008,
title={Randomized benchmarking of quantum gates},
volume={77},
ISSN={1094-1622},
url={http://dx.doi.org/10.1103/PhysRevA.77.012307},
DOI={10.1103/physreva.77.012307},
number={1},
journal={Physical Review A},
publisher={American Physical Society (APS)},
author={Knill, E. and Leibfried, D. and Reichle, R. and Britton, J. and Blakestad, R. B. and Jost, J. D. and Langer, C. and Ozeri, R. and Seidelin, S. and Wineland, D. J.},
year={2008},
month={jan},
}

@article{Emerson_2005,
title={Scalable noise estimation with random unitary operators},
volume={7},
ISSN={1741-3575},
url={http://dx.doi.org/10.1088/1464-4266/7/10/021},
DOI={10.1088/1464-4266/7/10/021},
number={10},
journal={Journal of Optics B: Quantum and Semiclassical Optics},
publisher={IOP Publishing},
author={Emerson, Joseph and Alicki, Robert and Życzkowski, Karol},
year={2005},
month=sep, pages={S347–S352} }

@article{Nielsen_2002,
title={A simple formula for the average gate fidelity of a quantum dynamical operation},
volume={303},
ISSN={0375-9601},
url={http://dx.doi.org/10.1016/S0375-9601(02)01272-0},
DOI={10.1016/s0375-9601(02)01272-0},
number={4},
journal={Physics Letters A},
publisher={Elsevier BV},
author={Nielsen, Michael A},
year={2002},
month=oct, pages={249–252} }

0 comments on commit c811d5c

Please sign in to comment.