+
Automatic determination of the EW of a spectral line by fitting
Gaussian and Voigt profiles. The fits are forced to match the continuum
at 1.0 and, in the case of a Voigt profile, the center of the line at
is fixed to the position determined by the Gaussian fit.
IN: x - flt/dblarr Vector with wavelengths
y - flt/dblarr Vector with normalized flux
OUT: ew - dblarr(2) Equivalent width determined from the Gaussian
and the Voigt fits (angstroms). A zero value is returned
when the measurement could not be performed.
KEYWORDS: a float Gaussian parameters
f=a(0)*exp(-((x-a(1))/a(2))^2./2) + a(3)
b flt array(2) Voigt profile parameters
f=b(0)*voigt(b(2),(x-b(1))*b(1)^2/b(3))+b(4)
cont when switched on, the continuum location
becomes a fitting parameter (otherwise
fixed to 1.0)
restrict when on, the initial search for the
line center (mideshift_xy) is restricted
to 'restrict' from the mean of x
(same units as in x)
yerror std. deviation between data and model in the area
used for least-squares fitting. As ew, this is a 2-element
array, with the first element for the Gaussian fit and the
second for the Voigt fit
Extra keywords are passed along to plot (e.g. yrange, charsize, etc.)
Note: the numerical integration of the fits goes on only out to the
limits of the input wavelength window. The only points taken
into account in the fit are those from the line center up to
the first place where the slope changes sign (to avoid blends).
The routine curvefit.pro, which is used by this procedure,
will sometimes crash when there are not enough points to fit.
A modified curvefit.pro (see callende library) that will exit
more graciously is recommended for batch applications.
Carlos Allende Prieto, UT, Oct 2001
, UT, April 2006, Voigt fitting enabled, 'height'
and 'continuum' are included as fitting
parameters, and so is 'center' for the
Gaussian case. Keywords 'cont' and
'restrict' added
, UT, February 2009, yerror keyword added
, IAC, July 2011, accepted extra keywords for 'plot'