qruise-experiment¶
qruise.experiment.experiments.amplitude_rabi
¶
AmplitudeRabiAnalysis
¶
Bases: AnalysisBase
Analyse Amplitude Rabi data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. Expected to have a 1D Rabi amplitude sweep on the first dimension and averaged I/Q measurement data in variables "I" and "Q". |
required |
title
|
str
|
Title of the analysis. |
required |
sigma
|
float
|
Smoothing data with a gauss for the projection, if None, no smoothing is applied. |
None
|
min_val
|
float
|
Minimum value of the amplitude. If the estimated value is smaller than this, the fit is considered failed. |
0
|
max_val
|
float
|
Maximum value of the amplitude. If the estimated value is larger than this, the fit is considered failed. |
1.0
|
print_summary(verbose=False)
¶
Print the analysis summary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
verbose
|
bool
|
If True, prints the fit report. |
False
|
qruise.experiment.experiments.correlated_readout_error
¶
CorrelatedReadoutErrorAnalysis
¶
Bases: AnalysisBase
Analyze correlated readout errors in quantum experiments. This class processes experimental data to compute and visualize assignment matrices and their tensorized counterparts. It provides tools for plotting and summarizing the results of the analysis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
The experimental dataset containing prepared and measured states. |
required |
composite_discriminator
|
object
|
A composite discriminator object used to compute the assignment matrix. |
required |
title
|
str
|
The title of the analysis. |
required |
print_summary()
¶
Print the analysis summary. This method outputs whether the computation of correlated readout errors was successful or not.
qruise.experiment.experiments.cos_fit
¶
DRAGAnalysis
¶
Bases: AnalysisBase
Analysis for DRAG calibration data.
This class performs a DRAG calibration analysis by fitting a cosine function to experimental data. It calculates the optimal DRAG value, its standard error, and the R-squared value of the fit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
The experimental dataset containing the data to be analyzed. |
required |
title
|
str
|
The title of the analysis. |
required |
discriminator
|
Discriminator
|
The discriminator used to process the experimental data. |
required |
amp
|
float
|
Initial guess for the amplitude of the cosine function (default is 1). |
1
|
d_offset
|
float
|
Initial guess for the offset of the cosine function (default is 0). |
0
|
base
|
float or None
|
Initial guess for the baseline of the cosine function. If None, it is set to the minimum value of the experimental data (default is None). |
None
|
omega
|
float
|
Initial guess for the frequency of the cosine function (default is 1). |
1
|
cos_fit(prob_e, initial_guesses)
¶
Fit a cosine to a measured function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prob_e
|
DataArray
|
1D data array with amplitude sweep on the first dimension. |
required |
initial_guesses
|
dict
|
Initial guesses for the fit parameters. The keys should be: - "amp": Amplitude of the cosine function. - "d_offset": Offset of the cosine function. - "base": Baseline offset. - "omega": Frequency of the cosine function. |
required |
qruise.experiment.experiments.coupler_spectroscopy
¶
CouplerSpectroscopyAnalysis
¶
Bases: AnalysisBase
Analyse Coupler spectroscopy data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
DataArray
|
Xarray data obtained from running the experiment. |
required |
title
|
str
|
Title for plotting. |
required |
composite_discriminator
|
CompositeDiscriminator
|
Composite discriminator used for population analysis. |
required |
gaussian_window
|
int
|
Gaussian window used to smooth the Rabi oscillation data. Defaults to 2. |
2
|
fit_between_fluxes
|
list
|
Two-element list with the range of fluxes where the effective coupling fit should be done. Defaults to None, in which case all values are used. |
None
|
variance_threshold
|
float
|
Threshold for variance to guess the fit window. Defaults to None. |
None
|
preoptimize_fit
|
bool
|
Whether to use scipy.optimize.brute to preoptimize the Rabi oscillation fitting. Defaults to False. |
False
|
Ns
|
int
|
Number of points to use in the brute pre-optimization. Defaults to 100. |
100
|
print_summary()
¶
Print the analysis summary.
eff_coupling(x, a, b, c, g12)
¶
Perturbative expression for the effective coupling between two transmons coupled through a tunable coupler as a function of applied flux. We assume that the detuning varies quadratically with the applied flux.
For more info see Eq (2) of Yan, Fei, et al. "Tunable coupling scheme for implementing high-fidelity two-qubit gates." Physical Review Applied 10.5 (2018): 054062
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
float
|
Applied flux. |
required |
a
|
float
|
Constant term in the detuning. |
required |
b
|
float
|
Coefficient of the linear term in the detuning. |
required |
c
|
float
|
Coefficient of the quadratic term in the detuning. |
required |
g12
|
float
|
Coupling strength between the two transmons. |
required |
qruise.experiment.experiments.coupler_utils
¶
guess_fit_window(populations, variance_threshold)
¶
Guess the fit window for delta and g in a chevron plot by finding a connected region with high variance in population. When we scan for chevrons, we may end up with regions where levels are off-resonant. There, the populations remain approximately constant, i.e. they have approximately zero variance over time. In the actual chevron regions we see oscillations and therefore finite variance.
In general, there may be multiple connected regions with finite variance. Here, we pick the largest one.
qruise.experiment.experiments.cpmg_noise_spectroscopy
¶
PSDAnalysis
¶
Bases: AnalysisBase
Noise spectroscopy analysis class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Contains the decay function and the standard deviation. |
required |
title
|
str
|
Experiment title. |
required |
total_time
|
float
|
Total CPMG instruction duration. |
required |
method
|
str
|
Analysis method: 'single-delta' or 'Alvarez-Suter'. |
required |
harmonics
|
int
|
Number of harmonics of base frequency used in analysis, used only for Alvarez-Suter method. |
1
|
__init__(experiment_data, title, total_time, method, harmonics=1)
¶
plot_filter_function(delay_index=None)
¶
Plot the filter function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
delay_index
|
int
|
Index of the delay in delay list, by default None. |
None
|
Returns:
Type | Description |
---|---|
hvplot
|
Filter function plot for a specific delay or all the delays. |
print_summary()
¶
Print the analysis summary.
qruise.experiment.experiments.cryoscope
¶
CryoscopeAnalysis
¶
Bases: AnalysisBase
Analyze a cryoscope experiment according to "Time-domain characterization and correction of on-chip distortion of control pulses in a quantum processor" Applied Physics Letters 116.5 (2020).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
DataArray
|
data obtained from cryoscope experiment, expected to have the following - I : the measured I quadrature, dimensions are "measure_time", "acquire_loop" - Q : the measured Q quadrature, dimension are "measure_time", "acquire_loop" - ideal_pulse_shape : the programmed pulse shape, with coordinate "time" |
required |
title
|
str
|
title to use in analysis plots |
required |
freq_of_flux
|
Callable
|
a function that returns the qubit frequency for a given flux |
required |
discriminator
|
Optional[Discriminator]
|
trained on qubit to analyze |
None
|
max_flux
|
float
|
max flux in expected cryoscope data to restrict search for fitting flux to freq |
0.2
|
savgol_window
|
int
|
scipy.signal.savgol_filter for more details. Defaults to 2. |
4
|
savgol_order
|
int
|
smooth the derivative of the phase. See scipy.signal.savgol_filter for more details. Defaults to 4. |
2
|
print_summary()
¶
Prints the analysis summary.
qruise.experiment.experiments.drag_calibration
¶
DRAGAnalysis
¶
Bases: AnalysisBase
DRAG calibration analysis class.
qruise.experiment.experiments.estimators
¶
estimate_decay_constant(x, y)
¶
Estimate the decay constant for a signal that might be decaying exponentially.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ndarray
|
The time axis of the signal |
required |
y
|
ndarray
|
Signal |
required |
Returns:
Type | Description |
---|---|
float
|
The slope value of the linear fit to the log of the signal, ie. an estimate of the decay constant |
estimate_frequency(x, y, n=1, freq_range=None, return_amplitude_phase=False)
¶
Estimate the frequency of a signal that might be oscillating.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ndarray
|
The time axis of the signal |
required |
y
|
ndarray
|
The signal |
required |
n
|
int
|
Return the n highest frequencies |
1
|
freq_range
|
Union[Tuple[float, float], float]
|
The frequency range to consider, defaults to all frequencies above 0 |
None
|
Returns:
Type | Description |
---|---|
float
|
The frequency estimates from a numpy FFT if n=1 and return_amplitude_phase=False |
ndarray
|
The frequency estimates from a numpy FFT if n>1 and return_amplitude_phase=False |
Tuple[ndarray, ndarray, ndarray]
|
The frequency, amplitude and phase estimates from a numpy FFT if n>1 and return_amplitude_phase=True |
Tuple[float, float, float]
|
The frequency, amplitude and phase estimates from a numpy FFT if n=1 and return_amplitude_phase=True |
qruise.experiment.experiments.flux_crosstalk
¶
FluxCrosstalkAnalysis
¶
Bases: AnalysisBase
Class for Ramsey-based DC flux crosstalk analysis. To measure the flux on qubit Q_i due to qubit Q_j, we perform a Ramsey experiment on Q_i whilst flux biasing Q_j. We repeat this for various fluxes on Q_i and Q_j and then fit the data to the model
eff_flux = V_i + crosstalk * V_j freq(V_i, V_j) = a * eff_flux**2 + b * eff_flux + c
where V_i, V_j are the voltages applied on Q_i, Q_j. The crosstalk parameter gives the fraction of the flux of Q_j felt by Q_i.
qruise.experiment.experiments.flux_resonator_spectroscopy
¶
FluxResonatorSpectroscopyAnalysis
¶
Bases: AnalysisBase
Fits qubit frequency vs flux dependency.
Formula: func_flux_bias(phi_sig, freq, anhar, phi, phi_0, d) = (freq - anhar) * sqrt(sqrt(cos^2(pi * (phi + phi_sig) / phi_0) + d^2 * sin^2(pi * (phi + phi_sig) / phi_0))) + anhar
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Dataset containing the experiment data. I,Q variables with flux and frequency dimensions are required. |
required |
freq
|
float
|
Estimated qubit frequency in Hz. |
required |
anhar
|
float
|
Estimated anharmonicity in Hz. |
required |
title
|
str
|
Title of the analysis. |
required |
margin
|
float
|
Margin for the frequency fit in Hz, by default 10e6. |
10000000.0
|
max_frequency_std
|
float
|
Maximum standard deviation of the frequency fit in Hz, by default 3e6. |
1000000.0
|
init_values
|
Dict[str, float]
|
Initial values for the fit parameters, by default {}. |
{}
|
show_fit_plots()
¶
Shows a plot visualizing the sub-fits analysis result.
qruise.experiment.experiments.flux_spectroscopy
¶
FluxSpectroscopyAnalysis
¶
Bases: AnalysisBase
Fits parabola to qubit frequency vs flux dependency.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Dataset containing the experiment data. I,Q variables with flux and frequency dimensions are required. |
required |
freq
|
float
|
Estimated qubit frequency in Hz. |
required |
anhar
|
float
|
Estimated anharmonicity in Hz. |
None
|
title
|
str
|
Title of the analysis. |
required |
sigma
|
float
|
Sigma value for the amplitude 2D filter, by default 1 |
1
|
denoise_tv_chambolle_weight
|
float
|
Weight for the TV Chambolle denoising, by default None (no denoising) |
None
|
init_values
|
Dict[str, float]
|
Deprecated |
{}
|
fit_freq
|
bool
|
Deprecated, by default False |
True
|
fit_anhar
|
bool
|
Deprecated, by default False |
False
|
qruise.experiment.experiments.full_sweep_resonators
¶
FullSweepResSpecAnalysis
¶
Bases: AnalysisBase
Analysis of full sweep resonator spectroscopy data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
the experiment data, containing the I,Q and lo_frequency |
required |
title
|
str
|
Title of the plot |
required |
number_peaks
|
int
|
number of peaks to find |
required |
filter_sigma
|
float
|
sigma for gaussian filter, by default None |
None
|
window
|
float
|
window size in Hz, by default 10e6 |
10000000.0
|
goodness_threshold
|
float
|
goodness of fit threshold, by default goodness_threshold_default |
goodness_threshold_default
|
lo_margin
|
float
|
Ignore peaks around LO frequency, by default None |
None
|
print_summary()
¶
Prints the analysis summary.
fit_individual_peak(data, index, window_size, max_frequency_std=2000000.0, goodness_threshold=goodness_threshold_default, min_amp=1e-05)
¶
Fitting individual peaks to Fano line function in the full sweep resonator spectroscopy data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
DataArray
|
measured signal amplitude, rotated to the real axis to maximize contrast |
required |
index
|
int
|
The index of the center of the peak to fit. |
required |
window_size
|
int
|
initial guess around the resonance in terms of number of frequency points |
required |
Returns:
Type | Description |
---|---|
DataArray
|
the goodness of fit R2 of the Fano line function to the data for the given peak |
qruise.experiment.experiments.ping_pong
¶
PingPongAnalysis
¶
Bases: AnalysisBase
Analysis ping pong experiment for x90 amplitude.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. |
required |
data
|
Dataset
|
counts of 0 state for each pulse amplitude and number of pi/2 pulses |
required |
fit_result
|
ModelResult
|
lmfit sinusoidal model used for ping pong fit |
required |
old_value
|
Optional[float]
|
original x90 amplitude |
required |
value
|
Optional[float]
|
optimal x90 amplitude found by the analysis |
required |
max_chi_squared
|
float
|
Maximal chi-squared value to consider the analysis a success, by default :const: |
MAX_CHI_SQUARED
|
angle_per_gate
|
float
|
Angle per gate, by default np.pi / 2 |
pi / 2
|
initial_phase
|
float
|
Initial angle, by default 0 |
required |
excited_state
|
int
|
Excited state to count; only need to change for 12 ping-pong, by default 1 |
1
|
lower_state
|
int
|
Lower state of oscillations; by default excited_state - 1 |
None
|
qruise.experiment.experiments.pulsed_spectroscopy
¶
PulsedSpectroscopyAnalysis
¶
Bases: AnalysisBase
Analyses a resonator spectroscopy experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. |
required |
data
|
Dataset
|
Experiment data with additional analysis data. I, Q, amplitude, phase, fit. |
required |
min
|
float
|
Minimum frequency of the sweep. |
required |
max
|
float
|
Maximum frequency of the sweep. |
required |
old_value
|
Optional[float]
|
Old resonator frequency (from previous analysis). |
required |
value
|
Optional[float]
|
New resonator frequency (from analysis). |
required |
std
|
Optional[float]
|
Standard deviation of the new resonator frequency. |
required |
error
|
Optional[Exception]
|
Error message if analysis failed. |
required |
margin
|
Optional[float]
|
Margin to the scan window edge. Do not accept fits too close to the edge. |
0
|
sigma
|
Optional[float]
|
Sigma for the gaussian filter, in samples. |
None
|
max_rel_amp_error
|
float
|
Maximal relative amplitude error, default = 0.3 (30%) |
0.3
|
max_freq_error
|
float
|
Maximal frequency error, default = 2e6 (2 MHz) |
2000000.0
|
print_summary()
¶
Prints the analysis summary.
fit_Spectroscopy(data)
¶
Fit a Lorentzian to a spectroscopy trace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
DataArray
|
1D Spectroscopy trace with frequency sweep on the first dimension. |
required |
Returns:
Type | Description |
---|---|
Tuple[ndarray, ndarray]
|
fit parameters and covariance matrix |
qruise.experiment.experiments.punch_out
¶
PunchOutAnalysis
¶
Bases: AnalysisBase
Analysis of a sweep of experiments for readout parameters. Looks for resonator frequency shift between lowest and highest readout power.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
qubit_index
|
int
|
Deprecated, use qubit instead. The index of the qubit on which measurement was performed, by default None |
None
|
pulse_amplitude_coordinate
|
str
|
The name of the readout amplitude coordinate, by default "amplitude_dBm", can be Volt or dBm, identified by units of the coordinate. With volt units, heat map is plotted with logarithmic scale. |
required |
pulse_frequency_coordinate
|
str
|
The name of the readout frequency coordinate, by default "frequency" |
required |
qubit
|
BackendQubit
|
The qubit object, by default None |
None
|
min_amp
|
float
|
The minimum amplitude of the resonance dip fit to accept as valid one, by default 1e-2 |
0.01
|
max_rel_amp_std
|
float
|
The maximum relative amplitude standard deviation to accept as valid fit, by default 0.05 |
0.1
|
max_rel_freq_std
|
float
|
The maximum relative frequency standard deviation to accept as valid fit, by default 1e5 (100 kHz) |
100000.0
|
min_shift
|
float
|
The minimum frequency shift between lowest and highest readout power to accept as valid one, by default 50e3 (50 kHz) |
50000.0
|
print_summary()
¶
Prints the analysis summary.
qruise.experiment.experiments.rabi_chevron
¶
RabiChevronAmplitudeAnalysis
¶
Bases: AnalysisBase
Amplitude rabi experiment analysis class.
Analyzes a Rabi oscillation on pulse amplitude and pulse frequency variation.
The analysis is based on the following steps:
- Project the IQ data to the amplitude axis to maximize the contrast.
- Select the frequencies with amplitude above a threshold factor of the maximum amplitude.
- Fit the decayed oscillation model to the selected frequencies to identify oscillation rate and amplitude.
- Cluster the oscillation.
- Select the cluster with the highest fitted oscillation rate.
- Estimate the qubit frequency and pi-pulse amplitude as median of values in the selected cluster.
- Fit the Rabi oscillation model fixing estimated pi-pulse amplitude using the limited frequency range (spectroscopy-like), repeat if the estimated frequency is not in the middle.
- Fit the Rabi oscillation model fixing frequency to estimate the pi-pulse amplitude.
- Fit the Rabi oscillation model to a limited frequency range around the estimated frequency to found other parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
The experiment data. |
required |
title
|
str
|
The title of the analysis. |
required |
old_frequency
|
float
|
The old value of the qubit frequency, by default None. |
None
|
old_amplitude_pi
|
float
|
The old value of the pi-pulse amplitude, by default None. |
None
|
frequency_dim
|
str
|
The frequency dimension name, by default "frequency". |
'frequency'
|
amplitude_dim
|
str
|
The amplitude dimension name, by default "amplitude". |
'amplitude'
|
max_frequency_error
|
float
|
The maximum frequency error, by default 2e6. |
2000000.0
|
threshold_factor_variation
|
The threshold factor for detecting oscillations. Defines the ration of the minimal of signal variation at specific frequency to the maximal frequency variation is by default 0.7. |
0.7
|
|
fit_window
|
float
|
The fit frequency range where to apply final fit, by default 2e7 (GHz). |
30000000.0
|
frequency_scale
|
float
|
The frequency defines a units of instance in frequency space used for oscillation clustering, lower value will make clusters larger, by default 5e-7. by default 1e-6. |
5e-07
|
debug
|
bool
|
If True, debug plots are added, by default False. |
False
|
select_active_frequencies(projected, amplitude_dim, threshold_factor_variation, freq_samples)
¶
Select frequencies with significant signal variation.
Selection is based on the threshold factor of the maximum signal variation. If the number of selected frequencies is larger than freq_samples, a random subset of size freq_samples is selected.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amplitude_dim
|
str
|
The amplitude dimension name. |
required |
threshold_factor_variation
|
float
|
The threshold factor for detecting oscillations. |
required |
freq_samples
|
int
|
The number of selected frequencies. |
required |
projected
|
DataArray
|
The projected data. |
required |
qruise.experiment.experiments.ramsey_chevron
¶
RamseyChevronAnalysis
¶
Bases: AnalysisBase
Ramsey experiment analysis class.
qruise.experiment.experiments.ramsey_spectroscopy
¶
RamseyAnalysis
¶
Bases: AnalysisBase
Ramsey experiment analysis class.
qruise.experiment.experiments.ramsey_spectroscopy_12
¶
RamseyAnalysis12
¶
Bases: AnalysisBase
Ramsey experiment for 1-2 transition analysis class. Assumes the dynamics follow a beat pattern as explained in https://arxiv.org/abs/2211.06531.
qruise.experiment.experiments.randomized_benchmarking_2q
¶
InterleavedRandomizedBenchmarkingAnalysis
¶
Bases: AnalysisBase
Analysis class for interleaved randomized benchmarking experiments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Any
|
The experimental data to be analyzed. |
required |
title
|
str
|
Title of the analysis. |
required |
target_circ
|
QuantumCircuit
|
The target quantum circuit for interleaved benchmarking. |
required |
lengths
|
list
|
Sequence lengths for the randomized benchmarking experiment. |
required |
num_samples
|
int
|
Number of samples for each sequence length. |
required |
composite_discriminator
|
Any
|
Composite discriminator for error mitigation. |
required |
seed
|
int
|
Random seed for reproducibility, by default 0. |
0
|
statevector_shots
|
int
|
Number of shots for the statevector simulator, by default 2**10. |
2 ** 10
|
TwoQubitRandomizedBenchmarkingAnalysis
¶
Bases: AnalysisBase
Analysis class for two-qubit randomized benchmarking experiments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Any
|
The experimental data to be analyzed. |
required |
title
|
str
|
Title of the analysis. |
required |
lengths
|
list
|
Sequence lengths for the randomized benchmarking experiment. |
required |
num_samples
|
int
|
Number of samples for each sequence length. |
required |
composite_discriminator
|
Any
|
Composite discriminator for error mitigation. |
required |
seed
|
int
|
Random seed for reproducibility, by default 0. |
0
|
statevector_shots
|
int
|
Number of shots for the statevector simulator, by default 2**10. |
2 ** 10
|
qruise.experiment.experiments.readout_amplitude
¶
ReadoutAmplitudeAnalysis
¶
Bases: AnalysisBase
Analysis of a sweep of experiments for readout parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. Must have the following variables dimensions : "frequency", "amplitude_dBm", "prepared_state" and shot dimension as picked by :func: |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
old_amp_value
|
Optional[float]
|
old readout amplitude |
required |
minimal_contrast
|
float
|
Minimal contrast value to consider the analysis a success, by default :const: |
required |
minimal_w
|
float
|
Minimal geometry mean Shapiro-Wilk test W value to consider the analysis a success, by default :const: |
MINIMAL_W
|
logx
|
bool
|
Whether to plot the x-axis in logarithmic scale, by default False |
False
|
fit
|
bool
|
Whether to fit a quadratic regression to the data, by default True |
True
|
sigma
|
float
|
Sigma for the gaussian filter, in samples. Only used if fit is False, by default None (no filtering) |
None
|
min_samples
|
float
|
Minimum number of samples to consider for the RANSAC fit, by default 0.95 |
0.97
|
print_summary()
¶
Prints the analysis summary.
calculate_shapiro_wilk(data, shot_dim, amplitude_dim='amplitude_dBm', frequency_dim='frequency')
¶
Calculate the Shapiro-Wilk test for normality of the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dataset
|
Dataset with the data to be tested. Must have the following variables: "I" and "Q" with shot dimension. |
required |
shot_dim
|
str
|
Name of the shot dimension. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Dataset with the Shapiro-Wilk test results . |
qruise.experiment.experiments.readout_contrast
¶
ReadoutContrastAnalysis
¶
Bases: AnalysisBase
Analysis of a sweep of experiments for readout parameters. Looks for the optimal readout frequency and amplitude that maximizes the contrast between the two prepared states.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. Must have the following variables dimensions : "frequency", "amplitude_dBm", "prepared_state" and shot dimension as picked by :func: |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
old_freq_value
|
Optional[float]
|
old readout frequency |
required |
old_amp_value
|
Optional[float]
|
old readout amplitude |
required |
minimal_contrast
|
float
|
Minimal contrast value to consider the analysis a success, by default :const: |
MINIMAL_CONTRAST
|
minimal_w
|
float
|
Minimal geometry mean Shapiro-Wilk test W value to consider the analysis a success, by default :const: |
MINIMAL_W
|
aggregation
|
str
|
Aggregation method for Shapiro-Wilk test W along frequency, can be "min" or "mean" by default "min" |
'mean'
|
print_summary()
¶
Prints the analysis summary.
qruise.experiment.experiments.readout_contrast_frequency
¶
ReadoutContrastVsFrequencyAnalysis
¶
Bases: AnalysisBase
Analysis of a sweep of experiments for readout parameters. Looks for the optimal readout frequency and amplitude that maximizes the contrast between the two prepared states.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. Must have the following variables dimensions : "frequency", "amplitude_dBm", "prepared_state" and shot dimension as picked by :func: |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
old_freq_value
|
Optional[float]
|
old readout frequency |
required |
old_amp_value
|
Optional[float]
|
old readout amplitude |
required |
minimal_contrast
|
float
|
Minimal contrast value to consider the analysis a success, by default :const: |
MINIMAL_CONTRAST
|
print_summary()
¶
Prints the analysis summary.
qruise.experiment.experiments.readout_contrast_x180amp
¶
ReadoutContrastAnalysis180amp
¶
Bases: AnalysisBase
Analysis of readout contrast with respect to x180 amplitude and readout power.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
old_x180amp_value
|
Optional[float]
|
Old x180 amplitude. |
required |
old_amp_value
|
Optional[float]
|
Old readout amplitude. |
required |
minimal_contrast
|
float
|
Minimal contrast value to consider the analysis a success (default is MINIMAL_CONTRAST). |
MINIMAL_CONTRAST
|
minimal_w
|
float
|
Minimal geometric mean Shapiro-Wilk test W value to consider the analysis a success (default is MINIMAL_W). |
MINIMAL_W
|
print_summary()
¶
Prints the analysis summary.
prob_cond(iq, prepared_states, all_states)
¶
Calculate the average fidelity by computing the conditional probability of the prepared states.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iq
|
ndarray
|
The input quantum states. |
required |
prepared_state
|
ndarray
|
An array of prepared quantum states. |
required |
all_states
|
list
|
A list of all possible quantum states. |
required |
Returns:
Name | Type | Description |
---|---|---|
av_fidelity |
float
|
The average fidelity of the discriminator's predictions for 'iq': av_F = (P[1/1] + P[0/0]) / 2. |
readout_cond_prob_analysis(experiment_data)
¶
This function takes an xarray Dataset 'experiment_data' and calculates the average fidelity (F) for each combination of "amplitude_dBm" and "x180_amplitude."
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
An xarray Dataset containing experimental data with the following variables : amplitude_dBm, x180_amplitude, prepared_state, I, Q |
required |
Returns:
Name | Type | Description |
---|---|---|
F_array |
ndarray
|
A 2D numpy array containing average fidelities for each combination of "amplitude_dBm" and "x180_amplitude." |
qruise.experiment.experiments.readout_discriminator
¶
ReadoutOneStateDiscriminationAnalysis
¶
Bases: AnalysisBase
Analyses a IQ data for readout discrimination.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data of single shots in iq plane. oll |
required |
title
|
str
|
Title of the analysis. |
required |
dim_prepared_state
|
str
|
Dimension name of the prepared state, by default "prepared_state" |
required |
train_discriminator
|
callable | str | None
|
Function to train the discriminator, by default None |
None
|
print_summary()
¶
Prints the analysis summary.
generate_pairs(lst)
¶
Generate pairs of adjacent elements from a list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lst
|
list
|
A list of prepared states. |
required |
Returns:
Name | Type | Description |
---|---|---|
pairs |
list of tuple
|
A list of tuples representing pairs of adjacent elements from the input list. |
histogram(experiment_data, pairs, prepared_state_dim)
¶
Identifies the axis x_ij
connecting the centroids of the IQ plots for a pair of states (i, j)
and computes the probability density function (PDF) pdf_ij
along x_ij
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
ExperimentData
|
Data containing I and Q components. |
required |
pairs
|
list of tuple
|
List of state pairs (i, j). |
required |
prepared_state_dim
|
str
|
Dimension name of the prepared state. |
required |
Returns:
Name | Type | Description |
---|---|---|
data |
dict
|
A dictionary containing PDFs for each state pair. |
qruise.experiment.experiments.resonator_spectroscopy
¶
ResonatorSpectroscopyAnalysis
¶
Bases: AnalysisBase
Analyze a resonator spectroscopy experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. Should have 1 dimension (assumed to be frequency) contain I and Q variables (float) containing measurements on I and Q channels. |
required |
title
|
str
|
Experiment title. Used as a plot title |
required |
old_value
|
Optional[float]
|
Old resonator frequency (from previous analysis) |
None
|
margin
|
float
|
Margin (Hz) to the sweep area to consider the analysis successful, by default 5% of the sweep range |
None
|
max_frequency_std
|
float
|
Maximum frequency standard deviation to consider the analysis successful, by default 3e6 (3 MHz) |
3000000.0
|
min_amp
|
float
|
Minimum amplitude to consider the analysis successful, by default 1e-6 |
1e-06
|
max_width
|
float
|
Maximum width of the resonance to consider the analysis successful, by default 20 * max_frequency_std |
None
|
width
|
float
|
Initial guess for the width of the resonance, by default 1e6 (1 MHz) |
5000000.0
|
fit_window
|
float | tuple[float, float]
|
Fit window around the minimum of the amplitude to fit the resonance, by default None (all data) |
None
|
debug
|
bool
|
Print debug information, by default False |
False
|
print_summary()
¶
Prints the analysis summary.
estimate_spectroscopy_parameters(frequency, amplitude, f0=None, amp=None, off=None)
¶
Estimate spectroscopy parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frequency
|
ndarray
|
Frequency array (Hz) |
required |
amplitude
|
ndarray
|
Amplitude array (a.u.) |
required |
f0
|
float
|
Initial guess for the resonance frequency |
None
|
amp
|
float
|
Initial guess for the amplitude |
None
|
off
|
float
|
Initial guess for the background signal |
None
|
Returns:
Type | Description |
---|---|
f0_estimate, amplitude_estimate, off : Tuple[float, float, float]
|
Estimated resonance frequency, amplitude and background. |
resonance_IQ(f, f0, width, amp, off=0, slope=0.0, phase=0.0, delay=0.0, freq_ref=0.0, fano=0.0, slope_dispersion=DEFAULT_SLOPE_DISPERSION)
¶
Models a Fano resonance response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
array_like
|
Frequency array (Hz) |
required |
qruise.experiment.experiments.t1
¶
T1Analysis
¶
Bases: AnalysisBase
T1 experiment analysis class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
t1_value
|
float | None
|
Previous T1 value for comparison. |
required |
sigma
|
float | None
|
Sigma value for filtering the data. If None, no filtering is applied. |
None
|
print_summary()
¶
Prints the analysis summary.
qruise.experiment.experiments.t2_cpmg
¶
T2CPMGAnalysis
¶
Bases: AnalysisBase
T2CPMG experiment analysis class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
contains the decay function and the standard deviation |
required |
title
|
str
|
experiment title |
required |
t2_value
|
float
|
current T2 value |
required |
t1_value
|
float
|
T1 value |
required |
x180_duration
|
float
|
duration of the pi pulse |
required |
max_pi_pulses
|
int
|
maximum number of pi pulses |
required |
measurment_method
|
str
|
measurment method: pulse_number_sweep or delay_sweep |
None
|
func_cpmg_decay(x, theta, alpha, T1, Tp, tp, off=0.0, amp=1.0)
¶
Calculate the decay function for a CPMG (Carr-Purcell-Meiboom-Gill) sequence [Nature Physics volume 7, pages565–570 (2011)]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
float
|
Independent variable. |
required |
theta
|
float
|
Time constant of the pure dephasing decay. |
required |
alpha
|
float
|
Parameter controlling the shape of the pure dephasing decay. |
required |
T1
|
float
|
Longitudinal relaxation time constant. |
required |
Tp
|
float
|
Decay time during the pulses. |
required |
tp
|
float
|
Total pulse length |
required |
off
|
float
|
Offset parameter. Default is 0.0. |
0.0
|
amp
|
float
|
Amplitude parameter. Default is 1.0. |
1.0
|
Returns:
Type | Description |
---|---|
float
|
The value of the decay function at the given independent variable. |
qruise.experiment.experiments.t2_echo
¶
qruise.experiment.experiments.t2star_ramsey
¶
T2StarCoherence
¶
Bases: AnalysisBase
T2* from a Ramsey sequence using Quantum Process Tomography.
qruise.experiment.experiments.time_of_flight
¶
TimeOfFlightAnalysis
¶
Bases: AnalysisBase
Performs Time of flight analysis.
Fits as step function to the smoothed amplitude data to estimate the time of flight.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
The experiment data, containing the time (s) and I/Q (a.u.) readout data. The time of flight value set in experiment is in "time_of_flight" variable. |
required |
title
|
str
|
The title of the analysis.Used to set the title of the data. |
required |
old_value
|
float | None
|
The old value of the time of flight, by default None |
None
|
old_unit
|
Optional[str]
|
The old unit of the time of flight, by default None |
None
|
quantize
|
float | None
|
The quantize value for the time of flight, by default 4e-9 (4 ns) |
4e-09
|
sigma
|
float | None
|
The smoothing sigma 32e-9 (32 ns) |
required |
time_of_flight_ansatz
|
float | None
|
The initial guess for the time of flight, by default 200e-9 (200 ns) |
2e-07
|
max_time_of_flight
|
float | None
|
The maximum value for the time of flight, by default 300e-9 (300 ns) |
3.5e-07
|
min_time_of_flight
|
float | None
|
The minimum value for the time of flight, by default 200e-9 (200 ns) |
2e-07
|
qruise.experiment.experiments.x180_resonator_spectroscopy
¶
ResFreqShiftAnalysis
¶
Bases: AnalysisBase
Looks for resonator frequency shift between two x180_amplitude yielding largest freq shift.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
Dataset
|
Experiment data. |
required |
title
|
str
|
Title of the experiment, used for the plot title. |
required |
qubit_index
|
int
|
The index of the qubit on which measurement was performed |
None
|
qruise.experiment.experiments.zz_coupling
¶
ZZCouplingAnalysis
¶
Bases: AnalysisBase
Perform ZZ Coupling Analysis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
DataArray
|
Experimental data. |
required |
title
|
str
|
Title for the analysis. |
required |
sigma
|
float
|
Standard deviation. |
None
|
qruise.experiment.experiments.zz_coupling_coupler_flux
¶
ZZCouplingCouplerFluxAnalysis
¶
Bases: AnalysisBase
Perform ZZ Coupling Analysis as a function of coupler flux.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_data
|
DataArray
|
Experimental data. |
required |
title
|
str
|
Title for the analysis. |
required |
sigma
|
float
|
Standard deviation. |
None
|
flux_traces
|
list of str
|
List of flux traces. |
None
|