IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 24, 2020, 11:05:10 AM (6 years ago)
Author:
tdeboer
Message:

update to ghostbuster.pl to make it work

File:
1 edited

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
     3use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     4use Pod::Usage qw( pod2usage );
     5
     6use DBI;
     7use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock'; # Socket for mysql
     8
     9# this saves the original arguments for later reporting
     10my @ARGS = @ARGV;
     11
     12GetOptions(
     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 );
     21pod2usage( -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';
    1628
    1729open (L,">>ghostbuster.log");
    1830
    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     }
     31if (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"; }
    3036
    3137    open(C,">./${exp_name}.coord");
     
    3541    $coords = (split /\n/, `ppCoord -astrom $smf -radec ${exp_name}.coord`)[-1];
    3642    @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   
    4245    unless (defined($results[5])&&
    4346            (abs($results[0] - $ra) < 1e-3)&&
     
    5255
    5356    $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`);
    5659        if ($opt{C}) {
    5760            system("ppImage -file neb:///${raw_file} ./${exp_name} -recipe PPIMAGE CHIP  -Db CHIP.FITS TRUE ");
     
    6669        push @ds9s, "./${exp_name}.${chip}.ch.fits -regions format xy -regions system image -regions ./${exp_name}.reg -pan to $x_pos $y_pos image ";   
    6770    }
    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
    7173    # Determine if cross talk and extract magnitudes
    7274    $cell_x = -1;
     
    106108    #rule 1
    107109   
    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"; }
    111112
    112113    if (($ota_x == 2)&&($cell_x == 3)) {
     
    252253close(L);
    253254
    254 unless(exists($opt{x})) {
     255unless($noimage) {
    255256    $options = join " ", @ds9s;
    256257    system("ds9 $options");
    257258}
     259
     260
     261
     262
     263
Note: See TracChangeset for help on using the changeset viewer.