laboneq_applications.analysis.echo
¶
This module defines the analysis for extracting T2 from a Hahn Echo experiment.
The experiment is defined in laboneq_applications.experiments. See the docstring of this file for more details on how the experiment is created.
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 an exponential decay model to the qubit population and extract the qubit dephasing time T2 from the fit. Finally, we plot the data and the fit.
analysis_workflow(result, qubits, delays, options=None)
¶
The Hahn echo analysis workflow.
The workflow consists of the following steps:
- calculate_qubit_population
- fit_data
- extract_qubit_parameters
- plot_raw_complex_data_1d
- plot_population
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result |
RunExperimentResults
|
The experiment results returned by the run_experiment task of the Hahn echo experiment workflow. |
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 |
delays |
QubitSweepPoints
|
The delays to sweep over for each qubit. The delays between the two x90
pulses and the refocusing pulse are |
required |
options |
TuneUpAnalysisWorkflowOptions | None
|
The options for building the workflow as an instance of [TuneUpAnalysisWorkflowOptions]. See the docstrings of this class for more details. |
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],
delays=[
np.linspace(0, 10e-6, 11),
np.linspace(0, 10e-6, 11),
],
options=options,
).run()
extract_qubit_parameters(qubits, fit_results, options=None)
¶
Extract the new T2 values for each qubit from the fit results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubits |
Qubits
|
The qubits on which to run the task. May be either a single qubit or a list of qubits. |
required |
fit_results |
dict[str, ModelResult]
|
the fit-results dictionary returned by the task |
required |
options |
TuneupAnalysisOptions | None
|
The options for building the workflow as an instance of [TuneupAnalysisOptions]. See the docstrings 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 |
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]]]
|
``` |
dict[str, dict[str, dict[str, int | float | Variable | None]]]
|
If the do_fitting option is False, the new_parameter_values are not extracted |
dict[str, dict[str, dict[str, int | float | Variable | None]]]
|
and the function only returns the old_parameter_values. |
dict[str, dict[str, dict[str, int | float | Variable | None]]]
|
If a qubit uid is not found in fit_results, the new_parameter_values entry for |
dict[str, dict[str, dict[str, int | float | Variable | None]]]
|
that qubit is left empty. |
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 task. 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 containing the qubit population to be fitted and the sweep points of the experiment. |
required |
options |
TuneupAnalysisOptions | None
|
The options for building the workflow as an instance of [TuneupAnalysisOptions]. See the docstrings of this class for more details. |
None
|
Returns:
Type | Description |
---|---|
dict[str, ModelResult]
|
dict with qubit UIDs as keys and the fit results for each qubit as values. |
plot_population(qubits, processed_data_dict, fit_results, qubit_parameters, options=None)
¶
Create the Hahn echo plots.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
qubits |
Qubits
|
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 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 |
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. |
dict[str, Figure]
|
If a qubit uid is not found in fit_results, the fit and the textbox with the |
dict[str, Figure]
|
extracted qubit parameters are not plotted. |
plot_raw_complex_data_1d(qubits, result, delays, options=None)
¶
Creates the raw-data plots for the Hahn Echo experiment.
Calls plot_raw_complex_data_1d. This task is needed because we want to plot the raw data as a function of the total time separation between the two x90 pulses in the experiment. Therefore, we need to first add the length of the refocusing pulse to the delays before calling plot_raw_complex_data_1d.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result |
RunExperimentResults | tuple[RunExperimentResults, Results]
|
The experiment results returned by the run_experiment task of the Hahn echo experiment workflow. |
required |
qubits |
Qubits
|
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 |
delays |
QubitSweepPoints
|
The delays to sweep over for each qubit. The delays between the two x90
pulses and the refocusing pulse are |
required |
options |
TuneupAnalysisOptions | None
|
The options for building the workflow as an instance of [TuneupAnalysisOptions]. See the docstrings of this class for more details. |
None
|
Returns:
Type | Description |
---|---|
dict[str, dict[str, ArrayLike]]
|
dict with qubit UIDs as keys and the figures for each qubit as values. |