laboneq_applications.contrib.analysis.bosonic_qubits.snap_calibration
¶
Analysis for the SNAP gate calibration experiment.
Part 1 - Amplitude analysis
Fits the transmon response vs. selective drive amplitude to a sin^2 model. Both SNAP pulses rotate in the same direction. Together they complete a 2π rotation at the π amplitude, returning the transmon to |g>:
P(e) = contrast * sin^2(pi * amp / amp_pi) + offset
Part 2 - Phase analysis
The experiment is now a 2-D sweep: outer over the SNAP drive phase phi, inner over the Wigner displacement phase arg(beta) at fixed |beta| = sqrt(n). The data shape per qubit is (n_phi, n_beta_phase).
Stage 1 -- for each phi, fit the Wigner fringe vs arg(beta) to a single-period cosine and extract its angular position theta(phi):
W(arg_beta) = A * cos(arg_beta - theta) + B
Stage 2 -- fit the extracted fringe angles vs phi to a line:
theta(phi) = slope * phi + intercept
The calibration constant (drive-phase -> cavity-phase mapping) is
the intercept. slope is a validity check and should come
out close to +/- 1; a slope far from +/-1 indicates a readout or
state-prep problem rather than a good calibration.
DEFAULT_PHASES_TRANSMON = np.linspace(0, 2 * np.pi, 13, endpoint=False)
module-attribute
¶
DEFAULT_PHASES_WIGNER = np.linspace(0, 2 * np.pi, 48, endpoint=False)
module-attribute
¶
SnapAmplitudeFitDataOptions
¶
Options for the fit_amplitude_data task (Part 1).
Attributes:
| Name | Type | Description |
|---|---|---|
num_fit_points |
int
|
Number of points for the fit curve. Default: 200. |
SnapAnalysisWorkflowOptions
¶
Options for the SNAP amplitude and phase analysis workflows.
Attributes:
| Name | Type | Description |
|---|---|---|
do_plotting |
bool
|
Whether to create plots. Default: True. |
SnapPhaseFitDataOptions
¶
Options for the fit_phase_data task (Part 2).
Attributes:
| Name | Type | Description |
|---|---|---|
num_fit_points |
int
|
Number of points for the fit curve. Default: 200. |
min_fringe_r2 |
float
|
Minimum R^2 for a Stage-1 fringe fit to be trusted and included in the Stage-2 line fit. Default: 0.5. |
max_slope_dev |
float
|
Maximum allowed deviation of |slope| from 1.0 in the Stage-2 fit before the calibration is flagged as unreliable. Default: 0.3. |
amplitude_analysis_workflow(result, qubits, amplitudes_transmon, photon_number_memory, options=None)
¶
The SNAP amplitude analysis workflow (Part 1).
The workflow consists of the following steps:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
RunExperimentResults
|
The experiment results returned by the run_amplitude_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 |
amplitudes_transmon
|
QubitSweepPoints
|
The selective drive amplitudes that were swept for each qubit. |
required |
photon_number_memory
|
int
|
The photon number that was calibrated. |
required |
options
|
SnapAnalysisWorkflowOptions | None
|
The options for building the workflow, passed as an instance of SnapAnalysisWorkflowOptions. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
WorkflowBuilder |
None
|
The builder for the analysis workflow. |
broadcast_phases(phases, n_qubits, default)
¶
Normalise a phase spec into a per-qubit list of 1-D arrays.
extract_amplitude_parameters(qubits, processed_data_dict)
¶
Extract the SNAP pi amplitude from the Part 1 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_amplitude_data. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, dict[str, dict[str, float]]]]
|
dict with the extracted qubit parameters and their previous values: The new dictionary is a copy of the old one with the entry for the calibrated photon number set. If the fit failed for a qubit, its new_parameter_values entry is left empty. |
extract_phase_parameters(qubits, processed_data_dict)
¶
Extract the SNAP phase offset and slope sign from the Part 2 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_phase_data. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, dict[str, dict[str, float]]]]
|
dict with the extracted qubit parameters and their previous values: The new dictionaries are copies of the old ones with the entries for the calibrated photon number set. If the slope check failed for a qubit, its new_parameter_values entry is left empty. |
fit_amplitude_data(qubits, result, amplitudes_transmon, photon_number_memory, options=None)
¶
Fit Part 1: extract the pi amplitude for SNAP.
Fits a sin^2 model to the two-pulse Rabi data and extracts the pi amplitude for the given (qubit, photon number).
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_amplitude_experiment task. |
required |
amplitudes_transmon
|
QubitSweepPoints
|
The selective drive amplitudes that were swept for each qubit. |
required |
photon_number_memory
|
int
|
The photon number that was calibrated. |
required |
options
|
SnapAmplitudeFitDataOptions | None
|
The options for this task as an instance of SnapAmplitudeFitDataOptions. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dictionary keyed by qubit UID with the structure: |
fit_phase_data(qubits, result, photon_number_memory, phases_transmon=None, phases_wigner=None, options=None)
¶
Fit Part 2: extract the SNAP phase calibration.
For each qubit the raw data is reshaped to (n_phi, n_beta_phase). Stage 1 fits each fringe (a row) for its angle theta(phi); Stage 2 fits theta(phi) vs phi to a line. The intercept is the calibration constant.
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_phase_experiment task. |
required |
photon_number_memory
|
int
|
The photon number that was calibrated. |
required |
phases_transmon
|
QubitSweepPoints | None
|
The SNAP drive phases phi that were swept (outer axis). None uses the experiment's default grid. |
None
|
phases_wigner
|
QubitSweepPoints | None
|
The Wigner displacement phases arg(beta) that were swept (inner axis). None uses the experiment's default grid. |
None
|
options
|
SnapPhaseFitDataOptions | None
|
The options for this task as an instance of SnapPhaseFitDataOptions. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dictionary keyed by qubit UID with the structure: |
phase_analysis_workflow(result, qubits, photon_number_memory, phases_transmon=None, phases_wigner=None, options=None)
¶
The SNAP phase analysis workflow (Part 2).
The workflow consists of the following steps:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
RunExperimentResults
|
The experiment results returned by the run_phase_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 |
photon_number_memory
|
int
|
The photon number that was calibrated. |
required |
phases_transmon
|
QubitSweepPoints | None
|
The SNAP drive phases phi that were swept (outer axis). None uses the experiment's default grid. |
None
|
phases_wigner
|
QubitSweepPoints | None
|
The Wigner displacement phases arg(beta) that were swept (inner axis). None uses the experiment's default grid. |
None
|
options
|
SnapAnalysisWorkflowOptions | None
|
The options for building the workflow, passed as an instance of SnapAnalysisWorkflowOptions. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
WorkflowBuilder |
None
|
The builder for the analysis workflow. |
plot_amplitude_calibration(qubits, processed_data_dict, options=None)
¶
Plot Part 1: the two-pulse Rabi data and fit.
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_amplitude_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. |
plot_phase_calibration(qubits, processed_data_dict, options=None)
¶
Plot Part 2: the 2-D Wigner fringe map and the theta(phi) line fit.
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_phase_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. |