Skip to content

laboneq_applications.analysis.resonator_spectroscopy_dc_bias

This module defines the analysis for a resonator-spectroscopy dc-bias experiment.

In this experiment, the readout resonator frequency is swept in real time, and the voltage of an external DC voltage source is swept in near-time using a callback function. The resulting data is two-dimensional.

In this analysis, we first interpret the raw data into the signal magnitude and phase, and extract the readout-resonator frequencies as the highest peaks (options.find_peaks == True) or the deepest dips (options.find_peaks == False) in the signal magnitude. Optionally, we apply first apply a filter (options.frequency_filter) to only extract the readout-resonator frequencies in a certain range.

Then, we fit a cosine model to the readout-resonator frequencies vs the corresponding voltage points, and extract all the possible upper and lower sweet spots from this curve. The sweet-spots are defined as the points on the cosine curve of voltage vs readout-resonator frequency where the frequency is second-order sensitive to the voltage (i.e. where cos(x) = +/-1). The upper (lower) sweet-spots are the points on the cosine curve of voltage vs readout-resonator frequency where cos(x) = -1 (+1).

We then extract the qubit parameters to be updated, corresponding either to the upper or lower sweet spot, depending on options.parking_sweet_spot.

Finally, we produce three plots: the raw data, the signal magnitude with the fit results, and the signal phase.

ExtractQubitParametersOptions

Options for the extract_qubit_parameters task in this module.

Attributes:

Name Type Description
parking_sweet_spot Literal['uss', 'lss']

Specifies which sweet spot to choose for the parking, either lss for 'lower sweet-spot' or uss for 'upper sweet-spot' Default: False.

FitDataOptions

Options for the fit_data task of the resonator spectroscopy analysis.

Attributes:

Name Type Description
do_fitting bool

Whether to perform the fit of the voltages vs. readout-resonator frequencies Default: False.

fit_parameters_hints dict[str, dict[str, float | bool | str]] | None

Parameters hints accepted by lmfit Default: None.

ProcessRawDataOptions

Options for the process_raw_data task of the resonator spectroscopy analysis.

Attributes:

Name Type Description
find_peaks bool

Whether to extract the readout-resonator frequencies from the highest peaks in the signal magnitude (True) or from the lowest dips in the signal magnitude (False). Default: False.

frequency_filter tuple[float | None] | None

Information on how to filter the first-dimensional sweep points (the frequency) before extracting the readout-resonator frequencies; for example to extract the readout-resonator frequencies only in the range f > 6.8 GHz. The frequency_filter is either None (in which case no filter is applied), or a tuple with two entries: (None | lower limit, None | upper limit). The filter is applied as, frequencies > lower limit, frequencies < upper limit. Set None for either the upper or the lower limit to remove them from the filter. Default: None.

ResonatorSpectroscopyDCBiasAnalysisWorkflowOptions

Option class for resonator-spectroscopy-dc-bias analysis workflow.

Attributes:

Name Type Description
do_plotting bool

Whether to create plots. Default: 'True'.

do_raw_data_plotting bool

Whether to plot the raw data. Default: True.

do_plotting_magnitude bool

Whether to make the plot of the signal magnitude, the extracted " "readout-resonator peak/dips for each voltage value, and the fit " "results if a fit was performed. Default: True.

do_plotting_phase bool

Whether to make the plot the phase of the signal. Default: True.

analysis_workflow(result, qubit, frequencies, voltages, options=None)

The analysis Workflow for a resonator-spectroscopy-dc-bias experiment.

The workflow consists of the following steps:

Parameters:

Name Type Description Default
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
qubit QuantumElements

The qubit on which to run the analysis. The UID of this qubit must exist in the result.

required
frequencies ArrayLike

The array of frequencies that were swept over in the experiment.

required
voltages ArrayLike

The array of DC bias voltages that were swept over in the experiment.

required
options ResonatorSpectroscopyDCBiasAnalysisWorkflowOptions | None

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

None

Returns:

Name Type Description
WorkflowBuilder None

The builder for the analysis workflow.

Example
analysis_result = analysis_workflow(
    result=result,
    qubit=q0,
    frequencies=np.linspace(7.0, 7.1, 101),
    voltages=np.linspace(0, 1, 11),
).run()

extract_qubit_parameters(qubit, processed_data_dict, processed_fit_results, options=None)

Extract the qubit parameters from the fit results.

Parameters:

Name Type Description Default
qubit QuantumElements

The qubit on which to run this task.

required
processed_data_dict dict[str, ArrayLike]

the processed-data dictionary returned by the process_raw_data task in this module.

required
processed_fit_results dict[str, dict[str, ArrayLike | float]]

the dictionary returned by the process_fit_results task in this module.

required
options ExtractQubitParametersOptions | None

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

None

Returns:

Type Description
dict[str, dict[str, dict[str, int | float | Variable | 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},
    },
}

If the fit_results is None, the new_parameter_values entry for the qubit is left empty.

fit_data(processed_data_dict, options=None)

Perform a fit of a cosine model to the voltages vs readout-resonator frequencies.

Parameters:

Name Type Description Default
processed_data_dict dict[str, ArrayLike]

the processed data dictionary returned by the process_raw_data task in this module.

required
options FitDataOptions | None

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

None

Returns:

Type Description
ModelResult | None

The fit result as an instance of lmfit.model.ModelResult.

plot_signal_magnitude(qubit, processed_data_dict, fit_result, processed_fit_results, options=None)

Plot the magnitude of the signal and the fit results.

Parameters:

Name Type Description Default
qubit QuantumElements

The qubit on which to run this task.

required
fit_result ModelResult | None

The fit results returned by fit_data in this module.

required
processed_data_dict dict[str, ArrayLike]

the processed data dictionary returned by process_raw_data task in this module.

required
processed_fit_results dict[str, dict[str, ArrayLike | float]]

the dictionary returned by the process_fit_results task in this module.

required
options BasePlottingOptions | None

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

None

Returns:

Type Description
Figure | None

The matplotlib figure.

If there are no new_parameter_values for the qubit, then fit result and the textbox with the extracted parking information are not plotted.

plot_signal_phase(qubit, processed_data_dict, options=None)

Plot the phase of the transmission signal.

Parameters:

Name Type Description Default
qubit QuantumElements

The qubit on which to run this task.

required
processed_data_dict dict[str, ArrayLike]

the processed data dictionary returned by process_raw_data in this module.

required
options BasePlottingOptions | None

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

None

Returns:

Type Description
Figure | None

the matplotlib figure

If there are no new_parameter_values for the qubit, then fit result and the textbox with the extracted readout resonator frequency are not plotted.

process_fit_results(fit_result)

Extract information about the upper and lower sweet-spots from the fit result.

This task calculates all the possible upper sweet-spot (uss) and lower sweet-spot (uss) points on the cosine curve, and chooses the upper and lower sweet-spot parking voltages as the lowest out of all the possibilities.

The sweet-spots are defined as the points on the cosine curve of voltage vs readout-resonator frequency where the frequency is second-order sensitive to the voltage (i.e. where cos(x) = +/-1). The upper (lower) sweet-spots are the points on the cosine curve of voltage vs readout-resonator frequency where cos(x) = -1 (+1).

Parameters:

Name Type Description Default
fit_result ModelResult | None

The fit results returned by fit_data in this module.

required

Returns:

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

A dictionary with the keys uss (upper sweet spot) and lss (lower sweet spot). Each key is present only if the fit curve has such a sweet spot, and its value is a dictionary with the following keys:

  • voltages
  • frequencies
  • rr_frequency_parking
  • dc_voltage_parking

An empty dictionary is returned if fit_result is None.

process_raw_data(qubit, result, frequencies, voltages, options=None)

Processes the raw data and extracts the arrays needed for the analysis.

This task calculates the following quantities based on the raw data and the options:

  • the magnitude of the transmission signal;
  • the phase of the transmission signal;
  • the filtered frequencies that were swept over in the experiment, calculated by applying opts.frequency_filter on the first-dimension sweep points;
  • the readout-resonator frequencies (rr_frequencies) as the highest peaks (opts.find_peaks == True) or the deepest dips (opts.find_peaks == False) in the signal magnitude. The length of the rr_frequencies array will be equal to the number of voltages (second-dimension sweep points) that were swept in the experiment

Parameters:

Name Type Description Default
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
qubit QuantumElements

The qubit on which to run this task. The UID of this qubit must exist in the result.

required
frequencies ArrayLike

The array of frequencies that were swept over in the experiment.

required
voltages ArrayLike

The array of DC bias voltages that were swept over in the experiment.

required
options ProcessRawDataOptions | None

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

None

Returns:

Type Description
dict[str, ArrayLike]

A dictionary with the following keys:

  • sweep_points_1d
  • sweep_points_1d_filtered
  • sweep_points_2d
  • rr_frequencies
  • data_raw
  • magnitude
  • phase