IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 12:49:05 PM (16 years ago)
Author:
eugene
Message:

merging changes from trunk into branches/pap

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ippScripts/scripts/magic_process.pl

    r27634 r28003  
    88use Sys::Hostname;
    99my $host = hostname();
     10my $date = `date`;
    1011print "\n\n";
    11 print "Starting script $0 on $host\n\n";
     12print "Starting script $0 on $host at $date\n\n";
    1213
    1314use vars qw( $VERSION );
     
    9899    }
    99100
    100     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     101    $inputs = $mdcParser->parse_list(join "", @$stdout_buf) or
    101102        &my_die("Unable to parse metadata config doc", $magic_id, $node, $PS_EXIT_PROG_ERROR);
    102 
    103     $inputs = parse_md_list($metadata) or
    104         &my_die("Unable to parse metadata list", $magic_id, $node, $PS_EXIT_PROG_ERROR);
    105103}
    106104
    107105
    108106my @outputs;
     107my $inverse;                    # Using inverse diff?
    109108### Do the heavy lifting
    110109{
     
    262261                cat_list_to_list($mfh, $in_path_base, "mask.list");
    263262                cat_list_to_list($wfh, $in_path_base, "weight.list");
     263
     264                if ($innode->{inverse}) {
     265                    $inverse = 1;
     266                }
    264267            }
    265268            close $in_fh;
     
    329332    }
    330333}
     334
    331335if ($node eq "root") {
    332336    my $streaks_file = "$outroot.streaks";
     
    347351    &run_verifystreaks($baseroot);
    348352
    349     my $command = "$magictool -addmask";
    350     $command   .= " -magic_id $magic_id";
    351     $command   .= " -uri $streaks_file";
    352     $command   .= " -streaks $num_streaks";
    353     $command   .= " -dbname $dbname" if defined $dbname;
    354 
    355     # Add the processed file to the database
    356     unless ($no_update) {
     353    my $exp_id;                 # Exposure identifier
     354    my $cam_path;               # Camera stage path_base
     355    {
     356        my $command = "magictool -exposure -magic_id $magic_id";
     357        $command .= " -inverse" if defined $inverse;
     358        $command .= " -dbname $dbname" if defined $dbname;
    357359        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    358360            run(command => $command, verbose => $verbose);
    359         unless ($success) {
    360             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    361             # This isn't going to work because our result was already entered.
    362             &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code);
    363         }
    364     } else {
    365         print "Skipping command: $command\n";
     361        my $exposures = $mdcParser->parse_list(join "", @$stdout_buf);
     362        my $exp = $$exposures[0]; # Exposure of interest (should only be one)
     363
     364        $exp_id = $exp->{exp_id};
     365        $cam_path = $exp->{path_base};
     366    }
     367
     368    {
     369        my $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path); # Astrometry file
     370        my $streaks = "$outroot.streaks";                           # Streaks file
     371        my $clusters = "$baseroot.verify/${exp_id}_clusterPos.txt"; # Clusters file
     372
     373        my $command = "ppCoord -astrom $astrom -streaks $streaks";
     374        if ($ipprc->file_exists($clusters)) {
     375            $command .= " -clusters $clusters";
     376        }
     377
     378        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     379            run(command => $command, verbose => $verbose);
     380        open my $coords, "> $outroot.coords";
     381        print $coords join("", @$stdout_buf);
     382        close $coords;
     383    }
     384
     385
     386    {
     387        my $command = "$magictool -addmask";
     388        $command   .= " -magic_id $magic_id";
     389        $command   .= " -uri $streaks_file";
     390        $command   .= " -streaks $num_streaks";
     391        $command   .= " -dbname $dbname" if defined $dbname;
     392
     393        # Add the processed file to the database
     394        unless ($no_update) {
     395            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     396                run(command => $command, verbose => $verbose);
     397            unless ($success) {
     398                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     399                # This isn't going to work because our result was already entered.
     400                &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code);
     401            }
     402        } else {
     403            print "Skipping command: $command\n";
     404        }
    366405    }
    367406}
Note: See TracChangeset for help on using the changeset viewer.