laboneq_applications.contrib.analysis.single_qubit_randomized_benchmarking
¶
This module defines the analysis for single qubit randomized benchmarking experiment.
The experiment is defined in laboneq_applications.experiments.
In this analysis, we first interpret the raw data into qubit populations using principal component analysis or rotation and projection on the measured calibration states. Then we fit a exponential decay to the qubit population and extract the gate fidelity from the fit. Finally, we plot the data and the fit.
analysis_workflow(result, qubits, length_cliffords, variations, options=None)
¶
The Time Rabi 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 |
length_cliffords |
list
|
list of numbers of Clifford gates to sweep |
required |
variations |
int
|
Number of random seeds for RB. |
required |
options |
TuneUpAnalysisWorkflowOptions | None
|
The options for building the workflow, passed as an instance of [TuneUpAnalysisWorkflowOptions]. See the docstring of this class for more details. |
None
|
Returns:
Name | Type | Description |
---|---|---|
WorkflowBuilder |
None
|
The builder for the analysis workflow. |
calculate_qubit_population_rb(qubits, result, length_cliffords, variations, options=None)
¶
Processes the raw data.
The data is processed in the following way:
- If calibration traces were used in the experiment, the raw data is rotated based on the calibration traces. See calibration_traces_rotation.py/rotate_data_to_cal_trace_results for more details.
- If no calibration traces were used in the experiment, or do_pca = True is passed in options, principal component analysis is performed on the data. See calibration_traces_rotation.py/principal_component_analysis for more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubits |
Qubits
|
The qubits on which the amplitude-Rabi experiments was run. May be either a single qubit or a list of qubits. |
required |
result |
RunExperimentResults
|
the result of the experiment, returned by the run_experiment task. |
required |
length_cliffords |
list
|
list of numbers of Clifford gates to sweep |
required |
variations |
int
|
Number of random seeds for RB. |
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, dict[str, ArrayLike]]
|
dict with qubit UIDs as keys and the dictionary of processed data for each qubit |
dict[str, dict[str, ArrayLike]]
|
as values. See [calibration_traces_rotation.py/calculate_population_1d] for what |
dict[str, dict[str, ArrayLike]]
|
this dictionary looks like. |
Raises:
Type | Description |
---|---|
TypeError
|
If result is not an instance of RunExperimentResults. |
exponential_decay_fit(x, data, param_hints=None)
¶
Performs a fit of an exponential-decay model to data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
ArrayLike
|
the data to be fitted |
required |
x |
ArrayLike
|
the independent variable |
required |
param_hints |
dict | None
|
dictionary of guesses for the fit parameters. See the lmfit docstring for details on the form of the parameter hints dictionary: https://lmfit.github.io/lmfit-py/model.html#lmfit.model.Model.set_param_hint |
None
|
Returns:
Type | Description |
---|---|
ModelResult
|
The lmfit result |
fit_data(qubits, processed_data_dict, options=None)
¶
Perform a fit of an exponential-decay model to the qubit e-state population.
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 processed_data_dict |
required |
processed_data_dict |
dict[str, dict[str, ArrayLike]]
|
the processed data dictionary returned by process_raw_data |
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, fit_results, options=None)
¶
Create the time-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 and fit_results 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 |
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. |