#! /bin/sh # This is the LHEA perl script: /cvmfs/extras-fp7.egi.eu/extras/heasoft/ftools/x86_64-unknown-linux-gnu-libc2.19-0/bin/seselect # 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 /cvmfs/extras-fp7.egi.eu/extras/heasoft/ftools/x86_64-unknown-linux-gnu-libc2.19-0/bin/seselect." exit 3 elif [ "$LHEAPERL" = noperl ]; then echo "During LHEA initialization, no acceptable version of Perl was found." echo "Cannot execute script /cvmfs/extras-fp7.egi.eu/extras/heasoft/ftools/x86_64-unknown-linux-gnu-libc2.19-0/bin/seselect." 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 # Force Perl into 32-bit mode (to match the binaries) if necessary: if [ "x$HD_BUILD_ARCH_32_BIT" = xyes ]; then if [ `$LHEAPERL -V 2> /dev/null | grep -ic "USE_64_BIT"` -ne 0 ]; then VERSIONER_PERL_PREFER_32_BIT=yes export VERSIONER_PERL_PREFER_32_BIT fi fi exec $LHEAPERL -x $0 ${1+"$@"} fi ' if(0); # Do not delete anything above this comment from an installed LHEA script! #------------------------------------------------------------------------------- #!/usr1/local/bin/perl # # Script to run sebitmask and fselect one after the other and create # an output file # # Brian K. Elza 3/7/95 # XTE GSFC/NASA # # A C-shell script performing similar operations will also exist. # version 1.0.0 3/7/95 use Getopt::Std; #============================================================# # # See if there are any flags: # getopts('h'); if (defined $opt_h) { print <); if($infile =~ /^./){ chop($infile);} else{ $infile = $infile2[0]; } @infile2=&runcom('pget sebitmask filter'); chop($infile2[0]); print "Enter filtering expression or \@file containing that expression:[$infile2[0]]"; ($filter = ); if($filter =~ /^./){ chop($filter);} else{ $filter = $infile2[0]; } @infile2=&runcom('pget sebitmask column'); chop($infile2[0]); print "Enter the column name to be operated upon:[$infile2[0]]"; ($column = ); if($column =~ /^./){ chop($column);} else{ $column = $infile2[0]; } @infile2=&runcom('pget sebitmask bitfile'); chop($infile2[0]); print "Enter the output bitfile name to contain processed boolean expression:[$infile2[0]]"; ($bitfile = ); if($bitfile =~ /^./){ chop($bitfile);} else{ $bitfile = $infile2[0]; } @infile2=&runcom('pget fselect outfile'); chop($infile2[0]); print "Enter the output filename to contain the processed data:[$infile2[0]]"; ($outfile = ); if($outfile =~ /^./){ chop($outfile);} else{ $outfile = $infile2[0]; } if(!($outfile =~ /^./)){ $outfile = "out_fselect_${$}"; print "\nNo output file specified. We will create $outfile\n"; } # Unfortunately due to XPI limitations we CANNOT pass in the filter expression # as a string. We will have to write it to a file, close the file, and then # input that file. Then we will delete the temporary file. open(OUTPUT_FILE,">outfile_${$}") || die "Sorry can't open outfile_${$}\n"; # Open a unique output file print OUTPUT_FILE "$filter\n"; # Copy files from INFILE to OUTPUT close(OUTPUT_FILE); # Close the output file. $tmp_file='@'."outfile_${$}"; @result=&runcom('sebitmask infile="'.$infile.'" filter="'.$tmp_file.'" mtoken=M[1]{1} column="'.$column.'" bitfile="'.$bitfile.'" dryrun=yes clobber=yes mode=h'); #print "@result"; #print "\n\n"; $length_of_array = @result; $i_count=0; for($i_count=0; $i_count <= $length_of_array; $i_count++){ if($result[$i_count] =~ /^TEVTB value read in was:/) { print"TEVTB is \n $result[$i_count +1]\n"; @tevtb_array = split(/\^/,$result[$i_count+1]); chop($tevtb_array[0]); print"First part is \n$tevtb_array[0]\n"; } } print "\n"; print "Running sebitmask:\n"; @result2=&runcom('sebitmask infile="'.$infile.'" filter="'.$tmp_file.' " mtoken=M[1]{1} column="'.$column.'" bitfile="'.$bitfile.'" dryrun=no clobber=yes mode=h'); print "Completed running sebitmask:\n\n"; @result3=&runcom('pset sebitmask infile="'.$infile.'" filter="'.$tmp_file.' " mtoken=M[1]{1} column="'.$column.'" bitfile="'.$bitfile.'" '); print "Updating parfile for sebitmask:\n\n"; print "Filtering expression entered to SESELECT stored in outfile_${$}\n"; print "Do you want to save this file? [Yes,No]"; chop($answer10 = ); if($answer10 =~ /^[Yy]/){ } else{ print "Deleting outfile_${$}\n\n"; unlink("outfile_${$}") || print "Having trouble deleting outfile_${$}\n"; # Remove the output file if not told to save it. } print "Using output of sebitmask as input and running Fselect:\n"; @resultf=&runcom('fselect infile="'.$infile.'" outfile="'.$outfile.'" expr="@'.$bitfile.'" mode=h'); @resultf=&runcom('pset fselect infile="'.$infile.'" outfile="'.$outfile.'" expr="@'.$bitfile.'" '); print "Completed running fselect and created $outfile\n"