Skip to content

laboneq_applications.contrib.analysis.bosonic_qubits.swap_calibration

Analysis for the SWAP gate calibration experiment.

Supports three modes
  • "length": 1D fit of a damped cosine vs. time.
  • "amplitude": 1D fit of a damped cosine vs. amplitude.
  • "2d": Chevron pattern; extracts the optimal (amplitude, length) by finding the row (fixed amplitude) with the highest oscillation frequency and taking the corresponding t_swap.

SwapAnalysisWorkflowOptions

Options for the SWAP calibration analysis workflow.

Attributes:

Name Type Description
do_plotting bool

Whether to create plots. Default: True.

SwapFitDataOptions

Options for the fit_data task of the SWAP calibration analysis.

Attributes:

Name Type Description
num_fit_points int

Number of points for the fit curve. Default: 400.

analysis_workflow(result, qubits, swap_durations=None, swap_amplitudes=None, options=None)

The SWAP calibration 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
swap_durations QubitSweepPoints | None

The SWAP durations that were swept for each qubit, if any.

None
swap_amplitudes QubitSweepPoints | None

The SWAP amplitudes that were swept for each qubit, if any.

None
options SwapAnalysisWorkflowOptions | None

The options for building the workflow, passed as an instance of SwapAnalysisWorkflowOptions.

None

Returns:

Name Type Description
WorkflowBuilder None

The builder for the analysis workflow.

Example
analysis_result = analysis_workflow(
    result=result,
    qubits=q0,
    swap_durations=np.linspace(100e-9, 600e-9, 51),
).run()

extract_qubit_parameters(qubits, processed_data_dict)

Extract the SWAP length and/or amplitude from the fit results.

Parameters:

Name Type Description Default
qubits QuantumElements

The qubits on which to run the analysis.

required
processed_data_dict dict[str, dict]

The processed data dictionary returned by fit_data.

required

Returns:

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

dict with the extracted qubit parameters and their previous values:

{
    "new_parameter_values": {
        q.uid: {"swap_length": value, "swap_amplitude": value},
    },
    "old_parameter_values": {
        q.uid: {"swap_length": value, "swap_amplitude": value},
    },
}

Only the parameters calibrated by the sweep mode are included (swap_length for a length sweep, swap_amplitude for an amplitude sweep, both for a 2D sweep). Parameters whose fit failed are left out of new_parameter_values.

fit_data(qubits, result, swap_durations=None, swap_amplitudes=None, options=None)

Fit the SWAP calibration data.

Mode is inferred from which inputs are provided
  • swap_durations only → length sweep.
  • swap_amplitudes only → amplitude sweep.
  • Both → 2D chevron sweep.

Parameters:

Name Type Description Default
qubits QuantumElements

The qubits on which to run the analysis.

required
result RunExperimentResults

The experiment results returned by the run_experiment task.

required
swap_durations QubitSweepPoints | None

The SWAP durations that were swept for each qubit, if any.

None
swap_amplitudes QubitSweepPoints | None

The SWAP amplitudes that were swept for each qubit, if any.

None
options SwapFitDataOptions | None

The options for this task as an instance of SwapFitDataOptions.

None

Returns:

Type Description
dict[str, dict]

Dictionary keyed by qubit UID. Structure depends on mode — each dict always contains the key "mode" and the calibrated "t_swap" and/or "amp_swap".

plot_swap_calibration(qubits, processed_data_dict, options=None)

Plot the SWAP calibration data and fit for the sweep mode that was run.

Parameters:

Name Type Description Default
qubits QuantumElements

The qubits on which to run the analysis.

required
processed_data_dict dict[str, dict]

The processed data dictionary returned by fit_data.

required
options BasePlottingOptions | None

The options for this task as an instance of BasePlottingOptions.

None

Returns:

Type Description
dict[str, Figure]

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