#! /usr/bin/sh #### # 990223 dph - modifying as per: # ASC Data System, version: R4CU1C Sunday, February 7, 1999 # MARX version: 2.20.p4 # marx2fits v2.20.p4 #### 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 little checking, # and hard-codes some filenames. # ############################################################ ############################################################ ############################################################ ############################################################ ############################################################ #//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ #\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// # # R E Q U I R E D F I L E S : # ########################################## # modhead tables: REFDAT=./RefData sim_tbl=$REFDAT/mh_aciss_sim.tbl misc_tbl=$REFDAT/mh_aciss_misc.tbl gain_table=$REFDAT/acis_gain.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="$fname" echo fmodhead $L0name+0 $sim_tbl echo fmodhead $L0name+2 $sim_tbl echo fmodhead $L0name $misc_tbl fmodhead $L0name+0 $sim_tbl fmodhead $L0name+2 $sim_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 $L0name'[2]' $L1par ############# experimental: try dmmakepar, check output: #dmmakepar $L0name'[3]' $L1par # xxx ############ end experimental dmmakepar SIM_Z=`pget $L1par sim_z` # will need later for param setup echo SIM_Z = $SIM_Z Detnam=`pget $L1par detnam` Detector=`pget $L1par instrume` echo INSTRUME=$Detector DETNAM=$Detnam ########################################## # 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 rand_seed=1 pset acis_process_events verbose=3 #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}' pset acis_process_events stdlev1='{d:time,s:ccd_id,s:chip,s:tdet,f:det,f:sky,l:pha,f:energy,s:pi,s:fltgrade,s:grade,s:status}' # 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 L1name="$rname"_L1.fits 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`