;+ ; This procedure smooths a spectrum with a hanning filter. ; ; @keyword decimate {in}{optional}{type=boolean} If set, decimates by 2. ; ; @examples ;
;    getrec,1
;    show
;    hanning
;    show
; 
; ; @uses decimate ; ; @version $Id: hanning.pro,v 1.6 2005/05/30 04:03:43 bgarwood Exp $ ;- pro hanning,decimate=decimate ; Do the smoothing first len = data_valid(!g.s[0]) if len le 0 then begin message,'No data in primary data container, nothing to smooth',/info return endif oldarr = *!g.s[0].data_ptr newarr = oldarr for i=1,len-2 do begin newarr[i] = (oldarr[i-1]+oldarr[i+1])/4.0 + oldarr[i]/2.0 end *!g.s[0].data_ptr = newarr if n_elements(decimate) ne 0 then decimate,2 $ else if !g.frozen eq 0 then show end