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:
- 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
ncoeff
specifying free (True
) and fixed (False
) parameters.- inputansarray-like, optional
An array of values of length
ncoeff
specifying the values of the fixed parameters.- inputfuncarray-like, optional
Multiply the function fit by these values.
- Returns:
tuple
of array-likeFit coefficients, length
ncoeff
; fitted values.
- Raises:
KeyError
If an invalid function type is selected.
ValueError
If input dimensions do not agree.