pro aksm,wn,fnu,wns,fnus,sigma ; take a spectrum (wn,fnu) and return a gaussian smoothed ; version sampled on the grid wns dwn = abs(wn[1] - wn[0]) nx = n_elements(wn) if ( abs ((wn[nx-1] - wn[0])/(nx-1)) - dwn gt 0.1 ) then begin print,'wn grid is not uniform' stop endif ; make a kernel that is +/- 5-sigma nk = floor(10.0*sigma/dwn) if ( nk mod 2 eq 0 ) then nk = nk + 1 kx = dwn*(findgen(nk)-nk/2) kernel = exp(-0.5*(kx/sigma)^2) kernel = kernel/total(kernel) ; normalze the kernel to 1 ; convolve with the kernel fnuc = convol(fnu,kernel,/EDGE_WRAP) ; interpolate onto the output grid over valid data range w = where(wns ge min(wn) and wns le max(wn)) fnus = fltarr(n_elements(wns)) fnus(w) = interpol(fnuc,wn,wns(w)) end