From 5c6770b06e1088ff7355ece41323d8c195ea6096 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Fri, 10 Dec 2021 12:58:02 +0100 Subject: [PATCH 1/2] * Reno and small doc fixes. --- .../library/characterization/fine_drag.py | 20 ++-- .../library/characterization/ramsey_xy.py | 4 +- .../notes/calibrations-97c6ae807d54015d.yaml | 92 +++++++++++++++++++ 3 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/calibrations-97c6ae807d54015d.yaml diff --git a/qiskit_experiments/library/characterization/fine_drag.py b/qiskit_experiments/library/characterization/fine_drag.py index 97da5d9d8c..fa95a4ca41 100644 --- a/qiskit_experiments/library/characterization/fine_drag.py +++ b/qiskit_experiments/library/characterization/fine_drag.py @@ -10,7 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -"""Fine DRAG calibration experiment.""" +"""Fine DRAG characterization experiment.""" from typing import List, Optional import numpy as np @@ -30,11 +30,11 @@ class FineDrag(BaseExperiment): # section: overview - The class :class:`FineDrag` runs fine DRAG calibration experiments (see :class:`DragCal` - for the definition of DRAG pulses). Fine DRAG calibration proceeds by iterating the - gate sequence Rp - Rm where Rp is a rotation around an axis and Rm is the same rotation - but in the opposite direction and is implemented by the gates Rz - Rp - Rz where the Rz - gates are virtual Z-rotations, see Ref. [1]. The executed circuits are of the form + :class:`FineDrag` runs fine DRAG characterization experiments (see :class:`DragCal` + for the definition of DRAG pulses). Fine DRAG proceeds by iterating the gate sequence + Rp - Rm where Rp is a rotation around an axis and Rm is the same rotation but in the + opposite direction and is implemented by the gates Rz - Rp - Rz where the Rz gates + are virtual Z-rotations, see Ref. [1]. The executed circuits are of the form .. parsed-literal:: @@ -217,10 +217,10 @@ def circuits(self) -> List[QuantumCircuit]: class FineXDrag(FineDrag): - """Class to fine calibrate the DRAG parameter of an X gate. + """Class to fine characterize the DRAG parameter of an X gate. # section: see_also - qiskit_experiments.library.calibration.fine_drag.FineDrag + qiskit_experiments.library.characterization.fine_drag.FineDrag """ def __init__(self, qubit: int, backend: Optional[Backend] = None): @@ -246,10 +246,10 @@ def _pre_circuit() -> QuantumCircuit: class FineSXDrag(FineDrag): - """Class to fine calibrate the DRAG parameter of an SX gate. + """Class to fine characterize the DRAG parameter of an SX gate. # section: see_also - qiskit_experiments.library.calibration.fine_drag.FineDrag + qiskit_experiments.library.characterization.fine_drag.FineDrag """ def __init__(self, qubit: int, backend: Optional[Backend] = None): diff --git a/qiskit_experiments/library/characterization/ramsey_xy.py b/qiskit_experiments/library/characterization/ramsey_xy.py index a8a0e588de..22cea3444e 100644 --- a/qiskit_experiments/library/characterization/ramsey_xy.py +++ b/qiskit_experiments/library/characterization/ramsey_xy.py @@ -30,8 +30,8 @@ class RamseyXY(BaseExperiment): # section: overview This experiment differs from the :class:`~qiskit_experiments.characterization.\ - t2ramsey.T2Ramsey` since it is sensitive to the sign of frequency offset from the main - transition. This experiment consists of following two circuits: + t2ramsey.T2Ramsey` since it is sensitive to the sign of the frequency offset from + the main transition. This experiment consists of following two circuits: .. parsed-literal:: diff --git a/releasenotes/notes/calibrations-97c6ae807d54015d.yaml b/releasenotes/notes/calibrations-97c6ae807d54015d.yaml new file mode 100644 index 0000000000..a5ccf99d28 --- /dev/null +++ b/releasenotes/notes/calibrations-97c6ae807d54015d.yaml @@ -0,0 +1,92 @@ +--- +prelude: > + Qisit experiments 0.2 introduces several new features and changes in the + Calibration Module. +features: + - | + * Each calibration experiment is now a sub-class of a characterization + experiment. The calibration version of the experiment is created from the + characterization experiment and the new :class:`BaseCalibrationExperiment`. + This new base class adds the functionality to seamlessly manage schedules + stored in instances of the :class:`Calibrations` class and implements a + framework where calibration experiments can specify an :meth:`update` + method to update the parameters that they are designed to calibrate. + + * This release introduces a full suit of single- qubit characterization + and calibration experiments summarized below. + + * :class:`Rabi`: This experiment scans the amplitude of a pulse and measures + the qubit population. This allows us to determine the amplitude that creates, + for example, an ``X`` gate and/or a ``SX`` gate. The calibration version + of this experiment is the :class:`RoughXSXAmplitudeCal` which extracts + the amplitudes needed to implement an ``X`` gate an a ``SX`` gate. This + type of calibration is a rough amplitude calibration since the resulting + parameter value is typically not very precises. + + * :class:`FineAmplitude`: This experiment repeats a rotation a variable + number of times to amplify over- and under-rotations. The resulting + ping-pong pattern in the qubit population is fit to determine the error in + the rotation angle. The calibration version of this experiment, i.e. + :class:`FineAmplitudeCal` will update the amplitude of the pulse according + to the measurred deviation. These classes have several specializations to + X and SX gates. + + * :class:`RoughDrag`: This experiment scans the DRAG parameter of a repeated + sequence of rotation and anti-rotation. If the DRAG parameter does not have + the correct value phase errors will accumulate and the repeated sequece of + gates will not return the qubit to the ground state. The calibration + version of this experiment is :class:`RoughDragCal`. + + * :class:`FineDrag`: This experiment iterates the gate sequence Rp - Rm where + Rp is a rotation around an axis and Rm is the same rotation but in the + opposite direction. This sequence amplifies phase errors due to the presence + of higher excited states. The calibration variant of this experiment is + :class:`FineDragCal` and will update the DRAG parameter in the instance of the + :class:`Calibrations` class. These experiments have the following + specializations for X and SX gate: :class:`FineSXDrag`, :class:`FineXDrag`, + :class:`FineXDragCal`, and :class:`FineSXDragCal`. + + * :class:`QubitSpectroscopy`: This experiment performs spectroscopy by applying + a frequency shift to a long pulse. This experiment is typically used to + identify the resonance frequency of the qubit. Its calibration variant is + :class:`RoughFrequencyCal` which gives us a first rough estimate of the qubit + frequency. + + * :class:`RamseyXY`: This experiment performs a Ramsey-XY experiment which + allows us to measure the frequency of the qubit. This experiment is sensitive + to the sign of the frequency offset from the main transition. It is a more + precise measurement than spectroscopy. Its calibration counter part is + :class:`FrequencyCal`. + + * :class:`FineFrequency`: This experiment performs an error amplyfing sequence + to measure the frequency of the qubit. This is done with delay instructions + with a variable length and rz gates. The calibration version of this + experiment is :class:`FineFrequencyCal`. + + * :class:`HalfAngle`: This experiment measures the amount by which the SX and X + gates are not parallel. Such errors can occur due to phase errors. For example, + the non-linearities in the mixer's skew for :math:`\pi/2` pulses may be + different from the :math:`\pi` pulse. The calibration version of this + experiment is :class:`HalfAngleCal`. + + * Qiskit-experiment 0.2 allows the serialization of the :class:`BasisGateLibrary` + class and its sub-classes. + + * The update library has been simplified. Is functionality has been merged into + the calibration experiments. Future releases may fully deprecate the + :class:`BaseUpdater` in favour of moving its functionality into the + :class:`BaseCalibrationExperiment`. + +issues: + - | + List known issues here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +upgrade: + - | + * The :class:`BackendCalibrations` class has been merged into the + :class:`Calibrations` class. Users should now use the :class:`Calibrations` + class which they can instantiate from a backend with the :meth:`from_backend` + method. From 2ab2042b5aee461cd7dc79174ac2e8e8994d9a5f Mon Sep 17 00:00:00 2001 From: Christopher Wood Date: Fri, 10 Dec 2021 17:23:23 -0500 Subject: [PATCH 2/2] Update reno to have correct links --- .../calibration_management/__init__.py | 8 +- .../notes/calibrations-97c6ae807d54015d.yaml | 189 +++++++++++------- 2 files changed, 120 insertions(+), 77 deletions(-) diff --git a/qiskit_experiments/calibration_management/__init__.py b/qiskit_experiments/calibration_management/__init__.py index 8513a71a84..b715f8469d 100644 --- a/qiskit_experiments/calibration_management/__init__.py +++ b/qiskit_experiments/calibration_management/__init__.py @@ -37,6 +37,11 @@ :toctree: ../stubs/ Calibrations + ParameterValue + FixedFrequencyTransmon + BasisGateLibrary + BaseCalibrationExperiment + Managing Calibration Data ========================= @@ -143,5 +148,6 @@ """ from .calibrations import Calibrations +from .parameter_value import ParameterValue from .base_calibration_experiment import BaseCalibrationExperiment -from .basis_gate_library import FixedFrequencyTransmon +from .basis_gate_library import FixedFrequencyTransmon, BasisGateLibrary diff --git a/releasenotes/notes/calibrations-97c6ae807d54015d.yaml b/releasenotes/notes/calibrations-97c6ae807d54015d.yaml index a5ccf99d28..d93aab9c95 100644 --- a/releasenotes/notes/calibrations-97c6ae807d54015d.yaml +++ b/releasenotes/notes/calibrations-97c6ae807d54015d.yaml @@ -1,92 +1,129 @@ --- -prelude: > - Qisit experiments 0.2 introduces several new features and changes in the - Calibration Module. features: - | - * Each calibration experiment is now a sub-class of a characterization - experiment. The calibration version of the experiment is created from the - characterization experiment and the new :class:`BaseCalibrationExperiment`. - This new base class adds the functionality to seamlessly manage schedules - stored in instances of the :class:`Calibrations` class and implements a - framework where calibration experiments can specify an :meth:`update` - method to update the parameters that they are designed to calibrate. + Adds a collection of experiments for performing single-qubit gate + :mod:`~qiskit_experiments.library.characterization` and + :mod:`~qiskit_experiments.library.calibration`. The new experiments are - * This release introduces a full suit of single- qubit characterization - and calibration experiments summarized below. + * :class:`~qiskit_experiments.library.characterization.Rabi`: + This experiment scans the amplitude of a pulse and measures the qubit + population. This allows us to determine the amplitude that creates, + for example, an ``X`` gate and/or a ``SX`` gate. + + * :class:`~qiskit_experiments.library.calibration.RoughXSXAmplitudeCal`: + The calibration version of :class:`~qiskit_experiments.library.characterization.Rabi`. + It extracts the amplitudes needed to implement an ``X`` gate an a ``SX`` gate. + This type of calibration is a rough amplitude calibration since the resulting + parameter value is typically not very precises. - * :class:`Rabi`: This experiment scans the amplitude of a pulse and measures - the qubit population. This allows us to determine the amplitude that creates, - for example, an ``X`` gate and/or a ``SX`` gate. The calibration version - of this experiment is the :class:`RoughXSXAmplitudeCal` which extracts - the amplitudes needed to implement an ``X`` gate an a ``SX`` gate. This - type of calibration is a rough amplitude calibration since the resulting - parameter value is typically not very precises. + * :class:`~qiskit_experiments.library.characterization.FineAmplitude`: This experiment repeats + a rotation a variable number of times to amplify over- and under-rotations. + The resulting ping-pong pattern in the qubit population is fit to determine + the error in the rotation angle. + This experiment has specializations for X + (:class:`~qiskit_experiments.library.characterization.FineXAmplitude`) and SX + (:class:`~qiskit_experiments.library.characterization.FineSXAmplitude`) gates. - * :class:`FineAmplitude`: This experiment repeats a rotation a variable - number of times to amplify over- and under-rotations. The resulting - ping-pong pattern in the qubit population is fit to determine the error in - the rotation angle. The calibration version of this experiment, i.e. - :class:`FineAmplitudeCal` will update the amplitude of the pulse according - to the measurred deviation. These classes have several specializations to - X and SX gates. + * :class:`~qiskit_experiments.library.calibration.FineAmplitudeCal`: The calibration version + of :class:`~qiskit_experiments.library.characterization.FineAmplitude`. + It will update the amplitude of the pulse according to the measurred deviation. + This experiment has specializations for X + (:class:`~qiskit_experiments.library.calibration.FineXAmplitudeCal`) and SX + (:class:`~qiskit_experiments.library.calibration.FineSXAmplitudeCal`) gates. - * :class:`RoughDrag`: This experiment scans the DRAG parameter of a repeated - sequence of rotation and anti-rotation. If the DRAG parameter does not have - the correct value phase errors will accumulate and the repeated sequece of - gates will not return the qubit to the ground state. The calibration - version of this experiment is :class:`RoughDragCal`. + * :class:`~qiskit_experiments.library.characterization.RoughDrag`: + This experiment scans the DRAG parameter of a repeated + sequence of rotation and anti-rotation. If the DRAG parameter does not have + the correct value phase errors will accumulate and the repeated sequece of + gates will not return the qubit to the ground state. + + * :class:`~qiskit_experiments.library.calibration.RoughDragCal`: The calibration version of + :class:`~qiskit_experiments.library.characterization.RoughDrag`. - * :class:`FineDrag`: This experiment iterates the gate sequence Rp - Rm where - Rp is a rotation around an axis and Rm is the same rotation but in the - opposite direction. This sequence amplifies phase errors due to the presence - of higher excited states. The calibration variant of this experiment is - :class:`FineDragCal` and will update the DRAG parameter in the instance of the - :class:`Calibrations` class. These experiments have the following - specializations for X and SX gate: :class:`FineSXDrag`, :class:`FineXDrag`, - :class:`FineXDragCal`, and :class:`FineSXDragCal`. + * :class:`~qiskit_experiments.library.characterization.FineDrag`: This experiment iterates the + gate sequence Rp - Rm where Rp is a rotation around an axis and Rm is the same + rotation but in the opposite direction. This sequence amplifies phase errors due + to the presence of higher excited states. + This experiment has specializations for X + (:class:`~qiskit_experiments.library.characterization.FineXDrag`) and SX + (:class:`~qiskit_experiments.library.characterization.FineSXDrag`) gates. + + * :class:`~qiskit_experiments.library.calibration.FineDragCal`: The calibration version of + :class:`~qiskit_experiments.library.characterization.FineDrag`. + This will update the DRAG parameter in the instance of the + :class:`:class:`~qiskit_experiments.calibration_management.Calibrations` class. + This experiment has specializations for X + (:class:`~qiskit_experiments.library.calibration.FineXDragCal`) and SX + (:class:`~qiskit_experiments.library.calibration.FineSXDragCal`) gates. - * :class:`QubitSpectroscopy`: This experiment performs spectroscopy by applying - a frequency shift to a long pulse. This experiment is typically used to - identify the resonance frequency of the qubit. Its calibration variant is - :class:`RoughFrequencyCal` which gives us a first rough estimate of the qubit - frequency. + * :class:`~qiskit_experiments.library.characterization.QubitSpectroscopy`: This experiment + performs spectroscopy by applying a frequency shift to a long pulse. This experiment + is typically used to identify the resonance frequency of the qubit. + + * :class:`~qiskit_experiments.library.calibration.RoughFrequencyCal` the calibration + version of :class:`~qiskit_experiments.library.characterization.QubitSpectroscopy`. + This gives us a first rough estimate of the qubits frequency. - * :class:`RamseyXY`: This experiment performs a Ramsey-XY experiment which - allows us to measure the frequency of the qubit. This experiment is sensitive - to the sign of the frequency offset from the main transition. It is a more - precise measurement than spectroscopy. Its calibration counter part is - :class:`FrequencyCal`. + * :class:`~qiskit_experiments.library.characterization.RamseyXY`: This experiment + performs a Ramsey-XY experiment which allows us to measure the frequency of the qubit. + This experiment is sensitive to the sign of the frequency offset from the main transition. + It is a more precise measurement than spectroscopy. + + * :class:`~qiskit_experiments.library.calibration.FrequencyCal`: This is the calibration + version of :class:`~qiskit_experiments.library.characterization.RamseyXY`. - * :class:`FineFrequency`: This experiment performs an error amplyfing sequence - to measure the frequency of the qubit. This is done with delay instructions - with a variable length and rz gates. The calibration version of this - experiment is :class:`FineFrequencyCal`. + * :class:`~qiskit_experiments.library.characterization.FineFrequency`: + This experiment performs an error amplifying sequence to measure the frequency of the qubit. + This is done with delay instructions with a variable length and RZ gates. + + * :class:`~qiskit_experiments.library.calibration.FineFrequencyCal`: + This is the calibration version of + :class:`~qiskit_experiments.library.characterization.FineFrequency`. - * :class:`HalfAngle`: This experiment measures the amount by which the SX and X - gates are not parallel. Such errors can occur due to phase errors. For example, - the non-linearities in the mixer's skew for :math:`\pi/2` pulses may be - different from the :math:`\pi` pulse. The calibration version of this - experiment is :class:`HalfAngleCal`. + * :class:`~qiskit_experiments.library.characterization.HalfAngle`: + This experiment measures the amount by which the SX and X gates are not parallel. + Such errors can occur due to phase errors. For example, + the non-linearities in the mixer's skew for :math:`\pi/2` pulses may be + different from the :math:`\pi` pulse. - * Qiskit-experiment 0.2 allows the serialization of the :class:`BasisGateLibrary` - class and its sub-classes. - - * The update library has been simplified. Is functionality has been merged into - the calibration experiments. Future releases may fully deprecate the - :class:`BaseUpdater` in favour of moving its functionality into the - :class:`BaseCalibrationExperiment`. - -issues: + * :class:`~qiskit_experiments.library.calibration.HalfAngleCal`: + This is the calibration version of + :class:`~qiskit_experiments.library.characterization.HalfAngle`. - | - List known issues here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. + Added support for JSON serialization to + :class:`qiskit_experiments.calibration_management.BasisGateLibrary`. + - | + Simplified the update library for calibration experiments by merging + this functionality into the + :class:`qiskit_experiments.calibration_management.BaseCalibrationExperiment`. + + Future releases may fully deprecate the + :class:`qiskit_experiments.calibration_management.update_library.BaseUpdater` + in favour of moving its functionality into the + :class:`~qiskit_experiments.calibration_management.BaseCalibrationExperiment`. upgrade: - | - * The :class:`BackendCalibrations` class has been merged into the - :class:`Calibrations` class. Users should now use the :class:`Calibrations` - class which they can instantiate from a backend with the :meth:`from_backend` - method. + The ``BackendCalibrations`` class has bas been removed and its functionality + has been merged into the + :class:`qiskit_experiments.calibration_management.Calibrations` class. Users + should now use the :class:`Calibrations` + class which can be instantiated from a backend by using the + :meth:`~qiskit_experiments.calibration_management.Calibrations.from_backend` + method. +developer: + - | + :mod:`~qiskit_experiments.library.calibration` experiments have been changed + so that each experiment is a subclass of a + :mod:`~qiskit_experiments.library.characterization` experiment. + + Calibration experiments should now be constructed as subclasses of both + the relevant characterization experiment and the new + :class:`qiskit_experiments.calibration_management.BaseCalibrationExperiment` + abstract base class. + + This new base class implements the functionality to manage schedules + stored in instances of the + :class:`qiskit_experiments.calibration_management.Calibrations` class and + implements a framework where calibration experiments can specify an + :meth:`~qiskit_experiments.calibration_management.BaseCalibrationExperiment.update` + method to update the parameters that they are designed to calibrate.