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.
BlochTrajectoryAnalysis¶
- class BlochTrajectoryAnalysis(name=None)[source]¶
A class to analyze a trajectory of the Bloch vector of a single qubit.
Fit model
This is the curve fitting analysis. The following equation(s) are used to represent curve(s).
The following equations are used to approximate the dynamics of the qubit Bloch vector.
where
with is pulse duration to scan and is an extra fit parameter that may represent an edge effect. Note that this analysis assumes a microwave drive with the flat top Gaussian envelope, where the amplitude of edges, namely Hamiltonian coefficients of interest, is time dependent and smaller than the flat top part. The edge effect indicates the total net interaction that might be induced by the comparable square drive pulse of duration , which is usually smaller than the actual edge durations. are fit parameters, and . The fit functions approximate the Pauli expectation values of the target qubit, respectively.In this analysis, the initial guess is generated by the following equations.
where
is the mean oscillation frequency of eigenvalues, and .Fit parameters
The following fit parameters are estimated during the analysis.
- Descriptions
: Offset to the pulse duration. For example, if pulse envelope is a flat-topped Gaussian, two Gaussian edges may become an offset duration. : Fit parameter of oscillations of the X observable. : Fit parameter of oscillations of the Y observable. : Fit parameter of oscillations of the Z observable. : Vertical offset of oscillations. This may indicate the state preparation and measurement error.
- Initial Guess
: Computed as where the is number of pulses and is Gaussian sigma of rising and falling edges. Note that this implicitly assumes theGaussianSquare
pulse envelope. : See fit model section. : See fit model section. : See fit model section. : 0
- Boundaries
: [0, None] : None : None : None : None
Analysis options
These are the keyword arguments of
run()
method.- Options
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 (bool)
Default value:True
SetTrue
to create figure for fit result. This isTrue
by default.return_fit_parameters (bool)
Default value:True
SetTrue
to return all fit model parameters with details of the fit outcome. Default toTrue
.return_data_points (bool)
Default value:False
SetTrue
to include in the analysis result the formatted data points given to the fitter. Default toFalse
.data_processor (Callable)
Default value: Instance ofDataProcessor
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 (str)
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.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: {"x"
: ("x"
, {"meas_basis"
: ("meas_basis"
,"x"
)}),"y"
: ("y"
, {"meas_basis"
: ("meas_basis"
,"y"
)}),"z"
: ("z"
, {"meas_basis"
: ("meas_basis"
,"z"
)})}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
Superclass
qiskit_experiments.curve_analysis.curve_analysis.CurveAnalysis
Superclass
qiskit_experiments.curve_analysis.base_curve_analysis.BaseCurveAnalysis
Initialization
Initialize data fields that are privately accessed by methods.
- Parameters:
models – List of LMFIT
Model
class to define fitting functions and parameters. If multiple models are provided, the analysis performs multi-objective optimization where the parameters with the same name are shared among provided models. When multiple models are provided, user must specify thedata_subfit_map
value in the analysis options to allocate experimental results to a particular fit model.name (
Optional
[str
]) – Optional. Name of this analysis.
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 curve plotter instance.
Methods
Return the config dataclass for this analysis
Return a copy of the analysis
Initialize an analysis class from analysis config
BlochTrajectoryAnalysis.run
(experiment_data)Run analysis and update ExperimentData with analysis result.
BlochTrajectoryAnalysis.set_options
(**fields)Set the analysis options for
run()
method.