+
Gaussian convolution
IN: x -fltarr independent variable
y -fltarr array of data to smooth
fwhm -float FWHM of the Gaussian kernel (pixels)
OUT: nx -fltarr new sampled x-axis
ny -fltarr smoothed data
KEYWORDS: ppr -integer pixels per resolution element
(default is ppr=3)
nsigma -float how far the convolution goes
inter if set, the x-axis is interpolated
to force a constant step; if the step
already constant, 'inter' will have no
effect
original if set, the original sampling is kept
for the output arrays, unless inter is
also set and an interpolation is
performed, in which case, the output
x-axis will just have the same
number of points as the input x, but
resampled to constant step.
EXAMPLES: 1) Smooth an input spectrum with a Gaussian of FWHM=2.0 AA
assuming the spectrum is given on a uniform (linearly sampled)
wavelength scale with a step of 0.1 AA.
IDL> fwhm=2.0/0.1
IDL> gconv,w,f,fwhm,w2,f2
2) Smooth the same spectrum with a Gaussian of FWHM=50. km/s
IDL> step=(max(alog(w))-min(alog(w)))/n_elements(w)
IDL> fwhm=50./299792.458/step
IDL> gconv,alog(w),f,fwhm,w2,f2,/inter
Because of the keyword inter, the spectrum will be internally
interpolated to a step in ln (w) of
step=(max(alog(w))-min(alog(w)))/n_elements(w)
Then the 50 km/s (or V/c = 0.000166782) is equivalent to
50./299792.458/step pixels.
C. Allende Prieto, Univ. of Texas, March 2006
"" , MSSL/UCL, July 2009 -- changed to double, avoid psf_gaussian
, MSSL/UCL, August 2009 -- modified to avoid rate=0
, IAC, January 2010 -- changed indgen -> indgen(,/long)
, IAC, January 2011 -- bug fixed (checking linear or log x scale)