Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
355 changes: 202 additions & 153 deletions docs/tutorials/calibrating_armonk.ipynb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions qiskit_experiments/calibration_management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
BackendCalibrations
Calibrations
Frequency
Amplitude
Drag

Managing Calibration Data
Expand Down Expand Up @@ -150,4 +149,4 @@
from .backend_calibrations import BackendCalibrations
from .base_calibration_experiment import BaseCalibrationExperiment

from .update_library import Frequency, Drag, Amplitude, FineDragUpdater
from .update_library import Frequency, Drag, FineDragUpdater
55 changes: 1 addition & 54 deletions qiskit_experiments/calibration_management/update_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from abc import ABC
from datetime import datetime, timezone
from typing import List, Optional, Tuple, Union
from typing import Optional, Union
import numpy as np

from qiskit.circuit import Parameter
Expand Down Expand Up @@ -245,56 +245,3 @@ def update(
new_beta = old_beta + d_beta

cls.add_parameter_value(calibrations, exp_data, new_beta, parameter, schedule, group)


class Amplitude(BaseUpdater):
"""Update pulse amplitudes."""

# pylint: disable=arguments-differ,unused-argument
@classmethod
def update(
cls,
calibrations: Calibrations,
exp_data: ExperimentData,
result_index: Optional[int] = -1,
group: str = "default",
angles_schedules: List[Tuple[float, str, Union[str, ScheduleBlock]]] = None,
**options,
):
"""Update the amplitude of pulses.

The value of the amplitude must be derived from the fit so the base method cannot be used.

Args:
calibrations: The calibrations to update.
exp_data: The experiment data from which to update.
result_index: The result index to use which defaults to -1.
group: The calibrations group to update. Defaults to "default."
angles_schedules: A list of tuples specifying which angle to update for which
pulse schedule. Each tuple is of the form: (angle, parameter_name,
schedule). Here, angle is the rotation angle for which to extract the amplitude,
parameter_name is the name of the parameter whose value is to be updated, and
schedule is the schedule or its name that contains the parameter.
options: Trailing options.

Raises:
CalibrationError: If the experiment is not of the supported type.
"""
from qiskit_experiments.library.calibration.rabi import Rabi

if angles_schedules is None:
angles_schedules = [(np.pi, "amp", "xp")]

if isinstance(exp_data.experiment, Rabi):
rate = 2 * np.pi * BaseUpdater.get_value(exp_data, "rabi_rate", result_index)

for angle, param, schedule in angles_schedules:
qubits = exp_data.metadata["physical_qubits"]
prev_amp = calibrations.get_parameter_value(param, qubits, schedule, group=group)

value = np.round(angle / rate, decimals=8) * np.exp(1.0j * np.angle(prev_amp))

cls.add_parameter_value(calibrations, exp_data, value, param, schedule, group)

else:
raise CalibrationError(f"{cls.__name__} updates from {type(Rabi.__name__)}.")
14 changes: 10 additions & 4 deletions qiskit_experiments/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
~characterization.FineAmplitude
~characterization.FineXAmplitude
~characterization.FineSXAmplitude
~characterization.Rabi
~characterization.EFRabi

.. _calibration:

Expand All @@ -87,21 +89,23 @@ class instance to manage parameters and pulse schedules.
~calibration.FineDrag
~calibration.FineXDrag
~calibration.FineSXDrag
~calibration.Rabi
~calibration.EFRabi
~calibration.FineAmplitudeCal
~calibration.FineXAmplitudeCal
~calibration.FineSXAmplitudeCal
~calibration.RamseyXY
~calibration.RoughAmplitudeCal
~calibration.RoughXSXAmplitudeCal
~calibration.EFRoughXSXAmplitudeCal

"""
from .calibration import (
DragCal,
FineDrag,
FineXDrag,
FineSXDrag,
Rabi,
EFRabi,
RoughAmplitudeCal,
RoughXSXAmplitudeCal,
EFRoughXSXAmplitudeCal,
FineAmplitudeCal,
FineXAmplitudeCal,
FineSXAmplitudeCal,
Expand All @@ -115,6 +119,8 @@ class instance to manage parameters and pulse schedules.
EFSpectroscopy,
CrossResonanceHamiltonian,
EchoedCrossResonanceHamiltonian,
Rabi,
EFRabi,
HalfAngle,
FineAmplitude,
FineXAmplitude,
Expand Down
6 changes: 4 additions & 2 deletions qiskit_experiments/library/calibration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
FineDrag
FineXDrag
FineSXDrag
Rabi
FineAmplitudeCal
FineXAmplitudeCal
FineSXAmplitudeCal
RamseyXY
RoughAmplitudeCal
RoughXSXAmplitudeCal
EFRoughXSXAmplitudeCal

Calibration analysis
====================
Expand All @@ -70,8 +72,8 @@
from .rough_frequency import RoughFrequencyCal
from .drag import DragCal
from .fine_drag import FineDrag, FineXDrag, FineSXDrag
from .rough_amplitude_cal import RoughAmplitudeCal, RoughXSXAmplitudeCal, EFRoughXSXAmplitudeCal
from .fine_amplitude import FineAmplitudeCal, FineXAmplitudeCal, FineSXAmplitudeCal
from .rabi import Rabi, EFRabi
from .ramsey_xy import RamseyXY

from .analysis.drag_analysis import DragCalAnalysis
Expand Down
1 change: 0 additions & 1 deletion qiskit_experiments/library/calibration/fine_amplitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def __init__(
cal_parameter_name: The name of the parameter in the schedule to update.
auto_update: Whether or not to automatically update the calibrations. By
default this variable is set to True.
on.
"""
super().__init__(
calibrations,
Expand Down
Loading