IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20301


Ignore:
Timestamp:
Oct 21, 2008, 3:25:14 PM (18 years ago)
Author:
Paul Price
Message:

warptool now takes a '-accept' flag if it's to be accepted. This is a
bit more intuitive from the standpoint of ppStatsFromMetadata.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/warp_skycell.pl

    r20284 r20301  
    203203    if ($do_stats) {
    204204        # Check first for the stats file, and if the ACCEPT flag is set.
    205         my $outputStatsReal = $ipprc->file_resolve($outputStats);
     205        my $outputStatsReal = $ipprc->file_resolve($outputStats);
    206206        &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless -f $outputStatsReal;
    207207
    208         # measure chip stats
    209         $command = "$ppStatsFromMetadata $outputStatsReal - WARP_SKYCELL";
    210         ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    211             run(command => $command, verbose => $verbose);
    212         unless ($success) {
    213             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    214             &my_die("Unable to perform ppStatsFromMetadata: $error_code", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR);
    215         }
    216         foreach my $line (@$stdout_buf) {
    217             $cmdflags .= " $line";
    218         }
    219         chomp $cmdflags;
    220 
    221         # the stats includes ACCEPT as a boolean: convert the T/F value to 0/1
    222         my $acceptFlag = &value_for_flag ($cmdflags, "-accept");
    223         $accept = ($acceptFlag eq "T") ? 1 : 0;
    224         if ($accept && !$ipprc->file_exists($outputPSF)) {
    225             $accept = 0;
    226         }
    227 
    228         if ($accept) {
     208        # measure chip stats
     209        $command = "$ppStatsFromMetadata $outputStatsReal - WARP_SKYCELL";
     210        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     211            run(command => $command, verbose => $verbose);
     212        unless ($success) {
     213            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     214            &my_die("Unable to perform ppStatsFromMetadata: $error_code", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR);
     215        }
     216        foreach my $line (@$stdout_buf) {
     217            $cmdflags .= " $line";
     218        }
     219        chomp $cmdflags;
     220
     221        if ($cmdflags =~ /-accept/) {
    229222            &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
    230223            &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     
    240233            $command .= " -tess_id $tess_dir";
    241234            $command .= " -path_base $outroot"; # needed for logfile lookups
    242             $command .= " -ignore"           if not $accept; # Completed succesfully, but can't produce product
     235
    243236            $command .= " -uri $outputImage" if $accept;
    244237            $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
     
    272265        }
    273266    }
    274 }
    275 
    276 sub value_for_flag
    277 {
    278     my $cmdflags = shift;
    279     my $flag = shift;
    280 
    281     my $value = 0.0;
    282     if ($cmdflags =~ m|$flag|) {
    283         ($value) = $cmdflags =~ m|$flag\s+(\S+)|;
    284     }
    285     $value;
    286267}
    287268
Note: See TracChangeset for help on using the changeset viewer.