Analysis

The analysis subpackage contains objects to process and manipulate experimental data.

keysight.qcs.analysis.BaseFitter

A class for fitting real-valued data.

keysight.qcs.analysis.ComplexFitter

A class for fitting complex-valued data.

keysight.qcs.analysis.ComplexLorentzian

A fitter for a complex Lorentzian.

keysight.qcs.analysis.DecayingSinusoid

A fitter for a decaying sinusoid.

keysight.qcs.analysis.Estimate

Class that stores fit information returned from data analysis.

keysight.qcs.analysis.EstimateCollection

An iterable container of estimates with several convenience functions which make it easier to select specific estimates.

keysight.qcs.analysis.EstimateTuple

A namedtuple container for storing a single estimate name, value, and standard deviation.

keysight.qcs.analysis.Exponential

A fitter for an exponential curve.

keysight.qcs.analysis.IQuadrature

Extracts the I quadrature from complex IQ data.

keysight.qcs.analysis.LinearDetrend

Removes linear trends from experimental data.

keysight.qcs.analysis.Preprocessor

A class that processes experimental data before fitting.

Estimates

class keysight.qcs.analysis.Estimate(names: list[str], values: ndarray, cov: ndarray)

Bases: Serializable

Class that stores fit information returned from data analysis.

Parameters:
  • names – The names of the parameters estimated by the fit.

  • values – The values of the estimates.

  • cov – The covariance matrix of the estimates.

property cov: ndarray

The covariance matrix of this estimate.

property names: list[str]

A list of strings which describe the parameters returned from fitting.

property std: ndarray

A vector of standard deviations for every element of this estimate.

property values: ndarray

A vector containing the estimnated values associated with the provided names.

draw(filename: str = 'qcs_estimate.html', display: bool = True) None

Creates a HTML representation of this Estimate and saves it to a file.

Parameters:
  • filename – The filename to write the HTML to (if executing in a script)

  • display – Whether to display the HTML. When set to False, this will only save the file to the specified filename.

class keysight.qcs.analysis.EstimateCollection(estimates: Optional[Union[Estimate, Iterable[Estimate]]] = None)

Bases: Serializable

An iterable container of estimates with several convenience functions which make it easier to select specific estimates.

Parameters:

estimates – Either a single estimate or an iterable of estimates to include in the collection.

property estimates: list[keysight.qcs.analysis.estimate.Estimate]

The estimates in this collection.

append(estimate: Union[Estimate, Iterable[Estimate]])

Appends a single estimate or an iterable of estimates to the collection.

Parameters:

estimate – A single estimate or an iterable of estimates.

vector(name: str) ndarray

Constructs a vector of estimates for a given parameter.

Parameters:

name – The name of the parameter to extract.

draw(filename: str = 'qcs_estimate_collection.html', display: bool = True) None

Creates a HTML representation of this estimate collection and saves it to a file.

Parameters:
  • filename – The filename to write the HTML to (if executing in a script)

  • display – Whether to display the HTML. When set to False, this will only save the file to the specified filename.

class keysight.qcs.analysis.EstimateTuple(name, val, std)

Bases: tuple

A namedtuple container for storing a single estimate name, value, and standard deviation.

Parameters:
  • name – The name of the estimate.

  • val – The value of the estimate.

  • std – The standard deviation of the estimate.

Fitting

class keysight.qcs.analysis.BaseFitter

Bases: Serializable

A class for fitting real-valued data.

abstract property model: Callable

The model.

abstract property names: tuple[str, ...]

The names of the parameters of the model.

fit(x_values: ndarray, y_values: ndarray, guess: Optional[tuple[float, ...]] = None, preprocessors: Optional[Iterable[Preprocessor]] = None) Estimate

Fits data to a model and returns the parameters.

Parameters:
  • x_values – The independent variable values.

  • y_values – The data to fit.

  • guess – The initial guess for the parameters. If None, uses the make_guess method.

  • preprocessors – An iterable of Preprocessors that are applied to the data before fitting.

abstract make_guess(x_values: ndarray, y_values: ndarray) tuple[float, ...]

Generates a guess for the parameters.

Parameters:
  • x_values – The independent variable values.

  • y_values – The data to fit.

class keysight.qcs.analysis.ComplexFitter

Bases: BaseFitter

A class for fitting complex-valued data.

fit(x_values: ndarray, y_values: ndarray, guess=None, preprocessors=None) Estimate

Fits an array and returns the fitted parameters.

Parameters:
  • x_values – The independent variable values.

  • y_values – The data to fit.

  • guess – The initial guess for the parameters. If None, uses the make_guess method.

  • preprocessors – An iterable of Preprocessors that are applied to the data before fitting.

class keysight.qcs.analysis.ComplexLorentzian

Bases: ComplexFitter

A fitter for a complex Lorentzian.

property model

The model.

property names

The names of the parameters of the model.

make_guess(x_values: ndarray, y_values: ndarray)

Generates a guess for the parameters.

Parameters:
  • x_values – The independent variable values.

  • y_values – The data to fit.

class keysight.qcs.analysis.DecayingSinusoid

Bases: BaseFitter

A fitter for a decaying sinusoid.

property model

The model.

property names

The names of the parameters of the model.

make_guess(x_values, y_values) tuple

Generates a guess for the parameters.

Parameters:
  • x_values – The independent variable values.

  • y_values – The data to fit.

class keysight.qcs.analysis.Exponential

Bases: BaseFitter

A fitter for an exponential curve.

property model

The model.

property names

The names of the parameters of the model.

make_guess(x_values, y_values)

Generates a guess for the parameters.

Parameters:
  • x_values – The independent variable values.

  • y_values – The data to fit.

Preprocessing

class keysight.qcs.analysis.Preprocessor

Bases: Serializable

A class that processes experimental data before fitting.

abstract process(x_values: ndarray, y_values: ndarray) tuple[numpy.ndarray, numpy.ndarray]

Process the data.

class keysight.qcs.analysis.LinearDetrend

Bases: Preprocessor

Removes linear trends from experimental data.

process(x_values, y_values)

Process the data.

class keysight.qcs.analysis.IQuadrature

Bases: Preprocessor

Extracts the I quadrature from complex IQ data.

process(x_values, y_values)

Process the data.

On this page