Skip to content

laboneq_applications.analysis.amplitude_fine

This module defines the analysis for an amplitude-fine experiment.

The experiment is defined in laboneq_applications.experiments.

In this analysis, we first interpret the raw data into qubit populations using principle-component analysis or rotation and projection on the measured calibration states. Then we fit a cosine model to the qubit population and extract ... . Finally, we plot the data and the fit.

analysis_workflow(result, qubits, amplification_qop, repetitions, target_angle, phase_offset, parameter_to_update=None, options=None)

The amplitude-fine 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 Qubits

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
amplification_qop str

str to identify the quantum operation to repeat to produce error amplification.

required
repetitions QubitSweepPoints

Number of times to repeat the quantum operations used to amplify the rotation errors. If qubits is a single qubit, repetitions must be a list of integers. Otherwise it must be a list of lists of integers.

required
target_angle float

target angle the specified quantum operation shuould rotate. The target_angle is used as initial guess for fitting.

required
phase_offset float

initial guess for phase_offset of fit.

required
parameter_to_update str | None

str that defines the qubit parameter to be updated.

None
options TuneUpAnalysisWorkflowOptions | None

The options for building the workflow, passed as an instance of [TuneUpAnalysisWorkflowOptions]. See the docstring of this class for more information.

None

Returns:

Name Type Description
WorkflowBuilder None

The builder for the analysis workflow.

Example
options = analysis_workflow.options()
options.close_figures(False)
result = analysis_workflow(
    results=results
    qubits=[q0, q1],
    amplification_qop='x180',
    repetitions=[
        [1,2,3,4],
        [1,2,3,4],
    ],
    options=options,
).run()

extract_qubit_parameters(qubits, fit_results, processed_fit_results, parameter_to_update=None, options=None)

Extract the qubit parameters from the fit results.

Parameters:

Name Type Description Default
qubits Qubits

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 fit_results.

required
fit_results dict[str, ModelResult]

the fit-results dictionary returned by fit_data

required
processed_fit_results dict[str, Variable] | None

the processed fit-results dictionary returned by process_fit_data

required
parameter_to_update str | None

str that defines the parameter to be updated.

None
options TuneupAnalysisOptions | None

The options for extracting the qubit parameters. See [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions] for accepted options. Overwrites the options from [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions].

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

dict[str, dict[str, dict[str, int | float | Variable | None]]]

parameters. The dictionary has the following form:

dict[str, dict[str, dict[str, int | float | Variable | None]]]

```python

dict[str, dict[str, dict[str, int | float | Variable | None]]]

{ "new_parameter_values": { q.uid: { qb_param_name: qb_param_value }, } "old_parameter_values": { q.uid: { qb_param_name: qb_param_value }, }

dict[str, dict[str, dict[str, int | float | Variable | None]]]

}

dict[str, dict[str, dict[str, int | float | Variable | None]]]

```

Raises: ValueError: If fit_results are empty (have length 0).

fit_data(qubits, processed_data_dict, target_angle, phase_offset, options=None)

Perform a fit of a cosine model to the data.

Parameters:

Name Type Description Default
qubits Qubits

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[str, dict[str, ArrayLike]]

the processed data dictionary returned by process_raw_data

required
target_angle float

target angle the specified quantum operation shuould rotate. The target_angle is used as initial guess for fitting.

required
phase_offset float

initial guess for phase_offset of fit.

required
options TuneupAnalysisOptions | None

The options for processing the raw data. See [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions] for accepted options. Overwrites the options from [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions].

None

Returns:

Type Description
dict[str, ModelResult]

dict with qubit UIDs as keys and the fit results for each qubit as keys.

plot_population(qubits, processed_data_dict, amplification_qop, fit_results, processed_fit_results, parameter_to_update, qubit_parameters, options=None)

Create the amplitude-Rabi plots.

Parameters:

Name Type Description Default
qubits Qubits

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, fit_results and qubit_parameters.

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

the processed data dictionary returned by process_raw_data

required
fit_results dict[str, ModelResult] | None

the fit-results dictionary returned by fit_data

required
amplification_qop str

str to identify the quantum operation to repeat.

required
processed_fit_results dict[str, Variable] | None

the processed fit-results dictionary returned by process_fit_data

required
parameter_to_update str

str that defines the parameter to be updated.

required
qubit_parameters dict[str, dict[str, dict[str, int | float | Variable | None]]] | None

the qubit-parameters dictionary returned by extract_qubit_parameters

required
options TuneupAnalysisOptions | None

The options for processing the raw data. See [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions] for accepted options. Overwrites the options from [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions].

None

Returns:

Type Description
dict[str, Figure]

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

process_fit_results(qubits, fit_results, target_angle, options=None)

Process fit results to extract correction factor.

Parameters:

Name Type Description Default
qubits Qubits

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
target_angle float

target angle the specified quantum operation shuould rotate. The target_angle is used as initial guess for fitting.

required
options TuneupAnalysisOptions | None

The options for processing the raw data. See [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions] for accepted options. Overwrites the options from [TuneupAnalysisOptions], [TuneupExperimentOptions] and [BaseExperimentOptions].

None

Returns:

Type Description
dict[str, Variable]

dict with qubit UIDs as keys and the processed fit results for each qubit

dict[str, Variable]

as keys.

xaxis_label(amplification_qop)

Small task to create the x-axis label based on amplification_qop.

Parameters:

Name Type Description Default
amplification_qop str

str to identify the quantum operation to repeat to produce error amplification.

required

Returns:

Type Description
str

strings with the x-axis label for the amplitude-fine experiment