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.
BaseCurveAnalysis¶
- class BaseCurveAnalysis[source]¶
Abstract superclass of curve analysis base classes.
Note that this class doesn’t define the
_run_analysis()
method, and no actual fitting protocol is implemented in this base class. However, this class defines several common methods that can be reused. A curve analysis subclass can construct proper fitting protocol by combining following methods, i.e. subroutines. See Curve Analysis workflow for how these subroutines are called.Subclass must implement following methods.
_run_data_processing
This method performs data processing and returns the processed dataset. Input data is a list of dictionaries, where each entry represents an outcome of circuit sampling along with the metadata attached to it.
_format_data
This method consumes the processed dataset and outputs the formatted dataset. For example, this may include averaging Y values over the same X data points.
_run_curve_fit
This method performs the fitting with the predefined fit models and the formatted dataset. This is a core functionality of the
_run_analysis()
method that creates fit result objects from the formatted dataset.Optionally, a subclass may override following methods. These methods have default implementations as described below.
_evaluate_quality
This method evaluates the quality of the fit based on the fit result. This returns “good” when reduced chi-squared is less than 3.0. Usually it returns string “good” or “bad” according to the evaluation. This criterion can be updated by subclass.
_run_curve_fit
This method performs the fitting with predefined fit models and the formatted dataset. This method internally calls
_generate_fit_guesses()
method. Note that this is a core functionality of the_run_analysis()
method, that creates fit result object from the formatted dataset._create_analysis_results
This method creates analysis results for important fit parameters that might be defined by analysis options
result_parameters
._create_curve_data
This method to creates analysis results for the formatted dataset, i.e. data used for the fitting. Entries are created when the analysis option
return_data_points
isTrue
. If analysis consists of multiple series, analysis result is created for each curve data in the series definitions._initialize
This method initializes analysis options against input experiment data. Usually this method is called before other methods are called.
Initialize the analysis object.
Attributes
A short-cut for curve drawer instance, if set.
Return fit models.
Return name of this analysis.
Return the analysis options for
run()
method.Return parameters estimated by this analysis.
A short-cut to the curve plotter instance.
Methods
Return the config dataclass for this analysis
Return a copy of the analysis
BaseCurveAnalysis.from_config
(config)Initialize an analysis class from analysis config
BaseCurveAnalysis.run
(experiment_data[, ...])Run analysis and update ExperimentData with analysis result.
BaseCurveAnalysis.set_options
(**fields)Set the analysis options for
run()
method.