desc.profiles.MTanhProfile.from_values

classmethod MTanhProfile.from_values(x, y, order=4, w=None, p0=None, pmax=None, pmin=None, name='', **kwargs)Source

Fit a MTanhProfile from point data.

Parameters:
  • x (array-like, shape(M,)) – coordinate locations

  • y (array-like, shape(M,)) – function values

  • order (int) – order of the core polynomial to fit

  • w (array-like, shape(M,)) – Weights to apply to the y-coordinates of the sample points. For gaussian uncertainties, use 1/sigma (not 1/sigma**2).

  • p0 (array-like, shape(4+order,)) – initial guess for parameter values [ped, offset, sym, width, core_poly]. Use a value of “None” to use the default initial guess for that parameter

  • pmin (float or array-like, shape(4+order,)) – lower bounds for parameter values Use a value of “None” to use the default bound for that parameter

  • pmax (float or array-like, shape(4+order,)) – upper bounds for parameter values Use a value of “None” to use the default bound for that parameter

  • name (str) – name of the profile

  • kwargs – additional keyword arguments passed to scipy.optimize.least_squares

Returns:

profile (MTanhProfile) – profile in mtanh + polynomial form.