Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
StarkRamseyXYAmpScanAnalysis¶
- class StarkRamseyXYAmpScanAnalysis[source]¶
Ramsey XY analysis for the Stark shifted phase sweep.
Overview
This analysis is a variant of
RamseyXYAnalysis
. In both cases, the X and Y data are treated as the real and imaginary parts of a complex oscillating signal. InRamseyXYAnalysis
, the data are fit assuming a phase varying linearly with the x-data corresponding to a constant frequency and assuming an exponentially decaying amplitude. By contrast, in this model, the phase is assumed to be a third order polynomial \(\theta(x)\) of the x-data. Additionally, the amplitude is not assumed to follow a specific form. Techniques to compute a good initial guess for the polynomial coefficients inside a trigonometric function like this are not trivial. Instead, this analysis extracts the raw phase and runs fits on the extracted data to a polynomial \(\theta(x)\) directly.The measured P1 values for a Ramsey X and Y experiment can be written in the form of a trignometric function taking the phase polynomial \(\theta(x)\):
\[\begin{split}P_X = \text{amp}(x) \cdot \cos \theta(x) + \text{offset},\\ P_Y = \text{amp}(x) \cdot \sin \theta(x) + \text{offset}.\end{split}\]Hence the phase polynomial can be extracted as follows
\[\theta(x) = \tan^{-1} \frac{P_Y}{P_X}.\]Because the arctangent is implemented by the
atan2
function defined in \([-\pi, \pi]\), the computed \(\theta(x)\) is unwrapped to ensure continuous phase evolution.We call attention to the fact that \(\text{amp}(x)\) is also Stark tone amplitude dependent because of the qubit frequency dependence of the dephasing rate. In general \(\text{amp}(x)\) is unpredictable due to dephasing from two-level systems distributed randomly in frequency or potentially due to qubit heating. This prevents us from precisely fitting the raw \(P_X\), \(P_Y\) data. Fitting only the phase data makes the analysis robust to amplitude dependent dephasing.
In this analysis, the phase polynomial is defined as
\[\theta(x) = 2 \pi t_S f_S(x)\]where
\[f_S(x) = c_1 x + c_2 x^2 + c_3 x^3 + f_{\rm err},\]denotes the Stark shift. For the lowest order perturbative expansion of a single driven qubit, the Stark shift is a quadratic function of \(x\), but linear and cubic terms and a constant offset are also considered to account for other effects, e.g. strong drive, collisions, TLS, and so forth, and frequency mis-calibration, respectively.
Fit model
This is the curve fitting analysis. The following equation(s) are used to represent curve(s).
\[\theta^\nu(x) = c_1^\nu x + c_2^\nu x^2 + c_3^\nu x^3 + f_{\rm err},\]where \(\nu \in \{+, -\}\). The Stark shift is asymmetric with respect to \(x=0\), because of the anti-crossings of higher energy levels. In a typical transmon qubit, these levels appear only in \(f_S < 0\) because of the negative anharmonicity. To precisely fit the results, this analysis uses different model parameters for positive (\(x > 0\)) and negative (\(x < 0\)) shift domains.
Fit parameters
The following fit parameters are estimated during the analysis.
- Descriptions
\(c_1^+\): The linear term coefficient of the positive Stark shift (fit parameter:
stark_pos_coef_o1
).\(c_2^+\): The quadratic term coefficient of the positive Stark shift. This parameter must be positive because Stark amplitude is chosen to induce blue shift when its sign is positive. Note that the quadratic term is the primary term (fit parameter:
stark_pos_coef_o2
).\(c_3^+\): The cubic term coefficient of the positive Stark shift (fit parameter:
stark_pos_coef_o3
).\(c_1^-\): The linear term coefficient of the negative Stark shift. (fit parameter:
stark_neg_coef_o1
).\(c_2^-\): The quadratic term coefficient of the negative Stark shift. This parameter must be negative because Stark amplitude is chosen to induce red shift when its sign is negative. Note that the quadratic term is the primary term (fit parameter:
stark_neg_coef_o2
).\(c_3^-\): The cubic term coefficient of the negative Stark shift (fit parameter:
stark_neg_coef_o3
).\(f_{\rm err}\): Constant phase accumulation which is independent of the Stark tone amplitude. (fit parameter:
stark_ferr
).
- Initial Guess
\(c_1^+\): 0.
\(c_2^+\): 1e6.
\(c_3^+\): 0.
\(c_1^-\): 0.
\(c_2^-\): -1e6.
\(c_3^-\): 0.
\(f_{\rm err}\): 0
- Boundaries
\(c_1^+\): None
\(c_2^+\): [0, inf]
\(c_3^+\): None
\(c_1^-\): None
\(c_2^-\): [-inf, 0]
\(c_3^-\): None
\(f_{\rm err}\): None
Analysis options
These are the keyword arguments of the
run()
method.- Options
Defined in the class
StarkRamseyXYAmpScanAnalysis
:pulse_len (float)
Default value:None
Duration of effective Stark pulse in units of sec.
Defined in the class
BaseCurveAnalysis
:plotter (BasePlotter)
Default value: Instance ofCurvePlotter
A curve plotter instance to visualize the analysis result.plot_raw_data (bool)
Default value:False
SetTrue
to draw processed data points, dataset without formatting, on canvas. This isFalse
by default.plot_residuals (bool)
Default value:False
SetTrue
to draw the residuals data for the fitting model. This isFalse
by default.return_fit_parameters (bool)
Default value:True
(Deprecated) SetTrue
to return all fit model parameters with details of the fit outcome. Default toFalse
.data_processor (Callable)
Default value:None
A callback function to format experiment data. This can be aDataProcessor
instance that defines the self.__call__ method.normalization (bool)
Default value:False
SetTrue
to normalize y values within range [-1, 1]. Default toFalse
.average_method (Literal[“sample”, “iwv”, “shots_weighted”])
Default value:"shots_weighted"
Method to average the y values when the same x values appear multiple times. One of “sample”, “iwv” (i.e. inverse weighted variance), “shots_weighted”. Seemean_xy_data()
for details. Default to “shots_weighted”.p0 (Dict[str, float])
Default value: {}Initial guesses for the fit parameters. The dictionary is keyed on the fit parameter names.bounds (Dict[str, Tuple[float, float]])
Default value: {}Boundary of fit parameters. The dictionary is keyed on the fit parameter names and values are the tuples of (min, max) of each parameter.fit_method (str)
Default value:"least_squares"
Fit method that LMFIT minimizer uses. Default toleast_squares
method which implements the Trust Region Reflective algorithm to solve the minimization problem. See LMFIT documentation for available options.lmfit_options (Dict[str, Any])
Default value: {}Options that are passed to the LMFIT minimizer. Acceptable options depend on fit_method.x_key (str)
Default value:"xval"
Circuit metadata key representing a scanned value.fit_category (str)
Default value:"freq"
Name of dataset in the scatter table to fit.result_parameters (List[Union[str, ParameterRepr])
Default value: []Parameters reported in the database as a dedicated entry. This is a list of parameter representation which is either string or ParameterRepr object. If you provide more information other than name, you can specify[ParameterRepr("alpha", "α", "a.u.")]
for example. The parameter name should be defined in the series definition. Representation should be printable in standard output, i.e. no latex syntax.extra (Dict[str, Any])
Default value: {}A dictionary that is appended to all database entries as extra information.fixed_parameters (Dict[str, Any])
Default value: {}Fitting model parameters that are fixed during the curve fitting. This should be provided with default value keyed on one of the parameter names in the series definition.filter_data (Dict[str, Any])
Default value: {}Dictionary of experiment data metadata to filter. Experiment outcomes with metadata that matches with this dictionary are used in the analysis. If not specified, all experiment data are input to the curve fitter. By default, no filtering condition is set.data_subfit_map (Dict[str, Dict[str, Any]])
Default value: {"Xpos"
: ("Xpos"
, {"series"
: ("series"
,"X"
),"direction"
: ("direction"
,"pos"
)}),"Ypos"
: ("Ypos"
, {"series"
: ("series"
,"Y"
),"direction"
: ("direction"
,"pos"
)}),"Xneg"
: ("Xneg"
, {"series"
: ("series"
,"X"
),"direction"
: ("direction"
,"neg"
)}),"Yneg"
: ("Yneg"
, {"series"
: ("series"
,"Y"
),"direction"
: ("direction"
,"neg"
)})}The mapping of experiment result data to sub-fit models. This dictionary is keyed on the LMFIT model name, and the value is a sorting key-value pair that filters the experiment results, and the filtering is done based on the circuit metadata.
Defined in the class
BaseAnalysis
:figure_names (str or List[str])
Default value:None
Identifier of figures that appear in the experiment data to sort figures by name.
See also
qiskit_experiments.library.characterization.analysis.ramsey_xy_analysis.RamseyXYAnalysis
Initialization
Deprecated since version 0.8: The class
qiskit_experiments.library.driven_freq_tuning.ramsey_amp_scan_analysis.StarkRamseyXYAmpScanAnalysis
is deprecated as of qiskit-experiments 0.8. It will be removed no earlier than 3 months after the release date. Due to the deprecation of Qiskit Pulse, experiments and related classses involving pulse gate calibrations like this one have been deprecated.Attributes
- models¶
Return fit models.
- name¶
Return name of this analysis.
- parameters¶
Return parameters of this curve analysis.
- plotter¶
A short-cut to the curve plotter instance.
Methods
- config()¶
Return the config dataclass for this analysis
- Return type:
- copy()¶
Return a copy of the analysis
- Return type:
- classmethod from_config(config)¶
Initialize an analysis class from analysis config
- Return type:
- model_names()¶
Return model names.
- Return type:
List[str]
- run(experiment_data, replace_results=False, **options)¶
Run analysis and update ExperimentData with analysis result.
- Parameters:
experiment_data (ExperimentData) – the experiment data to analyze.
replace_results (bool) – If True clear any existing analysis results, figures, and artifacts in the experiment data and replace with new results. See note for additional information.
options – additional analysis options. See class documentation for supported options.
- Returns:
An experiment data object containing analysis results, figures, and artifacts.
- Raises:
QiskitError – If experiment_data container is not valid for analysis.
- Return type:
Note
Updating Results
If analysis is run with
replace_results=True
then any analysis results, figures, and artifacts in the experiment data will be cleared and replaced with the new analysis results. Saving this experiment data will replace any previously saved data in a database service using the same experiment ID.If analysis is run with
replace_results=False
and the experiment data being analyzed has already been saved to a database service, or already contains analysis results or figures, a copy with a unique experiment ID will be returned containing only the new analysis results and figures. This data can then be saved as its own experiment to a database service.