#! /usr/bin/perl -w use SAS; require "esas_parameters_init.pl"; require "esas_GVariables.pm"; #.. Create object to store parameters #.. Define Global Variables use vars qw($gv); $gv = esas_GVariables->new(); #.. Init Program Parameters &esasmosaic_parameters_init(@ARGV); $task="esas-mosaic"; $version="0.1"; $date="2012-10-20"; $author="S. L. Snowden"; print "\n"; print "Task: $task \n"; print "Version: $version \n"; print "Date: $date \n"; print "Author: $author \n\n"; # conv-region does the following: For each instrument of each obsid # the targ_file is copied to the working directory where its coordinates # are converted to DETX,DETY and the sizes are converted to pixels. # The local instr-bkg_region-det.fits region file is then appended, # and the result written to instr-det-targ.fits. # The reg_instr.txt file is then written to use this region file, # i.e, &®ION(instr-det-targ.fits) # # usage: conv-region obsidlist=obsid-list.txt targfile=det-targ.fits # # obsidlist: ASCII file has one obsid per line, i.e., 0112290201 # targfile: FITS region file in sky coordinates # The FITS file format is the same as that used to construct # instr-bkg_region-det.fits with the following exceptions: # Instead of DETX,DETY the columns are RA,DEC and the values # are in decimal degrees. The R column is in arcseconds. $sublist=$gv->ESASMosaic_sublist; chomp($sublist); print "Subpointing List: $sublist\n"; system "more ".$sublist; $m1prefix=$gv->ESASMosaic_m1prefix; chomp($m1prefix); print "MOS1 ObsID ESAS Prefix: $m1prefix\n"; $m2prefix=$gv->ESASMosaic_m2prefix; chomp($m2prefix); print "MOS2 ObsID ESAS Prefix: $m2prefix\n"; $pnprefix=$gv->ESASMosaic_pnprefix; chomp($pnprefix); print "PN ObsID ESAS Prefix: $pnprefix\n"; # Extract the ObsIDs from the ASCII list and loop over them $n=1; system "pwd"; open (DIR_HNDL,$sublist); while($line=){ chomp($line); # print "$line\n"; $line =~ s/^\s+//; # gets rid of leading blank space # print "$line\n"; @values = split(/\s+/,$line); $n = $values[0]; $ra = $values[1]; $dec = $values[2]; $pa = $values[3]; # Now process headers of the the event files if($n < 10){ $dir="prep_mosaic_00".$n; print "$dir\n"; chdir($dir); system "esprep_mosaic eventsin=mos".$m1prefix."-clean_P00".$n. ".ds eventsout=mos".$m1prefix."-clean.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; system "esprep_mosaic eventsin=mos".$m2prefix."-clean_P00".$n. ".ds eventsout=mos".$m2prefix."-clean.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; system "esprep_mosaic eventsin=pn".$pnprefix."-clean_P00".$n. ".ds eventsout=pn".$pnprefix."-clean.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; system "esprep_mosaic eventsin=pn".$pnprefix."-clean-oot_P00".$n. ".ds eventsout=pn".$pnprefix."-clean-oot.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; chdir(".."); } else { $dir="prep_mosaic_0".$n; print "$dir\n"; chdir($dir); $command="esprep_mosaic eventsin=mos".$m1prefix."-clean_P0".$n. ".ds eventsout=mos".$m1prefix."-clean.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; print "$command\n"; system "$command"; $command="esprep_mosaic eventsin=mos".$m2prefix."-clean_P0".$n. ".ds eventsout=mos".$m2prefix."-clean.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; print "$command\n"; system "$command"; $command="esprep_mosaic eventsin=pn".$pnprefix."-clean_P0".$n. ".ds eventsout=pn".$pnprefix."-clean.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; print "$command\n"; system "$command"; $command="esprep_mosaic eventsin=pn".$pnprefix."-clean-oot_P0".$n. ".ds eventsout=pn".$pnprefix."-clean-oot.fits raobj=".$ra. " decobj=".$dec." pa=".$pa." clobber=1"; print "$command\n"; system "$command"; chdir(".."); } }