cwitools.modeling.fit_model1d

cwitools.modeling.fit_model1d(model_func, model_bounds, x, y, *args, **kwargs)

Wrapper for fitting a 1D model using SciPy’s differential evolution.

Parameters:
  • model_func (callable) – The model function, of form f(parameters, x)
  • model_bounds (list) – List of tuples representing (lower, upper) bounds on the model parameters. e.g. [(0,1), (-1,-1), … ]
  • x (numpy.array) – Input x data (e.g. wavelength)
  • y (numpy.array) – Input y data to fit to (e.g. flux)
  • y_var (numpy.array) – (optional) The variance on the y-data, used to weight data.
Returns:

The result of the fit.

Return type:

scipy.optimize.OptimizeResult