func_fit¶
- pydl.pydlutils.trace.func_fit(x, y, ncoeff, invvar=None, function_name='legendre', ia=None, inputans=None, inputfunc=None)[source]¶
Fit
x,ypositions to a functional form.- Parameters:
- xarray-like
X values (independent variable).
- yarray-like
Y values (dependent variable).
- ncoeff
int Number of coefficients to fit.
- invvararray-like, optional
Weight values; inverse variance.
- function_name
str, optional Function name, default ‘legendre’.
- iaarray-like, optional
An array of bool of length
ncoeffspecifying free (True) and fixed (False) parameters.- inputansarray-like, optional
An array of values of length
ncoeffspecifying the values of the fixed parameters.- inputfuncarray-like, optional
Multiply the function fit by these values.
- Returns:
tupleof array-likeFit coefficients, length
ncoeff; fitted values.
- Raises:
KeyErrorIf an invalid function type is selected.
ValueErrorIf input dimensions do not agree.