function sersic2dsmoothsimplefit

Fit a two-dimensional smoothed sersic function to a rectangular grid (i.e. an image).
The 2D sersic function is defined as I(x,y) = c + Ie * exp(-bn * (R/Re)^(1/n) - 1).
R is an elliptical equation: R = sqrt(xp^2 + (yp / q)^2).
xp and yp describe a rotation: xp = (x - x0) * cos(angle) + (y - y0) * sin(angle), yp = - (x - x0) * sin(angle) + (y - y0) * cos(angle) and bn = 1.9992 * n - 0.3271
The resulting 2D sersic function is then smoothed by convolving with a gaussian with a FWHM given by the smooth parameter.

Syntax
result = sersic2dsmoothsimplefit(image, errors, x0, y0, width, smooth [, chisq])

Arguments
image:   The image to be fit
errors:   The errors in the image values
x0, y0:   The center coordinates of the window to fit
width:   The width of the window to fit
smooth:   The FWHM for the gaussian smoothing
chisq:   If set to a named variable, the variable is overwritten with the chi-squared of the fit.


Returns
The returned vector contains the best-fit parameters in the form [c, Ie, Re, x0, y0, angle, q, n] or [c, Ie, Re, x0, y0, angle, q] if n was kept fixed.

See also
function sersic2dfit
function sersic2dsmoothfit