procedure fuse2qp (fitsin, qpout) file fitsin {"",prompt="Name of FUSE raw ttag FITS file"} file qpout {"",prompt="Name of output IRAF QPOE file"} begin file fitsfile, qpfile, tmp1, tmp2, tmp3 # Load necessary packages if (! defpac ("ttools")) { print("Please load the 'ttools' package before running this task") bye } if (! defpac ("xdataio")) { print("Please load the 'xray' and 'xdataio' packages before running this task") bye } # Get input file names fitsfile = fitsin qpfile = qpout # Allocate temporary files tmp1 = mktemp("tmp$tmp1.")//".fits" tmp2 = mktemp("tmp$tmp2.")//".fits" tmp3 = mktemp("tmp$tmp3.")//".fits" # Fix FUSE FITS header for QPOE compatibility parkey(2, fitsfile, "NAXLEN", add=yes) parkey(16384, fitsfile, "AXLEN1", add=yes) parkey(1024, fitsfile, "AXLEN2", add=yes) parkey("time", fitsfile, "XS-SORT", add=yes) tproj (fitsfile, tmp1, "TIME", uniq=no) tcalc (tmp1, "SEC", "TIME+0.0", data="double", colunits="seconds",\ colfmt="") tchcol (tmp1, "TIME", "RTIME", "", "", verbose=yes) tchcol (tmp1, "SEC", "TIME", "", "", verbose=yes) tmerge (tmp1//","//fitsfile, tmp2, "merge", allcols=yes,\ tbltype="default", allrows=100, extracol=0) tproj (tmp2, tmp3, "TIME,X,Y,PHA", uniq=no) ttools.tcopy (fitsfile//"[2]", tmp3//"[2]", verbose=yes) # Do the FITS to QPOE conversion fits2qp(tmp3, qpfile) # Delete temporary files delete(tmp1) delete(tmp2) delete(tmp3) end