# OscillationAnalysis¶

class OscillationAnalysis(name=None)[source]

Oscillation analysis class based on a fit of the data to a cosine function.

Fit Model

This is the curve fitting analysis. The following equation(s) are used to represent curve(s).

Analyse oscillating data by fitting it to a cosine function

$y = {\rm amp} \cos\left(2 \pi\cdot {\rm freq}\cdot x + {\rm phase}\right) + {\rm base}$

Fit Parameters

The following fit parameters are estimated during the analysis.

Descriptions
• $$\rm amp$$: Amplitude of the oscillation.

• $$\rm base$$: Base line.

• $$\rm freq$$: Frequency of the oscillation. This is the fit parameter of interest.

• $$\rm phase$$: Phase of the oscillation.

Initial Guess
Boundaries
• $$\rm amp$$: [-2, 2] scaled to the maximum signal value.

• $$\rm base$$: [-1, 1] scaled to the maximum signal value.

• $$\rm freq$$: [0, inf].

• $$\rm phase$$: [-pi, pi].

Run Options

These are the keyword arguments of run() method.

Parameters:
• curve_drawer (BaseCurveDrawer) – A curve drawer instance to visualize the analysis result.

• plot_raw_data (bool) – Set True to draw processed data points, dataset without formatting, on canvas. This is False by default.

• plot (bool) – Set True to create figure for fit result. This is True by default.

• return_fit_parameters (bool) – Set True to return all fit model parameters with details of the fit outcome. Default to True.

• return_data_points (bool) – Set True to include in the analysis result the formatted data points given to the fitter. Default to False.

• data_processor (Callable) – A callback function to format experiment data. This can be a DataProcessor instance that defines the self.__call__ method.

• normalization (bool) – Set True to normalize y values within range [-1, 1]. Default to False.

• p0 (Dict[str, float]) – Initial guesses for the fit parameters. The dictionary is keyed on the fit parameter names.

• bounds (Dict[str, Tuple[float, float]]) – 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) – Fit method that LMFIT minimizer uses. Default to least_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]) – Options that are passed to the LMFIT minimizer. Acceptable options depend on fit_method.

• x_key (str) – Circuit metadata key representing a scanned value.

• result_parameters (List[Union[str, ParameterRepr]) – 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]) – A dictionary that is appended to all database entries as extra information.

• fixed_parameters (Dict[str, Any]) – 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]) – 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.

Attributes

 OscillationAnalysis.drawer A short-cut for curve drawer instance. OscillationAnalysis.models Return fit models. OscillationAnalysis.name Return name of this analysis. OscillationAnalysis.options Return the analysis options for run() method. OscillationAnalysis.parameters Return parameters of this curve analysis.

Methods

 Return the config dataclass for this analysis Return a copy of the analysis Initialize an analysis class from analysis config OscillationAnalysis.run(experiment_data[, ...]) Run analysis and update ExperimentData with analysis result. Set the analysis options for run() method.