#! /bin/sh # This is the LHEA perl script: acisscreen # The purpose of this special block is to make this script work with # the user's local perl, regardless of where that perl is installed. # The variable LHEAPERL is set by the initialization script to # point to the local perl installation. #------------------------------------------------------------------------------- eval ' if [ "x$LHEAPERL" = x ]; then echo "Please run standard LHEA initialization before attempting to run acisscreen." exit 3 elif [ "$LHEAPERL" = noperl ]; then echo "During LHEA initialization, no acceptable version of Perl was found." echo "Cannot execute script acisscreen." exit 3 elif [ `$LHEAPERL -v < /dev/null 2> /dev/null | grep -ic "perl"` -eq 0 ]; then echo "LHEAPERL variable does not point to a usable perl." exit 3 else exec $LHEAPERL -x $0 ${1+"$@"} fi ' if(0); # Do not delete anything above this comment from an installed LHEA script! #------------------------------------------------------------------------------- #! /usr1/local/bin/perl5 # This script runs fselect using a selection expression which removes bad # grades, known bad pixels and columns, the bad events associated with # node boundaries, and PI underflows and overflows. $version ="2.01"; $date ="2002-12-31"; #Get and parse the command line option if ($ARGV[0]=~/^-(\S+)/){ $option=$1; if($option=~/h/){$help =1;} shift(@ARGV); } if($help){ print "\n"; print "acisscreen version $version $date\n\n"; print "usage: acisscreen [-h] input_events output_events remove_hot\n\n"; print "acisscreen is a perl script to screen bad events from ACIS data\n"; print "it removes bad grades, bad pixels and columns, bad events\n"; print "associated with node boundaries, and PI values of 0, 1, and\n"; print "1024 are underflows or overflows. If the remove_hot argument is\n"; print "given as no then the hot columns and pixels will not be\n"; print "removed. The default is to remove them\n"; print "e.g. acisscreen myfilein.evt myfileout.evt no\n"; print "cleans the file myfilein.evt but does not remove hot columns and\n"; print "pixels and places the output in myfileout.evt\n\n"; exit(0); } if (@ARGV != 2 && @ARGV != 3) { print "\n"; print "usage: acisscreen [-h] input_events output_events remove_hot\n"; print "type \"acisscreen -h\" to get more information\n"; print "\n"; exit(0); } $input = $ARGV[0]; # name of input event file $output = $ARGV[1]; # name of output event file if ( @ARGV == 3 ) { ($remhot = $ARGV[2]) =~ tr/A-Z/a-z/; } else { $remhot = "yes" } # First read the DATE-OBS keyword from the input file to find the observation # date $command = "fkeypar $input DATE-OBS\n"; system($command); $obsdate = `pget fkeypar value`; $year = substr($obsdate,1,4); $month = substr($obsdate,6,2); $day = substr($obsdate,9,2); print "\n","Observation performed on ",$month,"/",$day,"/",$year,"\n"; # The following somewhat messy code decides which hot pixel file to use. # There are two available based on Maxim Markevitch's lists for -120 and # pre-120 data. if($year >= 2001) { $hotpixfile = '/chandra/software/scripts/acisscreen_expr_120.txt' } elsif($year == 2000) { if( ($month == 1 && $day > 29) || $month > 1 ) { $hotpixfile = '/chandra/software/scripts/acisscreen_expr_120.txt' } else { $hotpixfile = '/chandra/software/scripts/acisscreen_expr_110.txt' } } elsif($year == 1999) { $hotpixfile = '/chandra/software/scripts/acisscreen_expr_110.txt' } # define the fselect command if ( $remhot eq "yes" ) { $command = "fselect $input $output @"."$hotpixfile histkw=yes copyall=yes keycopy=yes\n"; } else { $command = "fselect $input $output @/chandra/software/scripts/acisscreen_expr_nohot.txt histkw=yes copyall=yes keycopy=yes\n"; } # and run it print "\n"; print $command; print "\n"; system($command); # we are done