IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2010, 9:31:50 AM (16 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/ippScripts/scripts/diffphot.pl

    r28439 r28794  
    3131my $diffphottool = can_run('diffphottool') or (warn "Can't find diffphottool" and $missing_tools = 1);
    3232my $psphot = can_run('psphot') or (warn "Can't find psphot" and $missing_tools = 1);
    33 my $ppArith = can_run('ppArith') or (warn "Can't find ppArith" and $missing_tools = 1);
    3433my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    3534if ($missing_tools) {
     
    177176# Do reverse photometry
    178177if ($bothways) {
    179     my ($tempFile, $tempName) = tempfile( "/tmp/diffphot.$diff_phot_id.$skycell_id.XXXX",
    180                                           UNLINK => !$save_temps, SUFFIX => '.fits' );
    181     {
    182         my ($tempRoot) = $tempName =~ /^(.*).fits/;
    183         my $command = "$ppArith $tempRoot -file1 $inputImage -op \\* -const2 -1";
    184         unless ($no_op) {
    185             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    186                 run(command => $command, verbose => $verbose);
    187             unless ($success) {
    188                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    189                 &my_die("Unable to perform ppArith: $error_code", $diff_phot_id, $skycell_id, $error_code);
    190             }
    191             &my_die("Couldn't find expected output file: $tempName", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($tempName);
    192         } else {
    193             print "Skipping command: $command\n";
    194         }
    195     }
     178    my $inputImage = $ipprc->filename("PPSUB.INVERSE", $inputPath);
     179    my $inputMask = $ipprc->filename("PPSUB.INVERSE.MASK", $inputPath);
     180    my $inputVariance = $ipprc->filename("PPSUB.INVERSE.VARIANCE", $inputPath);
     181    &my_die("Couldn't find input: $inputImage", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputImage);
     182    &my_die("Couldn't find input: $inputMask", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputMask);
     183    &my_die("Couldn't find input: $inputVariance", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputVariance);
    196184
    197185    # Get the output filenames
     
    201189
    202190    my $command = "$psphot $outroot.neg";
    203     $command .= " -file $tempName";
     191    $command .= " -file $inputImage";
    204192    $command .= " -mask $inputMask";
    205193    $command .= " -variance $inputVariance";
     
    252240}
    253241
    254 unless ($no_update) {
     242{
    255243    my $command = "$diffphottool -diff_phot_id $diff_phot_id -skycell_id $skycell_id";
    256244    $command .= " -done -path_base $outroot";
    257     $command .= " -magicked $magicked" if $magicked;
     245    $command .= " -magicked $magicked" if defined $magicked;
    258246    $command .= " -quality $quality" if defined $quality;
    259247    $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     
    261249    $command .= " -dbname $dbname" if defined $dbname;
    262250
    263     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    264         run(command => $command, verbose => $verbose);
    265     unless ($success) {
    266         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    267         &my_die("Command failed: $error_code", $diff_phot_id, $skycell_id, $error_code);
     251    unless ($no_update) {
     252        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     253            run(command => $command, verbose => $verbose);
     254        unless ($success) {
     255            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     256            &my_die("Command failed: $error_code", $diff_phot_id, $skycell_id, $error_code);
     257        }
     258    } else {
     259        print "Skipping update: $command\n";
    268260    }
    269261}
Note: See TracChangeset for help on using the changeset viewer.