BaseCalibrationExperiment¶
- class BaseCalibrationExperiment(calibrations, *args, schedule_name=None, cal_parameter_name=None, updater=None, auto_update=True, **kwargs)[source]¶
A mixin class to create calibration experiments.
This abstract class extends a characterization experiment by turning it into a calibration experiment. Such experiments allow schedule management and updating of an instance of
Calibrations
. Furthermore, calibration experiments also specify an auto_update variable which, by default, is set to True. If this variable, is True then the run method of the experiment will callblock_for_results()
and update the calibrations instance once the backend has returned the data.This mixin class inherits from the
BaseExperiment
class since calibration experiments by default callblock_for_results()
. This ensures that the next calibration experiment cannot proceed before the calibration parameters have been updated. Developers that wish to create a calibration experiment must subclass this base class and the characterization experiment. Therefore, developers that use this mixin class must pay special attention to their class definition. Indeed, the first class should be this mixin and the second class should be the characterization experiment since the run method from the mixin must be used. For example, the rough frequency calibration experiment is defined asRoughFrequencyCal(BaseCalibrationExperiment, QubitSpectroscopy)
This ensures that the
run
method ofRoughFrequencyCal
will be the run method of theBaseCalibrationExperiment
class. Furthermore, developers must explicitly call the__init__()
methods of both parent classes.Developers should strive to follow the convention that the first two arguments of a calibration experiment are the qubit(s) and the
Calibrations
instance.If the experiment uses custom schedules, which is typically the case, then developers may chose to use the
get_schedules()
method when creating the circuits for the experiment. Ifget_schedules()
is used then the developer must override at least one of the following methods used byget_schedules()
to set the schedules:_get_schedules_from_options()
_get_schedules_from_calibrations()
_get_schedules_from_defaults()
These methods are called by
get_schedules()
.The
update_calibrations()
method is responsible for updating the values of the parameters stored in the instance ofCalibrations
. Here,BaseCalibrationExperiment
provides a default update methodology that subclasses can override if a more elaborate behaviour is needed. At the minimum the developer must set the variable_updater
which should have anupdate
method and can be chosen from the libraryqiskit_experiments.calibration_management.update_library
. See alsoqiskit_experiments.calibration_management.update_library.BaseUpdater
. If no updater is specified the experiment will still run but no update of the calibrations will be performed.Setup the calibration experiment object.
- Parameters:
calibrations (
Calibrations
) – The calibrations instance with which to initialize the experiment.args – Arguments for the characterization class.
schedule_name (
Optional
[str
]) – An optional string which specifies the name of the schedule in the calibrations that will be updated.cal_parameter_name (
Optional
[str
]) – An optional string which specifies the name of the parameter in the calibrations that will be updated. If None is given then no parameter will be updated. Subclasses may assign default values in their init.updater (
Optional
[Type
[BaseUpdater
]]) – The updater class that updates the Calibrations instance. Different calibration experiments will use different updaters.auto_update (
bool
) – If set to True (the default) then the calibrations will automatically be updated once the experiment has run andblock_for_results()
will be called.kwargs – Keyword arguments for the characterization class.
Attributes
Return the analysis instance for the experiment.
Return the backend for the experiment
Return the calibrations.
Return the options for the experiment.
Return experiment type.
Return the number of qubits for the experiment.
Return the device qubits for the experiment.
Return options values for the experiment
run()
method.Return the transpiler options for the
run()
method.Methods
Return a list of experiment circuits.
Return the config dataclass for this experiment
Return a copy of the experiment
Initialize an experiment from experiment config
BaseCalibrationExperiment.run
([backend, ...])Run an experiment and perform analysis.
Set the experiment options.
Set options values for the experiment
run()
method.Add a warning message.
Update parameter values in the
Calibrations
instance.