function velmap

Go through a datacube and fit a gaussian to a line. The arguments center and fwhm are used as initial estimate for the gauss-fit.

result = velmap(cube, center, fwhm [, threshold])

cube:   A datacube
center:   The approximate center (wavelength) of the line to fit
fwhm:   The approximate FWHM of the line to fit
threshold:   A lower limit under which no fit is attempted (given as percentage of peak flux)

A datacube with the following slices:
result[*,*,1]: fit background
result[*,*,2]: fit continuum
result[*,*,3]: fit line center
result[*,*,4]: fit line FWHM
result[*,*,5]: error in background fit
result[*,*,6]: error in continuum fit
result[*,*,7]: error in line center fit
result[*,*,8]: error in line FWHM fit
result[*,*,9]: chi squared of fit