func_fit

pydl.pydlutils.trace.func_fit(x, y, ncoeff, invvar=None, function_name='legendre', ia=None, inputans=None, inputfunc=None)[source]

Fit x, y positions to a functional form.

Parameters:

x : array-like

X values (independent variable).

y : array-like

Y values (dependent variable).

ncoeff : int

Number of coefficients to fit.

invvar : array-like, optional

Weight values; inverse variance.

function_name : str, optional

Function name, default ‘legendre’.

ia : array-like, optional

An array of bool of length ncoeff specifying free (True) and fixed (False) parameters.

inputans : array-like, optional

An array of values of length ncoeff specifying the values of the fixed parameters.

inputfunc : array-like, optional

Multiply the function fit by these values.

Returns:

tuple() of array-like

Fit coefficients, length ncoeff; fitted values.

Raises:

KeyError

If an invalid function type is selected.

ValueError

If input dimensions do not agree.