- Timestamp:
- Mar 24, 2020, 11:05:10 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tools/ghostbuster.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/ghostbuster.pl
r34801 r41313 1 #! /usr/local/bin/perl -w 2 3 use Getopt::Std; 4 5 getopts('hvxC',\%opt); 6 7 if (exists($opt{h})) { 8 print STDERR "./ghostbuster.pl <inlist>\n"; 9 print STDERR " inlist format: exp_name RA DEC\n"; 10 print STDERR " options: -h This help.\n"; 11 print STDERR " -v Be more verbose.\n"; 12 print STDERR " -x Don't bother with images.\n"; 13 14 exit(1); 15 } 1 #!/usr/bin/env perl 2 3 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 4 use Pod::Usage qw( pod2usage ); 5 6 use DBI; 7 use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock'; # Socket for mysql 8 9 # this saves the original arguments for later reporting 10 my @ARGS = @ARGV; 11 12 GetOptions( 13 'dbname|d=s' => \$dbname, # Database name 14 'verbose' => \$verbose, # Print to stdout 15 'expname|d=s' => \$exp_name, # exposure name 16 'ra|d=s' => \$ra, # ra 17 'dec|d=s' => \$dec, # dec 18 'noimage' => \$noimage, # Don't bother with images 19 'chip' => \$chip, # chip mode? 20 ) or pod2usage( 2 ); 21 pod2usage( -msg => "Unknown option(s): @ARGV", -exitval => 2 ) if @ARGV; 22 23 # database connection information: 24 $dbhost = 'ippdb08'; 25 $dbname = 'gpc1' unless defined $dbname; 26 $dbuser = 'ippuser'; 27 $dbpass = 'ippuser'; 16 28 17 29 open (L,">>ghostbuster.log"); 18 30 19 while (<>) { 20 chomp; 21 ($exp_name,$ra,$dec) = split /\s+/; 22 if (exists($opt{v})) { 23 print "Working on $exp_name at position $ra $dec\n"; 24 } 25 26 $smf = (split /\n/, `find_images.pl -EVFD -n $exp_name`)[-1]; 27 if (exists($opt{v})) { 28 print " Found SMF: $smf\n"; 29 } 31 if (1) { 32 if ($verbose) { print "Working on $exp_name at position $ra $dec\n"; } 33 34 $smf = (split /\n/, `find_images.pl -EVFD -n $exp_name -z $dbname`)[-1]; 35 if ($verbose) { print " Found SMF: $smf\n"; } 30 36 31 37 open(C,">./${exp_name}.coord"); … … 35 41 $coords = (split /\n/, `ppCoord -astrom $smf -radec ${exp_name}.coord`)[-1]; 36 42 @results = split /\s+/,$coords; 37 38 if (exists($opt{v})) { 39 print " Obtained coordinate transform: $coords\n"; 40 } 41 43 if ($verbose) { print " Obtained coordinate transform: $coords\n"; } 44 42 45 unless (defined($results[5])&& 43 46 (abs($results[0] - $ra) < 1e-3)&& … … 52 55 53 56 $raw_file = ''; 54 unless( exists($opt{x})) {55 chomp($raw_file = `find_images.pl -RY -n $exp_name -O $ota `);57 unless($noimage) { 58 chomp($raw_file = `find_images.pl -RY -n $exp_name -O $ota -z $dbname`); 56 59 if ($opt{C}) { 57 60 system("ppImage -file neb:///${raw_file} ./${exp_name} -recipe PPIMAGE CHIP -Db CHIP.FITS TRUE "); … … 66 69 push @ds9s, "./${exp_name}.${chip}.ch.fits -regions format xy -regions system image -regions ./${exp_name}.reg -pan to $x_pos $y_pos image "; 67 70 } 68 if (exists($opt{v})) { 69 print " Summary: $exp_name $ra $dec $x_pos $y_pos $chip $ota $smf $raw_file\n"; 70 } 71 if ($verbose) { print " Summary: $exp_name $ra $dec $x_pos $y_pos $chip $ota $smf $raw_file\n"; } 72 71 73 # Determine if cross talk and extract magnitudes 72 74 $cell_x = -1; … … 106 108 #rule 1 107 109 108 if ($opt{v}) { 109 print ">> $ota_x $ota_y $cell_x $cell_y\n"; 110 } 110 111 if ($verbose) { print ">> $ota_x $ota_y $cell_x $cell_y\n"; } 111 112 112 113 if (($ota_x == 2)&&($cell_x == 3)) { … … 252 253 close(L); 253 254 254 unless( exists($opt{x})) {255 unless($noimage) { 255 256 $options = join " ", @ds9s; 256 257 system("ds9 $options"); 257 258 } 259 260 261 262 263
Note:
See TracChangeset
for help on using the changeset viewer.
