Skip to content

laboneq_applications.contrib.analysis.ac_stark_shift_vs_power

This module defines the analysis for an AC Stark shift vs power experiment.

The experiment is defined in laboneq_applications.contrib.experiments.

In this analysis, we process the magnitude of a spectroscopy signal to perform qubit spectroscopy at various readout CW signal amplitudes. Each qubit spectroscopy dataset is individually fitted to determine the qubit frequency. The resulting qubit frequencies are then plotted against the square of the corresponding readout CW signal amplitudes. This data is subsequently fitted with a linear model. The y-intercept of this linear fit provides a more precise estimation of the qubit frequency compared to using a single qubit spectroscopy measurement.

PlotAcStarkOption

Bases: DoFittingOption, BasePlottingOptions

Options for the plot_ac_stark_shift_vs_power task of the qubit spec. analysis.

Attributes:

Name Type Description
do_fitting bool

Whether to perform the fit. Default: True.

save_figures bool

Whether to save the figures. Default: True.

close_figures bool

Whether to close the figures. Default: True.

analysis_workflow(result, qubits, frequencies, amplitudes, options=None)

The AC Stark shift vs power analysis Workflow.

The workflow consists of the following steps:

Parameters:

Name Type Description Default
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
qubits QuantumElements

The qubits on which to run the analysis. May be either a single qubit or a list of qubits. The UIDs of these qubits must exist in the result.

required
frequencies QubitSweepPoints

The array of frequencies that were swept over in the experiment. If qubits is a single qubit, frequencies must be a list of numbers or an array. Otherwise, it must be a list of lists of numbers or arrays.

required
amplitudes QubitSweepPoints

The array of amplitudes that were swept over in the experiment. If qubits is a single qubit, amplitudes must be a list of numbers or an array. Otherwise, it must be a list of lists of numbers or arrays.

required
options QubitSpectroscopyAnalysisWorkflowOptions | None

The options for building the workflow, passed as an instance of QubitSpectroscopyAnalysisWorkflowOptions. See the docstring of QubitSpectroscopyAnalysisWorkflowOptions for more details.

None

Returns:

Name Type Description
WorkflowBuilder None

The builder for the analysis workflow.

Example
result = analysis_workflow(
    result=result,
    qubits=q0,
    frequencies=np.linspace(4.0e9, 4.6e9, 101),
    amplitudes=np.linspace(0.2, 0.6, 21),
    options=analysis_workflow.options(),
).run()

calculate_signal_magnitudes_and_phases(qubits, result, frequencies, amplitudes)

Calculates the magnitude and phase of the spectroscopy signal in result.

Parameters:

Name Type Description Default
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
qubits QuantumElements

The qubits on which to run the task. May be either a single qubit or a list of qubits. The UIDs of these qubits must exist in the result.

required
frequencies QubitSweepPoints

The array of frequencies that were swept over in the experiment. If qubits is a single qubit, frequencies must be a list of numbers or an array. Otherwise, it must be a list of lists of numbers or arrays.

required
amplitudes QubitSweepPoints

The array of amplitudes that were swept over in the experiment. If qubits is a single qubit, amplitudes must be a list of numbers or an array. Otherwise, it must be a list of lists of numbers or arrays.

required

Returns:

Type Description
dict[str, dict[str, ArrayLike]]

dictionary with the qubit uids as keys and a processed data dict as values, containing the following data:

  • sweep_points_freq
  • sweep_points_amp
  • data_raw
  • magnitudes
  • phases

extract_qubit_parameters(qubits, fit_results, options=None)

Extract the qubit parameters from the fit results.

Parameters:

Name Type Description Default
qubits QuantumElements

The qubits on which to run the analysis. May be either a single qubit or a list of qubits. The UIDs of these qubits must exist in the processed_data_dict.

required
fit_results dict[str, ModelResult] | None

the fit-results dictionary returned by fit_data

required
options DoFittingOption | None

The options for this task as an instance of DoFittingOption. See the docstring of this class for more details.

None

Returns:

Type Description
dict[str, dict[str, dict[str, Variable | ModelResult | None]]]

dict with extracted qubit parameters and the previous values for those qubit parameters. The dictionary has the following form:

{
    "new_parameter_values": {
        q.uid: {
            qb_param_name: qb_param_value
        },
    },
    "old_parameter_values": {
        q.uid: {
            qb_param_name: qb_param_value
        },
    },
    "fit_results": {
        q.uid: {
            linear_fit: fit_res,
            qubit_frequency_at_amp: fit_at_amp
        },
}

If the do_fitting option is False, the new_parameter_values are not extracted and the function only returns the old_parameter_values. If the linear fit is not found in fit_results for a qubit, the new_parameter_values entry for that qubit is left empty.

fit_data(qubits, processed_data_dict, options=None)

Perform a qubit spectroscopy fit for every amplitude and a linear fit.

The qubit frequencies obtained from the qubit spectroscopy fits are fitted with a linear model against the square of the amplitudes. Amplitudes for which the qubit spectroscopy fit fails are excluded from the linear fit.

Parameters:

Name Type Description Default
qubits QuantumElements

The qubits on which to run the analysis. May be either a single qubit or a list of qubits. The UIDs of these qubits must exist in the processed_data_dict.

required
processed_data_dict dict

the processed data dictionary returned by calculate_signal_magnitudes_and_phases

required
options FitDataQubitSpecOptions | None

The options class for this task as an instance of FitDataQubitSpecOptions. See the docstring of this class for accepted options.

None

Returns:

Type Description
dict[str, dict[str, ModelResult | list[ModelResult]]]

A dict with qubit UIDs as keys and the fit results for each qubit as values. The fit results for each qubit are a dict with the following keys:

  • qubit_frequency_at_amp: list with the qubit spectroscopy fit result for every amplitude, or None if the fit failed for that amplitude.
  • linear_fit: the result of the linear fit. Only present if the fit succeeded.

If the do_fitting option is False, an empty dictionary is returned.

plot_ac_stark_shift_vs_power(qubits, processed_data_dict, fit_results, options=None)

Create the 2D qubit spectroscopy plot with frequency against amplitude squared.

Parameters:

Name Type Description Default
qubits QuantumElements

The qubits on which to run the analysis. May be either a single qubit or a list of qubits. The UIDs of these qubits must exist in the processed_data_dict and qubit_parameters.

required
processed_data_dict dict[str, dict[str, ArrayLike]]

the processed data dictionary returned by calculate_signal_magnitudes_and_phases.

required
fit_results dict[str, ModelResult] | None

the fit-results dictionary returned by fit_data

required
options PlotAcStarkOption | None

The options for this task as an instance of PlotAcStarkOption. See the docstring of this class for more details.

None

Returns:

Type Description
dict[str, dict[str, Figure]]

dict with qubit UIDs as keys and the figures for each qubit as values.