IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 5:06:01 PM (16 years ago)
Author:
watersc1
Message:

Almost working version of the mask-stats/software revision code.

Almost.

Location:
branches/czw_branch/20100427
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100427

  • branches/czw_branch/20100427/ippScripts/scripts/magic_process.pl

    r27718 r28017  
    9999    }
    100100
    101     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     101    $inputs = $mdcParser->parse_list(join "", @$stdout_buf) or
    102102        &my_die("Unable to parse metadata config doc", $magic_id, $node, $PS_EXIT_PROG_ERROR);
    103 
    104     $inputs = parse_md_list($metadata) or
    105         &my_die("Unable to parse metadata list", $magic_id, $node, $PS_EXIT_PROG_ERROR);
    106103}
    107104
    108105
    109106my @outputs;
     107my $inverse;                    # Using inverse diff?
    110108### Do the heavy lifting
    111109{
     
    263261                cat_list_to_list($mfh, $in_path_base, "mask.list");
    264262                cat_list_to_list($wfh, $in_path_base, "weight.list");
     263
     264                if ($innode->{inverse}) {
     265                    $inverse = 1;
     266                }
    265267            }
    266268            close $in_fh;
     
    330332    }
    331333}
     334
    332335if ($node eq "root") {
    333336    my $streaks_file = "$outroot.streaks";
     
    348351    &run_verifystreaks($baseroot);
    349352
    350     my $command = "$magictool -addmask";
    351     $command   .= " -magic_id $magic_id";
    352     $command   .= " -uri $streaks_file";
    353     $command   .= " -streaks $num_streaks";
    354     $command   .= " -dbname $dbname" if defined $dbname;
    355 
    356     # Add the processed file to the database
    357     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;
    358359        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    359360            run(command => $command, verbose => $verbose);
    360         unless ($success) {
    361             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    362             # This isn't going to work because our result was already entered.
    363             &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code);
    364         }
    365     } else {
    366         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        }
    367405    }
    368406}
Note: See TracChangeset for help on using the changeset viewer.