IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17787


Ignore:
Timestamp:
May 23, 2008, 3:06:45 PM (18 years ago)
Author:
Paul Price
Message:

Adding additional statistics for diffs

Location:
trunk/ippScripts/scripts
Files:
2 edited

Legend:

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

    r17671 r17787  
    3131    'outroot=s'         => \$outroot, # Output root name
    3232    'verbose'           => \$verbose,   # Print to stdout
    33     'no-update'         => \$no_update, # Don't update the database?
     33    'no-update'         => \$no_update, # Don't update the database?
    3434    'no-op'             => \$no_op, # Don't do any operations?
    3535) or pod2usage( 2 );
     
    3939    -msg => "Required options: --diff_id",
    4040    -exitval => 3,
    41           ) unless defined $diff_id
     41          ) unless defined $diff_id
    4242    and defined $outroot;
    4343
    44 my $STATS = 
    45    [   
     44my $STATS =
     45   [
    4646       #          PPSTATS KEYWORD         STATISTIC          DIFFTOOL FLAG
    4747       { name => "ROBUST_MEDIAN",   type => "mean", flag => "-bg",         dtype => "float" },
    4848       { name => "ROBUST_STDEV",    type => "rms",  flag => "-bg_stdev",   dtype => "float" },
    49 #      { name => "DT_DIFF",         type => "sum",  flag => "-dtime_diff", dtype => "float" },
     49       { name => "DT_DIFF",         type => "sum",  flag => "-dtime_diff", dtype => "float" },
     50       { name => "SUBTRACTION.NUM", type => "mean", flag => "-stamps_num", dtype => "int" },
     51       { name => "SUBTRACTION.RMS", type => "mean", flag => "-stamps_rms", dtype => "float" },
     52       { name => "NUM_SOURCES",     type => "sum",  flag => "-sources",    dtype => "int" },
    5053       { name => "GOOD_PIXEL_FRAC", type => "mean", flag => "-good_frac",  dtype => "float" },
    5154   ];
     
    5659my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
    5760my $ppSub = can_run('ppSub') or (warn "Can't find ppSub" and $missing_tools = 1);
    58 if ($missing_tools) { 
     61if ($missing_tools) {
    5962    warn("Can't find required tools.");
    60     exit($PS_EXIT_CONFIG_ERROR); 
     63    exit($PS_EXIT_CONFIG_ERROR);
    6164}
    6265
    6366# Get list of components for subtraction
    64 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     67my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    6568my $files;
    6669{
     
    6871    $command .= " -dbname $dbname" if defined $dbname;
    6972    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    70         run(command => $command, verbose => $verbose);
     73        run(command => $command, verbose => $verbose);
    7174    unless ($success) {
    72         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    73         &my_die("Unable to perform difftool -inputskyfile: $error_code", $diff_id, $error_code);
     75        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     76        &my_die("Unable to perform difftool -inputskyfile: $error_code", $diff_id, $error_code);
    7477    }
    7578
    7679    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    77         &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
    78     $files = parse_md_list($metadata) or 
    79         &my_die("Unable to parse metadata list", $diff_id, $PS_EXIT_PROG_ERROR);
     80        &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
     81    $files = parse_md_list($metadata) or
     82        &my_die("Unable to parse metadata list", $diff_id, $PS_EXIT_PROG_ERROR);
    8083}
    8184
     
    8689my ($input, $inputMask, $inputWeight, $inputPath, $inputPSF); # Input files and path
    8790my ($template, $templateMask, $templateWeight, $templatePath, $templateSources); # Template files and path
    88 my $tess_id;                    # Tesselation identifier
    89 my $skycell_id;                 # Skycell identifier
    90 my $camera;                     # Camera
     91my $tess_id;                    # Tesselation identifier
     92my $skycell_id;                 # Skycell identifier
     93my $camera;                     # Camera
    9194foreach my $file (@$files) {
    9295    if (defined $file->{template} and $file->{template}) {
    93         $template = $file->{uri};
    94         $templatePath = $file->{path_base};
    95         if ($file->{warp_id} == 0) {
    96             $templateMask = "PPSTACK.OUTPUT.MASK";
    97             $templateWeight = "PPSTACK.OUTPUT.WEIGHT";
    98             $templateSources = "PSPHOT.OUTPUT";
    99         } else {
    100             $templateMask = "PSWARP.OUTPUT.MASK";
    101             $templateWeight = "PSWARP.OUTPUT.WEIGHT";
    102             $templateSources = "PSWARP.OUTPUT.SOURCES";
    103         }
    104     } else {
    105         $input = $file->{uri};
    106         $inputPath = $file->{path_base};
    107         if ($file->{warp_id} == 0) {
    108             $inputMask = "PPSTACK.OUTPUT.MASK";
    109             $inputWeight = "PPSTACK.OUTPUT.WEIGHT";
    110             $inputPSF = "PSPHOT.PSF.SAVE";
    111         } else {
    112             $inputMask = "PSWARP.OUTPUT.MASK";
    113             $inputWeight = "PSWARP.OUTPUT.WEIGHT";
    114             $inputPSF = "PSPHOT.PSF.SAVE";
    115         }
     96        $template = $file->{uri};
     97        $templatePath = $file->{path_base};
     98        if ($file->{warp_id} == 0) {
     99            $templateMask = "PPSTACK.OUTPUT.MASK";
     100            $templateWeight = "PPSTACK.OUTPUT.WEIGHT";
     101            $templateSources = "PSPHOT.OUTPUT";
     102        } else {
     103            $templateMask = "PSWARP.OUTPUT.MASK";
     104            $templateWeight = "PSWARP.OUTPUT.WEIGHT";
     105            $templateSources = "PSWARP.OUTPUT.SOURCES";
     106        }
     107    } else {
     108        $input = $file->{uri};
     109        $inputPath = $file->{path_base};
     110        if ($file->{warp_id} == 0) {
     111            $inputMask = "PPSTACK.OUTPUT.MASK";
     112            $inputWeight = "PPSTACK.OUTPUT.WEIGHT";
     113            $inputPSF = "PSPHOT.PSF.SAVE";
     114        } else {
     115            $inputMask = "PSWARP.OUTPUT.MASK";
     116            $inputWeight = "PSWARP.OUTPUT.WEIGHT";
     117            $inputPSF = "PSPHOT.PSF.SAVE";
     118        }
    116119    }
    117120    if (defined $tess_id) {
    118         &my_die("Tesselation identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
    119             $file->{tess_id} eq $tess_id;
    120     } else {
    121         $tess_id = $file->{tess_id};
     121        &my_die("Tesselation identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
     122            $file->{tess_id} eq $tess_id;
     123    } else {
     124        $tess_id = $file->{tess_id};
    122125    }
    123126    if (defined $skycell_id) {
    124         &my_die("Skycell identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
    125             $file->{skycell_id} eq $skycell_id;
    126     } else {
    127         $skycell_id = $file->{skycell_id};
     127        &my_die("Skycell identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
     128            $file->{skycell_id} eq $skycell_id;
     129    } else {
     130        $skycell_id = $file->{skycell_id};
    128131    }
    129132    if (defined $camera) {
    130         &my_die("Cameras don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
    131     } else {
    132         $camera = $file->{camera};
     133        &my_die("Cameras don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
     134    } else {
     135        $camera = $file->{camera};
    133136    }
    134137
     
    181184
    182185    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    183         run(command => $command, verbose => $verbose);
     186        run(command => $command, verbose => $verbose);
    184187    unless ($success) {
    185         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    186         &my_die("Unable to perform ppSub: $error_code", $diff_id, $error_code);
     188        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     189        &my_die("Unable to perform ppSub: $error_code", $diff_id, $error_code);
    187190    }
    188191    &my_die("Couldn't find expected output file: $outputName", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
     
    195198
    196199    # Get the statistics on the residual image
    197     my $statsFile;              # File handle
     200    my $statsFile;              # File handle
    198201    open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR);
    199202    my @contents = <$statsFile>; # Contents of file
    200203    close $statsFile;
    201204    my $metadata = $mdcParser->parse(join "", @contents) or
    202         &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
     205        &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
    203206    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $diff_id, $PS_EXIT_PROG_ERROR);
    204207}
     
    208211    # Add the subtraction result
    209212    {
    210         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
    211         $command .= $stats->cmdflags();
    212         $command .= " -dbname $dbname" if defined $dbname;
    213        
    214         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    215             run(command => $command, verbose => $verbose);
    216         unless ($success) {
    217             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    218             &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $error_code);
    219         }
     213        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
     214        $command .= $stats->cmdflags();
     215        $command .= " -dbname $dbname" if defined $dbname;
     216
     217        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     218            run(command => $command, verbose => $verbose);
     219        unless ($success) {
     220            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     221            &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $error_code);
     222        }
    220223    }
    221224
    222225    # Register the run as completed
    223226    {
    224         my $command = "$difftool -updaterun -diff_id $diff_id -state stop"; # Command to run difftool
    225         $command .= " -dbname $dbname" if defined $dbname;
    226 
    227         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    228             run(command => $command, verbose => $verbose);
    229         unless ($success) {
    230             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    231             warn("Unable to perform difftool -updaterun: $error_code\n");
    232             exit($error_code);
    233         }
     227        my $command = "$difftool -updaterun -diff_id $diff_id -state stop"; # Command to run difftool
     228        $command .= " -dbname $dbname" if defined $dbname;
     229
     230        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     231            run(command => $command, verbose => $verbose);
     232        unless ($success) {
     233            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     234            warn("Unable to perform difftool -updaterun: $error_code\n");
     235            exit($error_code);
     236        }
    234237    }
    235238}
     
    238241sub my_die
    239242{
    240     my $msg = shift;            # Warning message on die
    241     my $diff_id = shift;        # Diff identifier
    242     my $exit_code = shift;      # Exit code to add
     243    my $msg = shift;            # Warning message on die
     244    my $diff_id = shift;        # Diff identifier
     245    my $exit_code = shift;      # Exit code to add
    243246
    244247    warn($msg);
    245248    if (defined $diff_id and not $no_update) {
    246         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
    247         $command .= " -dbname $dbname" if defined $dbname;
     249        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
     250        $command .= " -dbname $dbname" if defined $dbname;
    248251        run(command => $command, verbose => $verbose);
    249252    }
  • trunk/ippScripts/scripts/warp_skycell.pl

    r17760 r17787  
    3434    'outroot=s'         => \$outroot, # Output root name
    3535    'verbose'           => \$verbose,   # Print to stdout
    36     'no-update'         => \$no_update, # Don't update the database?
     36    'no-update'         => \$no_update, # Don't update the database?
    3737    'no-op'             => \$no_op, # Don't do any operations?
    3838    'save-temps'        => \$save_temps, # Save temporary files?
     
    5151$ipprc->define_camera($camera);
    5252
    53 my $STATS = 
    54    [   
     53my $STATS =
     54   [
    5555       #          PPSTATS KEYWORD         STATISTIC          WARPTOOL FLAG
    5656       { name => "ROBUST_MEDIAN",   type => "mean", flag => "-bg",         dtype => "float" },
    5757       { name => "ROBUST_STDEV",    type => "rms",  flag => "-bg_stdev",   dtype => "float" },
    58 #      { name => "DT_WARP",         type => "sum",  flag => "-dtime_warp", dtype => "float" },
     58       { name => "DT_WARP",         type => "sum",  flag => "-dtime_warp", dtype => "float" },
    5959       { name => "GOOD_PIXEL_FRAC", type => "mean", flag => "-good_frac",  dtype => "float" },
     60       { name => "RANGE.XMIN",      type => "mean", flag => "-xmin",       dtype => "int"   },
     61       { name => "RANGE.XMAX",      type => "mean", flag => "-xmax",       dtype => "int"   },
     62       { name => "RANGE.YMIN",      type => "mean", flag => "-ymin",       dtype => "int"   },
     63       { name => "RANGE.YMAX",      type => "mean", flag => "-ymax",       dtype => "int"   },
    6064   ];
    6165my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
     
    6670my $pswarp = can_run('pswarp') or (warn "Can't find pswarp" and $missing_tools = 1);
    6771my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    68 if ($missing_tools) { 
     72if ($missing_tools) {
    6973    warn("Can't find required tools.");
    70     exit($PS_EXIT_CONFIG_ERROR); 
     74    exit($PS_EXIT_CONFIG_ERROR);
    7175}
    7276
    7377# Get list of component imfiles for exposure
    74 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     78my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    7579my $imfiles;
    7680{
     
    7882    $command .= " -dbname $dbname" if defined $dbname;
    7983    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    80         run(command => $command, verbose => $verbose);
    81     unless ($success) {
    82         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    83         &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
     84        run(command => $command, verbose => $verbose);
     85    unless ($success) {
     86        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     87        &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
    8488    }
    8589
    8690    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    87         &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    88     $imfiles = parse_md_list($metadata) or 
    89         &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
     91        &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
     92    $imfiles = parse_md_list($metadata) or
     93        &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    9094}
    9195
    9296# Where do we get the astrometry source from?
    93 my $astromSource;               # The astrometry source
     97my $astromSource;               # The astrometry source
    9498{
    9599    my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -";
    96100    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    97         run(command => $command, verbose => $verbose);
    98     unless ($success) {
    99         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    100         &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $error_code);
     101        run(command => $command, verbose => $verbose);
     102    unless ($success) {
     103        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     104        &my_die("Unable to perform ppConfigDump: $error_code", $warp_id, $error_code);
    101105    }
    102106    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    103         &my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_PROG_ERROR);
     107        &my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_PROG_ERROR);
    104108    $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE');
    105109}
     
    128132my $wrote_astrom = 0;
    129133foreach my $imfile (@$imfiles) {
    130     my $image = $imfile->{uri}; # Image name
     134    my $image = $imfile->{uri}; # Image name
    131135    my $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name
    132136    my $weight = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name
     
    135139    &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask);
    136140
    137     my $astrom;         # Astrometry file
     141    my $astrom;         # Astrometry file
    138142    if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
    139         $astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
     143        $astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
    140144    } elsif ($astromSource eq 'PSASTRO.OUTPUT') {
    141         my $chipRoot = $imfile->{chip_path_base};
    142         my $classID = $imfile->{class_id};
    143         $astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
     145        my $chipRoot = $imfile->{chip_path_base};
     146        my $classID = $imfile->{class_id};
     147        $astrom = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
    144148    }
    145149
    146150    &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless defined $astrom and $ipprc->file_exists($astrom);
    147    
     151
    148152    print $imageFile  "$image\n";
    149153    print $maskFile   "$mask\n";
    150154    print $weightFile "$weight\n";
    151    
     155
    152156    if (!$wrote_astrom) {
    153         print $astromFile "$astrom\n";
    154         # XXX simplify this?  only ever have one file for astrometry (must be MEF)
    155         if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
    156             $wrote_astrom = 1;
    157         }
     157        print $astromFile "$astrom\n";
     158        # XXX simplify this?  only ever have one file for astrometry (must be MEF)
     159        if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
     160            $wrote_astrom = 1;
     161        }
    158162    }
    159163}
     
    165169
    166170# Run pswarp
    167 my $accept = 1;                 # Accept the skycell?
     171my $accept = 1;                 # Accept the skycell?
    168172unless ($no_op) {
    169173    my $command = "$pswarp";
     
    175179    $command .= " -stats $outputStats";
    176180    $command .= " -recipe PPSTATS WARPSTATS";
    177     $command .= " -psf";        # Turn on PSF determination
     181    $command .= " -psf";        # Turn on PSF determination
    178182    $command .= " -tracedest $traceDest -log $logDest";
    179183
    180184    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    181         run(command => $command, verbose => $verbose);
    182     unless ($success) {
    183         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    184         &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
     185        run(command => $command, verbose => $verbose);
     186    unless ($success) {
     187        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     188        &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
    185189    }
    186190
     
    188192    &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);
    189193    # Get the statistics on the warped image
    190     my $statsFile;              # File handle
     194    my $statsFile;              # File handle
    191195    open $statsFile, $ipprc->file_resolve($outputStats) or die "Can't open statistics file $outputStats: $!\n";
    192196    my @contents = <$statsFile>; # Contents of file
     
    195199
    196200    my $metadata = $mdcParser->parse($contents)
    197         or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
     201        or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    198202    $accept = metadataLookupBool($metadata, "ACCEPT");
    199203    if ($accept) {
    200         $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    201        
    202         &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
    203         &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    204         &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
    205         &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
    206         &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF);
     204        $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
     205
     206        &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
     207        &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     208        &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
     209        &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
     210        &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF);
    207211#    &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
    208212#    &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
     
    218222
    219223    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    220         run(command => $command, verbose => $verbose);
    221     unless ($success) {
    222         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    223         warn("Unable to perform warptool -addwarped: $error_code\n");
    224         exit($error_code);
     224        run(command => $command, verbose => $verbose);
     225    unless ($success) {
     226        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     227        warn("Unable to perform warptool -addwarped: $error_code\n");
     228        exit($error_code);
    225229    }
    226230}
     
    228232sub my_die
    229233{
    230     my $msg = shift;            # Warning message on die
    231     my $warp_id = shift;        # Warp identifier
    232     my $skycell_id = shift;     # Skycell identifier
    233     my $tess_id = shift;        # Tesselation identifier
    234     my $exit_code = shift;      # Exit code to add
     234    my $msg = shift;            # Warning message on die
     235    my $warp_id = shift;        # Warp identifier
     236    my $skycell_id = shift;     # Skycell identifier
     237    my $tess_id = shift;        # Tesselation identifier
     238    my $exit_code = shift;      # Exit code to add
    235239
    236240    warn($msg);
    237241    if (defined $warp_id and defined $skycell_id and defined $tess_id and not $no_update) {
    238         my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
    239         $command .= " -dbname $dbname" if defined $dbname;
     242        my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
     243        $command .= " -dbname $dbname" if defined $dbname;
    240244        run(command => $command, verbose => $verbose);
    241245    }
Note: See TracChangeset for help on using the changeset viewer.