function noise,spec,vpeakpt,vdisppt,widths,baseline ;------------------------------------ ; calculates the RMS amplitudes of the noise in a spectrum ; WIDTHS FWHM's off the baseline. ;------------------------------------ sz=size(spec) velp=findgen(sz(1)) subs=where((velp le vpeakpt-widths*vdisppt) or $ (velp ge vpeakpt+widths*vdisppt)) if (subs(0) eq (-1.)) then begin print,'No points in baseline' return,99999.0 endif nspec=spec(subs) sn=size(nspec) sn=float(sn(1)) return,sqrt(total((nspec-baseline)^2)/sn) end