;+ ;noise,x,y,min=usermin,max=usermax ;call this to calculate your signal to noise ;- PRO noise,x,y,min=usermin,max=usermax,stn max=min(where(x ge usermax)) min=max(where(x le usermin)) xrang=x[min:max] region=y[min:max] coeff=poly_fit(xrang,region,2,yfit=cont) rect=region-cont ;print,'The standard deviation is(meaningless if there is a slope): ' + string(stddev(region)) print,'The mean is: ' + string(mean(region)) print,'The standard deviation of the straightened region(real): ' +string(stddev(rect)) print,'The mean of the straightened region is(hopefully close to zero): ' + string(mean(rect)) print,'The average signal to noise is: ' + string(mean(region)/stddev(rect)) stn=mean(region)/stddev(rect) window,9 plot,xrang,region oplot,xrang,cont end