Since order-sorting can be tricky and is frequently broken by changing calibrations, I have re-written my IDL event visualization hack in slightly less hacky ISIS/Slang (suggestions on coding style are welcome.) You can get it at ~dph/libisis/plot_order_summary.sl (CSR or HEAD; also attached below). Invocation without arguments will echo usage and examples. (note: isis is now on HEAD at /soft/isis/isis/bin/solaris/isis) I do it like this: isis> ilib=getenv("HOME") + "/libisis"; isis> ()=evalfile(ilib + "/plot_order_summary.sl"); isis> p1=open_plot("/xwin"); resize(18,1.4); % e.g., if you want to watch; % Otherwise for batch processing, use % "/null". isis> s_evt="./Evt/acisf00123_N0002_evt2.fits"; % .gz is OK (but slow) isis> plot_order_summary(s_evt, "gif", "HeyBob"); isis> ! xv -8 -perfect HeyBob*.gif & isis> quit % "vcps" is recommended for postscript, since the function resizes the % page: isis> plot_order_summary(s_evt, "vcps", "HeyBob"); isis> ! gv -noantialias HeyBob_MEG.ps & There WILL be side affects on an isis session - I don't know how to avoid this (e.g., connect_points and points styles, xrange, yrange). (Help? unless there is a global plot structure to save and replace? like !p in IDL?) Questions for Mike N. and Randall: How can we run this from chips? (when I say "we", I mean "you"...). I don't know where the importable version is - I got a shared library error in ciaox - couldn't find ./libisis.so or some such (ld path error?). Do "we" need to convert plot functions to chips, or can we just let the import run pgplot? (who would know?) Eric S.: It would be nice if we could batch these plots for v&v. A one-argument shell script (evt2 filename) could do it. -- Dave David Huenemoerder (617-253-4283; fax: 253-8084) Center for Space Research/Chandra X-ray Center MIT NE80-6023, Cambridge, MA 02139 http://space.mit.edu/~dph % Time-stamp: <2001-05-24 09:05:44 dph> % MIT Directory: ~dph/libisis % File: plot_order_summary.sl % Author: D. Huenemoerder % Original version: 2001.05.20 % % (this header is ~dph/libidl/time-stamp-template.tex) % to auto-update the stamp in emacs, put this in your .emacs file: % (add-hook 'write-file-hooks 'time-stamp) %==================================================================== % given a grating PHA filename, produce order-sorting summary plots. % Interface: % retval = plot_order_summary(evt_file, output_dev, output_rootname) % evt_file = string; absolute path to the event file to summarize; % must be a Level 1.5 (or greater), with diffraction % coordinates, and detector must be ACIS. % output_dev = string; one of the pgplot output devices % e.g., "ps", "vps", "cps", "gif" % output_rootname = string; rootname for output files. % if HETG, there will be both HEG and MEG files. % E.g. rootname_HEG.gif % rootname_MEG.gif % % utility functions: scribble() and genplot(): % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% define scribble ( x, y, xlbl, ylbl, m1, m2, m3, mnot123, labels ) { plot(x[mnot123], y[mnot123], 5); oplot(x[m1], y[m1], white); oplot(x[m2], y[m2], green); oplot(x[m3], y[m3], red); color(1); xylabel(xlbl, ylbl-0.1, labels[0]); xylabel(xlbl, ylbl-0.2, labels[1]); xylabel(xlbl, ylbl-0.3, labels[2]); xylabel(xlbl, ylbl-0.4, labels[3]); xylabel(xlbl, ylbl-0.5, labels[4]); } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % define genplot( s_tg, s_evt, wmin, wmax, ymin, ymax, tg_mlam, tg_m, energy, labels, suffix, s_root, s_dev ) { variable x, y, m1, m2, m3, mnot123; variable sav_dev, s_outfile, did; variable hc = 12.39854; label("Wavelength", "Order", s_evt + " " + s_tg); xrange(wmin, wmax); yrange(ymin, ymax); x = tg_mlam; y = abs(tg_mlam) / (hc/energy*1000); m1 = where( abs(tg_m) == 1); m2 = where( abs(tg_m) == 2); m3 = where( abs(tg_m) == 3); mnot123 = where( (abs(tg_m) > 3) or (tg_m == 0) ); scribble(x, y, wmin, ymax, m1, m2, m3, mnot123, labels); % "hard"copy file output: s_outfile = s_root + "_"+ s_tg + suffix; sav_dev = _pgqid; did = dup_plot(s_outfile + "/" + s_dev, sav_dev); resize(18,1.3); scribble(x, y, wmin, ymax, m1, m2, m3, mnot123, labels); close_plot(did); window(sav_dev); } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % the main function: % define plot_order_summary() { variable s_evt, s_dev, s_root; if (_NARGS != 3) { message(""); message("USAGE: plot_order_summary( \"evtfile.fits\", \"device\", \"rootname\");"); message(""); message("Plot order-sorting diagnostic summary on current window"); message(" and to selected device, using device for the suffix"); message(" and rootname for the output filename"); message(""); message("EXAMPLE: plot_order_summary(\"hetgs_evt2.fits\", \"vcps\", \"my_test\");"); message(" Produces vertical (portrait) color postscript plots called "); message(" my_test_HEG.ps and my_test_MEG.ps"); message(""); message("EXAMPLE: plot_order_summary(\"hetgs_evt2.fits\", \"gif\", \"my_test\");"); message(" will produce gif files called my_test_HEG.gif and my_test_MEG.gif"); message(""); message("Notes: "); message(" - LETG/ACIS will^H^H^H^H should also work."); message(" - The input file is filtered to select only grades 0,2-4,6, and status=0"); message(" - There are no options to control the plot. (If you want \'em, write \'em!)"); message(" - White: abs(m)=1; Green: 2; Red: 3; Light_blue: background."); message(""); return 1; } s_root=(); s_dev=(); s_evt=(); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% variable tg_mlam, tg_m, energy, tg_part, grade, status; variable ih, im, il, isg; variable m1, m2, m3; variable ymin,ymax; variable s0, s1, s2, s3, s4, s5; variable suffix; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%% %%%%% read the file: header keywords for info, and selected columns %%%%% % % useful header keywords to print: % ACISDE - which osip file was used (to become OSIPFILE); % DATE-OBS % OBJECT % ASCDSVER variable obsid, dateobs, object, ascdsver, osipfile; variable k_obsid, k_dateobs, k_object, k_ascdsver, k_osipfile; k_obsid="OBS_ID"; k_dateobs="DATE-OBS"; k_object="OBJECT"; k_ascdsver="ASCDSVER"; k_osipfile="ACISDE"; % minimal check of file spec. Must use extension number or name to % read. Assume it has been given if the name contains a "[". % !if (is_substr(s_evt,"[")) s_evt = s_evt + "[EVENTS]" ; if (fits_key_exists(s_evt, "OSIPFILE")) { % keyword name is going to change... k_osipfile="OSIPFILE"; } (obsid, dateobs, object, ascdsver, osipfile) = fits_read_key(s_evt, k_obsid, k_dateobs, k_object, k_ascdsver, k_osipfile); s0 = "% " + k_obsid + " = " + obsid; s1 = "% " + k_object + " = " + object; s2 = "% " + k_dateobs + " = " + dateobs; s3 = "% " + k_osipfile + " = " + (strchopr(osipfile, '/', 0))[0]; s4 = "% " + k_ascdsver + " = " + ascdsver; message(s0); message(s1); message(s2); message(s3); message(s4); (tg_mlam, tg_m, energy, tg_part, grade, status) = fits_read_col(s_evt, "tg_mlam", "tg_m", "energy", "tg_part", "grade", "status"); isg = (status == 0) and ( (grade <7) and (grade != 1) and (grade != 5) ); ih = where( (tg_part == 1) and isg ); im = where( (tg_part == 2) and isg ); il = where( (tg_part == 3) and isg ); connect_points(0); % don't connect points pointstyle(-1); % dots ymin=0; ymax=4.0; suffix = "." + s_dev; if (s_dev == "cps") { suffix = ".ps"; } if (s_dev == "vps") { suffix = ".ps"; } if (s_dev == "vcps") { suffix = ".ps"; } if (length(ih) > 0) { genplot ( "HEG", s_evt, -20., 20., ymin, ymax, tg_mlam[ih], tg_m[ih], energy[ih], [s0,s1,s2,s3,s4], suffix, s_root, s_dev ); } if (length(im) > 0) { genplot ( "MEG", s_evt, -40., 40., ymin, ymax, tg_mlam[im], tg_m[im], energy[im], [s0,s1,s2,s3,s4], suffix, s_root, s_dev ); } if (length(il) > 0) { genplot ( "LEG", s_evt, -90., 90., ymin, ymax, tg_mlam[im], tg_m[im], energy[im], [s0,s1,s2,s3,s4], suffix, s_root, s_dev ); } return 0; } ---- You received this message because you are subscribed to the isis-users list. To unsubscribe, send a message to isis-users-request_at_email.domain.hiddenwith the first line of the message as: unsubscribeReceived on Thu May 24 2001 - 11:42:22 EDT
This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:43 EDT