% file: rg_plot.i % % Plot a region, determined by rgsel % % If rgsel is greater than 100000 then % assume it is pointing to a valid bump group id % and plot in that area. % % Assumes a region structure, rgl, has been setup % already to define the regions. % % Note: get_data(), plot_data(), etc. are used so that either % counts or flux can be plotted by this routine. % %------------------------------------------------------ % - - - if (psplot == 1) { % Postscript plot: vps = open_plot(data_set_name+"_rg"+string(rgsel)+"plot.ps/vcps", 1, 2); window(vps); % substitute for the yellow (poor for printing) cmegm = orange; if (data_n_spectra < 4) {cmegm = green;} } else { % - - - OR - - - window(p1); erase; } % - - - variable irg, yrangemax, xrangemin, xrangemax; if (rgsel < 10000) { % Find the Region and setup the plot % index into rgl: irg=0; while (rgl[irg].id != rgsel) { irg=irg+1;} xrangemin = rgl[irg].lo; xrangemax = rgl[irg].hi; title(data_set_name+": "+rgl[irg].desc+" Region ["+string(rgsel)+"] (z="+string(zpg)+")"); } else { % Assume a bump's "group" value was given... % Plot the region around the bump bpsel = where(array_struct_field(bpl,"grp") == rgsel); bpsel = bpsel[0]; xrangemin = (1.0+zpg)*bpl[bpsel].lam - 0.5*rgbprange; xrangemax = (1.0+zpg)*bpl[bpsel].lam + 0.5*rgbprange; title(data_set_name+": "+bpl[bpsel].desc+" Bump ["+string(bpsel)+"] (z="+string(zpg)+")"); } %--------------- ignore all -------------------- ignore([1:12]); % notice the range notice(megm, xrangemin, xrangemax); notice(megp, xrangemin, xrangemax); if (data_n_spectra > 2) { notice(hegm, xrangemin, xrangemax); notice(hegp, xrangemin, xrangemax); } % and ignore bad data... () = evalfile(data_dir+"/"+data_set_name+"_ignores.i"); % X range xlin; xrange(xrangemin, xrangemax); % Y range ylin; gds = get_data(megm); yrangemax = max(gds.value[where(gds.bin_lo > xrangemin and gds.bin_hi < xrangemax)]); gds = get_data(megp); yrangemax = max( [ max(gds.value[where(gds.bin_lo > xrangemin and gds.bin_hi < xrangemax)]), yrangemax] ); if (data_n_spectra > 2) { gds = get_data(hegm); if (length(where(gds.bin_lo > xrangemin and gds.bin_hi < xrangemax)) > 0) { yrangemax = max( [ max(gds.value[where(gds.bin_lo > xrangemin and gds.bin_hi < xrangemax)]), yrangemax] ); } gds = get_data(hegp); if (length(where(gds.bin_lo > xrangemin and gds.bin_hi < xrangemax)) > 0) { yrangemax = max( [ max(gds.value[where(gds.bin_lo > xrangemin and gds.bin_hi < xrangemax)]), yrangemax] ); } } yrange(0.0, 1.33*yrangemax); if (psplot != 1) {erase;} plot_data(megm,cmegm); if (data_n_spectra > 2) { oplot_data(hegm,chegm); oplot_data(hegp,chegp); } oplot_data(megm,cmegm); oplot_data(megp,cmegp); ()=evalfile("plot_all_groups.i"); %%()=evalfile("plot_bpl_groups.i"); % - - - if ps output - - - if ( psplot == 1) { close_plot(vps); cmegm = yellow; } % - - - %end