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.
CompositeCurveAnalysis¶
- class CompositeCurveAnalysis(analyses, name=None)[source]¶
Composite Curve Analysis.
The
CompositeCurveAnalysis
takes multiple curve analysis instances and performs each analysis on the same experimental results. These analyses are performed independently, thus fit parameters have no correlation. Note that this is different fromCompositeAnalysis
which analyses the outcome of a composite experiment, in which multiple different experiments are performed. TheCompositeCurveAnalysis
is attached to a single experiment instance, which may execute similar circuits with slightly different settings. Experiments with different settings might be distinguished by the circuit metadata. The outcomes of the same set of experiments are assigned to a specific analysis instance in the composite curve analysis. This mapping is usually done with the analysis optionfilter_data
dictionary. Otherwise, all analyses are performed on the same set of outcomes.Examples
In this example, we write up a composite analysis consisting of two oscillation analysis instances, assuming two Rabi experiments in 1-2 subspace starting with different initial states
. This is a typical procedure to measure the thermal population of the qubit.from qiskit_experiments import curve_analysis as curve analyses = [] for qi in (0, 1): analysis = curve.OscillationAnalysis(name=f"init{qi}") analysis.set_options( return_fit_parameters=["freq"], filter_data={"init_state": qi}, ) analysis = CompositeCurveAnalysis(analyses=analyses)
This
analysis
will return two analysis result data for the fit parameter “freq” for experiments with the initial state and . The experimental circuits starting with different initial states must be distinguished by the circuit metadata{"init_state": 0}
or{"init_state": 1}
, along with the “xval” in the same dictionary. If you want to compute another quantity using two fitting outcomes, you can overrideCompositeCurveAnalysis._create_curve_data()
in subclass.CompositeCurveAnalysis
subclass may override following methods._evaluate_quality
This method evaluates the quality of the composite fit based on the all analysis outcomes. This returns “good” when all fit outcomes are evaluated as “good”, otherwise it returns “bad”.
_create_analysis_results
This method is passed all the group fit outcomes and can return a list of new values to be stored in the analysis results.
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 of this curve analysis.
A short-cut to the plotter instance.
Methods
CompositeCurveAnalysis.analyses
([index])Return curve analysis instance.
Return the config dataclass for this analysis
Return a copy of the analysis
Initialize an analysis class from analysis config
CompositeCurveAnalysis.run
(experiment_data)Run analysis and update ExperimentData with analysis result.
CompositeCurveAnalysis.set_options
(**fields)Set the analysis options for
run()
method.