procedure listfuse(fuse_table, outfile, hdr) # # CL script to produce an ASCII file from a FUSE flux-calibrated table # that is suitable for input to specfit. # # 11/24/99 gak # file fuse_table {"",prompt="Input file name"} file outfile {"",prompt="Output file name"} bool hdr {"",prompt="Include the header? (y/n)"} begin file fusespec, flux, errs, outf bool add_hdr char name, dateobs int npts real itime # Load necessary packages for this procedure dataio() noao() ttools() if ( access("hdr.ls") ) delete("hdr.ls") if ( access("spec0.ls") ) delete("spec0.ls") if ( access("spec1.ls") ) delete("spec1.ls") # Get input parameters fusespec = fuse_table outf = outfile add_hdr = hdr tprint (fusespec, prparam=no, prdata=yes, pwidth=80, plength=0,\ showrow=no, orig_row=yes, showhdr=no, showunits=no,\ columns="WAVE FLUX ERROR", rows="-", option="plain",\ align=yes, sp_col="", lgroup=0, > "spec0.ls") if ( add_hdr ) { # Get header information imgets(fusespec//"[0]","TARGNAME") name = imgets.value imgets(fusespec//"[0]","DATEOBS") dateobs = imgets.value imgets(fusespec//"[0]","EXPTIME") itime = real( imgets.value ) tinfo(fusespec, ttout=no) npts = tinfo.nrows print("FUSE ",name," ",dateobs,"\n",npts,itime, > "hdr.ls") concat("hdr.ls,spec0.ls", > "spec1.ls") rename("spec1.ls", outf) delete("spec0.ls") delete("hdr.ls") } else { rename("spec0.ls", outf) } end