;+ ; This procedure allows the user to specify baseline regions using the mouse. ; Use the left mouse button to mark the regions to be fit. Vertical ; lines will be drawn at each click. Use the right mouse button to exit (the ; right-click does NOT register a mark for the baseline range.) ; A box will then be drawn ; to identify the ranges just set, where the upper and lower ; bounds of the box are mean + sigma and mean - sigma. ; ; @version $Id: setregion.pro,v 1.6 2005/05/31 14:37:46 paghots Exp $ ;- pro setregion compile_opt idl2 common gbtplot_common,mystate,xarray if data_valid(getplotterdc()) le 0 then begin message,'Nothing has been plotted',/info return endif npts = 0 xpts = lonarr(200) vmarks = lonarr(200) yrange = mystate.yrange clearoplots print, 'Use the left button to mark the region and the right button to exit' while (1) do begin c = click() if (c.button eq 4) then break if (c.button eq 2) then continue gbtoplot,[c.x,c.x],yrange,color=!white,index=index xpts[npts] = c.chan vmarks[npts] = index npts += 1 endwhile if (npts le 0) then return indx = lindgen(npts) nregion, xpts[indx] clearoplots,index=vmarks[indx] for i = 0,!g.nregion-1 do begin ; plot an RMS box for each region rmsbox,!g.regions[0,i],!g.regions[1,i], *(*mystate.dc_ptr).data_ptr endfor end