erlab.accessors.fit

Defines accessors for curve fitting.

Classes

ParallelFitDataArrayAccessor(xarray_obj)

xarray.DataArray.parallel_fit accessor for fitting lmfit models in parallel.

class erlab.accessors.fit.ParallelFitDataArrayAccessor(xarray_obj)[source]

Bases: ERLabDataArrayAccessor

xarray.DataArray.parallel_fit accessor for fitting lmfit models in parallel.

__call__(dim, model, **kwargs)[source]

Fit the specified model to the data along the given dimension.

Parameters:
  • dim (str) – The name of the dimension along which to fit the model. Note that this is the dimension along which the model will be parallelized over, not the independent dimension(s) of the model.

  • model (lmfit.Model) – The model to fit.

  • **kwargs (dict) – Additional keyword arguments to be passed to xarray.Dataset.xlm.modelfit().

Returns:

curvefit_results (xarray.Dataset) – The dataset containing the results of the fit. See xarray.DataArray.xlm.modelfit() for details.

Return type:

Dataset