;The function edgedetect.pro is a crude square wavelet ;edgedetector. It was designed to be used in conjuction with ;speccorrec_ift.pro to find the 'knee' where noise starts to be ;noticable in the h2o vapor spectra from wlef trailer licors. ;Use is as follows: ; ans=edgedetect(x,a) ;Where ; input | x = input signal to find edge in ; | a = width of wavelet (must be odd #) ; ; | ans(0) = non-normalized area under curve created by ;output | mulitiplying wavelet by signal over width of wavelet ; | (by non-normalized, I mean just the sum of the ; | discrete values under the curve) ; | ans(1) = an index vector starting at index of x where ; | center of wavelet lies when the wavelet is at ; | left-most position. ; ;BWBerger 4/20/99 function edgedetect,x,a n=len(x) ev=2*floor(a/2.) if a eq ev then begin a=a+1 print, 'a needs to be odd. One added. a=', a endif wav=fltarr(1,n-a+1) for i=0,n-a do begin wav(i)=total(x(i:i+(a+1)/2-1-1))-total(x(i+(a+1)/2+1-1:i+a-1)) endfor t=findgen(1,n-a+1)+(a-1)/2 ans=[wav,t] return,ans end