#! /usr/bin/sh echo Starting L1 at `date` # Take a MARX output file, HETG/ACIS-S config, and do L1.5-L2 processing. # The file to be processed is the first command-line argument. # The file should be the output of marx2fits. ############################################################ # # This is a test script. It does no error checking, # and hard-codes some filenames. # ############################################################ ############################################################ ############################################################ ############################################################ ############################################################ #//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ #\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// # # R E Q U I R E D F I L E S : # ########################################## # modhead tables: #mod_tbl=./File_Prep/modhead_marx_aciss.tbl REFDAT=./RefData sim_tbl=$REFDAT/mh_aciss_sim.tbl misc_tbl=$REFDAT/mh_aciss_misc.tbl gain_table=$REFDAT/ACIS_gain_marx.fits ####### cal input for acis_process_events #//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ #\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// ########################################## # get the filename to process. (No checking) if [ $# = 0 ] then echo Usage: `basename $0` marx2fits_FITS_file echo "You must specify a marx2fits file!" exit 1 fi fname=$1 rname=`basename $fname .fits` #L0name="$rname"_L0.fits #cp $fname $L0name L0name="$fname" #fmodhead $L0name+2 $mod_tbl echo fmodhead $L0name+0 $sim_tbl fmodhead $L0name+0 $sim_tbl echo fmodhead $L0name+2 $sim_tbl fmodhead $L0name+2 $sim_tbl echo fmodhead $L0name $misc_tbl fmodhead $L0name $misc_tbl ########################################## # Create a ccdnode column. This step should go away. # Current acis_process_events requires this column to do gain-correction. fcalc $L0name+2 \!${fname} CCDNODE '(CHIPX / 256) % 4' histkw=no # note: the "% 4" is redundant for 1024-sized arrays. ########################################## # get the marx parameter extension into a parameter file # for parameter extraction. fdump $L0name'[3]' \!${L0name}_marx.par - - prhead- showcol- showun- showrow- page- pagewid=132 # read some parameters we will need to set. Detector=`pget ./${L0name}_marx.par DetectorType | cut -f1 -d-` Detnam=`pget ./${L0name}_marx.par DetectorType` echo INSTRUME=$Detector DETNAM=$Detnam ########################################## #Create a par file from the event file header: # marx puts the events as extension 2, and GTI as 1. L1par="$rname"_L1.par touch $L1par rm $L1par # NOTE: hdr2par and dmmakepar count extensions differently. # for hdr2par, the primary extension is numbered '0', # but it is '1' for dmmakepar. # Also, dmmakepar suffers the cfitsio but on missing decimal points # in scientific notation fields (e.g., '1e-09' vs '1.e-09') # hdr2par also does it wrong, but doesn't abort. #hdr2par $fname $L1par hdr2par $L0name'[2]' $L1par # dmmakepar $L0name'[3]' $L1par # xxx SIM_Z=`pget $L1par sim_z` # will need later for param setup echo SIM_Z = $SIM_Z ########################################## # ready to start acis_process_events. # We need to run this to convert from PHA to PI via a # marx-appropriate gain table, and to convert chip coords to sky coords. echo punlearn acis_process_events punlearn acis_process_events echo pset acis_process_events params.......... pset acis_process_events obsfile=$L1par pset acis_process_events gainfile=$gain_table pset acis_process_events doevtgrade=no pset acis_process_events calculate_pi=yes pset acis_process_events random=yes #pset acis_process_events random=no pset acis_process_events rand_seed=1 pset acis_process_events verbose=1 #pset acis_process_events stdlev1='{d:time,s:chipx,s:chipy,s:tdetx,s:tdety,s:detx,s:dety,d:x,d:y,s:ccd_id,s:ccdnode,l:pha,l:pi}' #pset acis_process_events stdlev1='{d:time,s:chipx,s:chipy,s:tdetx,s:tdety,s:detx,s:dety,s:x,s:y,s:ccd_id,s:ccdnode,l:pha,l:pi}' pset acis_process_events stdlev1='{d:time,s:chipx,s:chipy,s:tdetx,s:tdety,s:detx,s:dety,d:sky,s:ccd_id,s:ccdnode,l:pha,l:pi}' # punlearn doesn't work on non-command par files (get Seg fault error) #echo punlearn acis #punlearn acis echo pset acis params.......... pset acis detnam=$Detnam pset acis ACIS_system=ACIS-2.3 pset acis chipsys=AXAF-ACIS-1.0 ## **** fix #pset acis tdetsys=AXAF-ACIS-2.3 pset acis tdetsys=AXAF-ACIS-2.2 pset acis dfpsys=ASC-FP-STF-1.0 pset acis fpsys=ASC-FP-1.1 pset acis mir_al_x=0 pset acis mir_al_y=0 pset acis mir_al_z=0 pset acis stg_al_x=0 pset acis stg_al_y=0 pset acis stg_al_z=0 # NOTE: pix_coords seems to have gone away in the releas (dph 981113) # Comment-out the following. # #echo punlearn pix_coords # #punlearn pix_coords # echo pset pix_coords params.......... # # *** fix *** # #pset pix_coords fp_sys=fp-4.3 # pset pix_coords fp_sys=fp-1.1 # pset pix_coords gdp_sys=gdp_1.1 # # *** fix *** # #pset pix_coords tdet_sys=2.4 # pset pix_coords tdet_sys=2.2 # # *** fix *** # # next 2 lines should change when ACIS-S3 aimpoint params are found: # #pset pix_coords aimpt_name=ai1 #aimpoint name (AI1|HI1|HS1|HSI1|A2C0|NONE) # #pset pix_coords aimpt_coord=-237.4 # aimpoint coords (for aimpt_name = none) # pset pix_coords aimpt_name=as1 #aimpoint name (AI1|HI1|HS1|HSI1|A2C0|NONE) # pset pix_coords aimpt_coord="{0.0,0.0,$SIM_Z}" # aimpoint coords (for aimpt_name = none) # END pix_coords setting. #L1name=`basename $fname .fits`_L1.fits L1name="$rname"_L1.fits #touch $L1name; rm $L1name echo -n time acis_process_events $L0name $L1name NONE NONE ...... time acis_process_events $L0name $L1name NONE NONE echo ... Done. ############################################################ # ########## Fix the header. Currently (980813) the L1 primary header is # ########## minimal. Needs axaf standard stuff. copy from input file. Hdrname=`basename $L0name .fits`.hdr fdump $L0name'[0]' \!$Hdrname 0 0 prhead+ showcol- showun- showrow- page- pagewid=132 # # punt req fields: numlines=`cat $Hdrname | wc -l` outlines=`expr $numlines - 5` echo numlines=$numlines outlines=$outlines Hdr=$Hdrname tail +5 $Hdrname | head -$outlines > $Hdrname.new echo fmodhead $L1name+0 $Hdrname.new ... fmodhead $L1name+0 $Hdrname.new # xxx rm $Hdrname $Hdrname.new # ############################### rm $L1par ${L0name}_marx.par ############### ACIS L1 done. Ready to start grating L1.5. echo Finished L1 at `date`