IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2008, 11:43:34 AM (18 years ago)
Author:
Paul Price
Message:

Need to know the database name so that concepts (thinking specifically of CHIP.TEMP for GPC1) can be derived from the database.

Location:
trunk/ippScripts/scripts
Files:
3 edited

Legend:

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

    r17671 r17941  
    3636    'outroot|w=s'       => \$outroot, # output file base name
    3737    'dbname|d=s'        => \$dbname, # Database name
    38     'reduction=s'       => \$reduction, # Reduction class
     38    'reduction=s'       => \$reduction, # Reduction class
    3939    'verbose'           => \$verbose,   # Print to stdout
    4040    'no-update'         => \$no_update,
     
    4444pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4545pod2usage( -msg => "Required options: --det_id --exp_id --class_id --det_type --exp_tag --input_uri --camera --outroot",
    46            -exitval => 3) unless
     46           -exitval => 3) unless
    4747    defined $det_id    and
    48     defined $exp_id    and 
    49     defined $class_id  and 
    50     defined $det_type  and 
    51     defined $exp_tag   and 
    52     defined $input_uri and 
    53     defined $camera    and 
     48    defined $exp_id    and
     49    defined $class_id  and
     50    defined $det_type  and
     51    defined $exp_tag   and
     52    defined $input_uri and
     53    defined $camera    and
    5454    defined $outroot;
    5555
     
    6262
    6363# values to extract from output metadata and the stats to calculate
    64 my $STATS = 
    65    [   
     64my $STATS =
     65   [
    6666       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    6767       { name => "ROBUST_MEDIAN",  type => "mean",  flag => "-bg",            dtype => "float" },
     
    7575my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
    7676my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
    77 if ($missing_tools) { 
     77if ($missing_tools) {
    7878    warn("Can't find required tools.");
    79     exit($PS_EXIT_CONFIG_ERROR); 
     79    exit($PS_EXIT_CONFIG_ERROR);
    8080}
    8181$ppImage .= " -dbname $dbname" if defined $dbname;
     
    105105    $command .= " -stats $outputStats";
    106106    $command .= " -tracedest $traceDest -log $logDest";
     107    $command .= " -dbname $dbname" if defined $dbname;
    107108
    108109    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    109         run(command => $command, verbose => $verbose);
     110        run(command => $command, verbose => $verbose);
    110111    unless ($success) {
    111         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    112         &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $class_id, $error_code);
     112        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     113        &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $class_id, $error_code);
    113114    }
    114115
     
    119120
    120121    # Get the statistics on the processed image
    121     my $statsFile;              # File handle
     122    my $statsFile;              # File handle
    122123    open $statsFile, $ipprc->file_resolve("$outputStats") or die "Can't open statistics file $outputStats: $!\n";
    123124    my @contents = <$statsFile>; # Contents of file
     
    125126
    126127    # parse the statistics MDC file
    127     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     128    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    128129    my $metadata = $mdcParser->parse(join "", @contents)
    129130        or &my_die("Unable to parse metadata config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
     
    146147unless ($no_update) {
    147148    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    148         run(command => $command, verbose => $verbose);
     149        run(command => $command, verbose => $verbose);
    149150    unless ($success) {
    150         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    151         warn("Unable to perform dettool -addprocessedimfile: $error_code\n");
    152         exit($error_code);
     151        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     152        warn("Unable to perform dettool -addprocessedimfile: $error_code\n");
     153        exit($error_code);
    153154    }
    154155} else {
     
    159160{
    160161    my $msg = shift; # Warning message on die
    161     my $det_id = shift;         # Detrend identifier
     162    my $det_id = shift;         # Detrend identifier
    162163    my $exp_id = shift; # Exposure tag
    163164    my $class_id = shift; # Class identifier
     
    166167    carp($msg);
    167168    if (defined $det_id and defined $exp_id and defined $class_id and not $no_update) {
    168         my $command = "$dettool -addprocessedimfile";
    169         $command .= " -det_id $det_id";
    170         $command .= " -exp_id $exp_id";
    171         $command .= " -class_id $class_id";
    172         $command .= " -code $exit_code";
    173         $command .= " -dbname $dbname" if defined $dbname;
     169        my $command = "$dettool -addprocessedimfile";
     170        $command .= " -det_id $det_id";
     171        $command .= " -exp_id $exp_id";
     172        $command .= " -class_id $class_id";
     173        $command .= " -code $exit_code";
     174        $command .= " -dbname $dbname" if defined $dbname;
    174175        system ($command);
    175176    }
  • trunk/ippScripts/scripts/detrend_resid.pl

    r17671 r17941  
    3939    'outroot|w=s'       => \$outroot,   # output file base name
    4040    'dbname|d=s'        => \$dbname, # Database name
    41     'reduction=s'       => \$reduction, # Reduction class
     41    'reduction=s'       => \$reduction, # Reduction class
    4242    'verbose'           => \$verbose,   # Print to stdout
    4343    'no-update'         => \$no_update,
     
    4747pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4848pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend --outroot (not for 'verify' mode)",
    49            -exitval => 3) unless
    50     defined $det_id    and 
    51     defined $iter      and 
    52     defined $exp_id    and 
    53     defined $exp_tag   and 
    54     defined $class_id  and 
    55     defined $det_type  and 
    56     defined $input_uri and 
    57     defined $camera    and 
    58     defined $mode      and 
    59     defined $outroot   and 
     49           -exitval => 3) unless
     50    defined $det_id    and
     51    defined $iter      and
     52    defined $exp_id    and
     53    defined $exp_tag   and
     54    defined $class_id  and
     55    defined $det_type  and
     56    defined $input_uri and
     57    defined $camera    and
     58    defined $mode      and
     59    defined $outroot   and
    6060    (defined $detrend or lc($mode) eq 'verify');
    6161
     
    6464# Recipes to use as a function of detrend type and mode
    6565$reduction = 'DETREND' unless defined $reduction;
    66 my $recipe;                     # Name of recipe to use
     66my $recipe;                     # Name of recipe to use
    6767if ($mode eq 'master') {
    6868    $recipe = uc($det_type) . '_RESID';
     
    7575
    7676# values to extract from output metadata and the stats to calculate
    77 my $STATS = 
     77my $STATS =
    7878   [
    7979       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    8080       { name => "ROBUST_MEDIAN",      type => "mean",  flag => "-bg",             dtype => "float" },
    8181       { name => "ROBUST_MEDIAN",      type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
    82        { name => "ROBUST_STDEV",       type => "rms",   flag => "-bg_stdev",       dtype => "float" },
     82       { name => "ROBUST_STDEV",       type => "rms",   flag => "-bg_stdev",       dtype => "float" },
    8383       { name => "SAMPLE_SKEWNESS",    type => "mean",  flag => "-bg_skewness",    dtype => "float" },
    8484       { name => "SAMPLE_KURTOSIS",    type => "mean",  flag => "-bg_kurtosis",    dtype => "float" },
    85        { name => "FRINGE_0",           type => "mean",  flag => "-fringe_0",       dtype => "float" },
    86        { name => "FRINGE_ERR_0",       type => "rms",   flag => "-fringe_1",       dtype => "float" },
    87        { name => "FRINGE_0",           type => "stdev", flag => "-fringe_2",       dtype => "float" },
     85       { name => "FRINGE_0",           type => "mean",  flag => "-fringe_0",       dtype => "float" },
     86       { name => "FRINGE_ERR_0",       type => "rms",   flag => "-fringe_1",       dtype => "float" },
     87       { name => "FRINGE_0",           type => "stdev", flag => "-fringe_2",       dtype => "float" },
    8888       { name => "FRINGE_RESID_0",     type => "mean",  flag => "-fringe_resid_0", dtype => "float" },
    8989       { name => "FRINGE_RESID_ERR_0", type => "rms",   flag => "-fringe_resid_1", dtype => "float" },
     
    9292my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
    9393
    94 my $BINNED_STATS = 
     94my $BINNED_STATS =
    9595   [
    9696       { name => "ROBUST_STDEV",   type => "rms",   flag => "-bin_stdev" },
     
    100100# Flags to specify the particular detrend to use
    101101use constant DETRENDS => {
    102     'bias'     => '-bias',      # Specify the bias frame
    103     'dark'     => '-dark',      # Specify the dark frame
    104     'shutter'  => '-shutter',   # Specify the shutter frame
    105     'flat'     => '-flat',      # Specify the flat frame
    106     'domeflat' => '-flat',      # Specify the flat frame
    107     'skyflat'  => '-flat',      # Specify the flat frame
    108     'fringe'   => '-fringe',    # Specify the fringe frame
    109     'mask'     => '-mask',      # Specify the mask frame
    110     'darkmask' => '-mask',      # Specify the mask frame
    111     'flatmask' => '-mask',      # Specify the mask frame
     102    'bias'     => '-bias',      # Specify the bias frame
     103    'dark'     => '-dark',      # Specify the dark frame
     104    'shutter'  => '-shutter',   # Specify the shutter frame
     105    'flat'     => '-flat',      # Specify the flat frame
     106    'domeflat' => '-flat',      # Specify the flat frame
     107    'skyflat'  => '-flat',      # Specify the flat frame
     108    'fringe'   => '-fringe',    # Specify the fringe frame
     109    'mask'     => '-mask',      # Specify the mask frame
     110    'darkmask' => '-mask',      # Specify the mask frame
     111    'flatmask' => '-mask',      # Specify the mask frame
    112112};
    113113
    114 use constant DELETE_STATS => 0; # Delete the statistics file when done?
     114use constant DELETE_STATS => 0; # Delete the statistics file when done?
    115115
    116116# Look for programs we need
     
    119119my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);
    120120my $ppStats = can_run('ppStats') or (warn "Can't find ppStats" and $missing_tools = 1);
    121 if ($missing_tools) { 
     121if ($missing_tools) {
    122122    warn("Can't find required tools.");
    123     exit($PS_EXIT_CONFIG_ERROR); 
     123    exit($PS_EXIT_CONFIG_ERROR);
    124124}
    125125$ppImage .= " -dbname $dbname" if defined $dbname;
     
    147147    $command .= " -stats $outputStats";
    148148    $command .= " -tracedest $traceDest -log $logDest";
     149    $command .= " -dbname $dbname" if defined $dbname;
    149150
    150151    # Detrend to use in processing
    151152    if (lc($mode) ne 'verify') {
    152         my $detFlag = DETRENDS->{lc($det_type)};
    153         &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag;
    154         $command .= " $detFlag $detrend";
     153        my $detFlag = DETRENDS->{lc($det_type)};
     154        &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag;
     155        $command .= " $detFlag $detrend";
    155156    }
    156157
    157158    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    158         run(command => $command, verbose => $verbose);
     159        run(command => $command, verbose => $verbose);
    159160    unless ($success) {
    160         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    161         &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code);
     161        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     162        &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code);
    162163    }
    163164    &my_die("Couldn't find expected output file: $outputName", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputName);
     
    167168
    168169    # Load the raw output stats file
    169     my $statsFile;              # File handle
     170    my $statsFile;              # File handle
    170171    open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR);
    171172    my @contents = <$statsFile>; # Contents of file
     
    173174
    174175    # Parse the stats file contents into a metadata
    175     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     176    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    176177    my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    177178
     
    182183    $command = "$ppStats -recipe PPSTATS RESIDUAL $bin2Name";
    183184    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    184         run(command => $command, verbose => $verbose);
     185        run(command => $command, verbose => $verbose);
    185186    unless ($success) {
    186         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    187         &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code);
     187        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     188        &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code);
    188189    }
    189190
     
    211212unless ($no_update) {
    212213    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    213         run(command => $command, verbose => $verbose);
     214        run(command => $command, verbose => $verbose);
    214215    unless ($success) {
    215         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    216         warn("Unable to perform dettool -addresidimfile: $error_code\n");
    217         exit($error_code);
     216        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     217        warn("Unable to perform dettool -addresidimfile: $error_code\n");
     218        exit($error_code);
    218219    }
    219220} else {
     
    224225{
    225226    my $msg = shift; # Warning message on die
    226     my $det_id = shift;         # Detrend identifier
    227     my $iter = shift;           # Iteration
     227    my $det_id = shift;         # Detrend identifier
     228    my $iter = shift;           # Iteration
    228229    my $exp_id = shift; # Exposure tag
    229230    my $class_id = shift; # Class identifier
     
    232233    carp($msg);
    233234    if (defined $det_id and defined $iter and defined $exp_id and not $no_update) {
    234         my $command = "$dettool -addresidimfile";
    235         $command .= " -det_id $det_id";
    236         $command .= " -iteration $iter";
    237         $command .= " -exp_id $exp_id";
    238         $command .= " -class_id $class_id";
    239         $command .= " -code $exit_code";
    240         $command .= " -dbname $dbname" if defined $dbname;
     235        my $command = "$dettool -addresidimfile";
     236        $command .= " -det_id $det_id";
     237        $command .= " -iteration $iter";
     238        $command .= " -exp_id $exp_id";
     239        $command .= " -class_id $class_id";
     240        $command .= " -code $exit_code";
     241        $command .= " -dbname $dbname" if defined $dbname;
    241242        system ($command);
    242243    }
  • trunk/ippScripts/scripts/detrend_stack.pl

    r17762 r17941  
    3636    'outroot|w=s'       => \$outroot,   # output file base name
    3737    'dbname|d=s'        => \$dbname, # Database name
    38     'reduction=s'       => \$reduction, # Reduction class for processing
     38    'reduction=s'       => \$reduction, # Reduction class for processing
    3939    'verbose'           => \$verbose,   # Print to stdout
    4040    'save-temps'        => \$save_temps, # Save temporary files?
     
    4444
    4545pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    46 pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera --outroot", 
    47            -exitval => 3) unless
    48     defined $det_id   and 
    49     defined $iter     and 
    50     defined $class_id and 
    51     defined $det_type and 
     46pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera --outroot",
     47           -exitval => 3) unless
     48    defined $det_id   and
     49    defined $iter     and
     50    defined $class_id and
     51    defined $det_type and
    5252    defined $camera   and
    5353    defined $outroot;
     
    6464# XXX -bg_mean_stdev should take stdev of bg_mean if bg_mean_stdev == 0     (B)
    6565# XXX  (A) if imfile.Ncomp > 1, (B) if imfile.Ncomp == 1
    66 my $STATS = 
    67    [   
     66my $STATS =
     67   [
    6868       #          KEYWORD                 STATISTIC          CHIPTOOL FLAG
    6969       { name => "ROBUST_MEDIAN",  type => "mean",  flag => "-bg",             dtype => "float" },
     
    7777my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);
    7878my $ppMerge = can_run('ppMerge') or (warn "Can't find ppMerge" and $missing_tools = 1);
    79 if ($missing_tools) { 
     79if ($missing_tools) {
    8080    warn("Can't find required tools.");
    81     exit($PS_EXIT_CONFIG_ERROR); 
     81    exit($PS_EXIT_CONFIG_ERROR);
    8282}
    8383
    8484# The output file rule name depends on the detrend type
    8585my $FILERULES = { 'FLATMASK' => 'PPMERGE.OUTPUT.MASK',
    86                   'DARKMASK' => 'PPMERGE.OUTPUT.MASK',
    87                   'MASK'     => 'PPMERGE.OUTPUT.MASK',
    88                   'BIAS'     => 'PPMERGE.OUTPUT.BIAS',
    89                   'DARK'     => 'PPMERGE.OUTPUT.DARK',
    90                   'SHUTTER'  => 'PPMERGE.OUTPUT.SHUTTER',
    91                   'FLAT'     => 'PPMERGE.OUTPUT.FLAT',
    92                   'DOMEFLAT' => 'PPMERGE.OUTPUT.FLAT',
    93                   'SKYFLAT'  => 'PPMERGE.OUTPUT.FLAT',
    94                   'FRINGE'   => 'PPMERGE.OUTPUT.FRINGE',
    95               };
     86                  'DARKMASK' => 'PPMERGE.OUTPUT.MASK',
     87                  'MASK'     => 'PPMERGE.OUTPUT.MASK',
     88                  'BIAS'     => 'PPMERGE.OUTPUT.BIAS',
     89                  'DARK'     => 'PPMERGE.OUTPUT.DARK',
     90                  'SHUTTER'  => 'PPMERGE.OUTPUT.SHUTTER',
     91                  'FLAT'     => 'PPMERGE.OUTPUT.FLAT',
     92                  'DOMEFLAT' => 'PPMERGE.OUTPUT.FLAT',
     93                  'SKYFLAT'  => 'PPMERGE.OUTPUT.FLAT',
     94                  'FRINGE'   => 'PPMERGE.OUTPUT.FRINGE',
     95              };
    9696my $output_filerule = $FILERULES->{$det_type}; # File rule for output
    9797&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless defined $output_filerule;
     
    107107
    108108    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    109         run(command => $command, verbose => $verbose);
     109        run(command => $command, verbose => $verbose);
    110110    unless ($success) {
    111         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    112         &my_die("Unable to perform dettool -processedimfile: $error_code", $det_id, $iter, $class_id, $error_code);
    113     }
    114 
    115     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     111        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     112        &my_die("Unable to perform dettool -processedimfile: $error_code", $det_id, $iter, $class_id, $error_code);
     113    }
     114
     115    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    116116    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    117         &my_die("Unable to parse metadata config doc", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    118     $files = parse_md_list($metadata) or 
    119         &my_die("Unable to parse metadata list", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
     117        &my_die("Unable to parse metadata config doc", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
     118    $files = parse_md_list($metadata) or
     119        &my_die("Unable to parse metadata list", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    120120}
    121121
     
    129129    $num++;
    130130
    131     my $image = $file->{uri};   # Image name
     131    my $image = $file->{uri};   # Image name
    132132    my $mask = $ipprc->filename( "PPIMAGE.OUTPUT.MASK", $file->{path_base}, $class_id ); # Mask name
    133133    my $weight = $ipprc->filename( "PPIMAGE.OUTPUT.WEIGHT", $file->{path_base}, $class_id ); # Weight name
     
    137137
    138138    if ($ipprc->file_exists( $mask )) {
    139         print $listFile "\tMASK\tSTR\t" . $mask . "\n";
     139        print $listFile "\tMASK\tSTR\t" . $mask . "\n";
    140140    }
    141141    if ($ipprc->file_exists( $weight )) {
    142         print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n";
     142        print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n";
    143143    }
    144144
     
    166166$command .= " -recipe PPMERGE $recipe";
    167167$command .= ' -type ' . uc($det_type); # Type of stacking to perform
    168 $command .= " -stats $outputStats";     # Statistics output filename
     168$command .= " -stats $outputStats";     # Statistics output filename
    169169$command .= " -recipe PPSTATS CHIPSTATS";
    170170$command .= " -tracedest $traceDest -log $logDest";
     171$command .= " -dbname $dbname" if defined $dbname;
    171172
    172173# Stack the files
    173174unless ($no_op) {
    174175    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    175         run(command => $command, verbose => $verbose);
     176        run(command => $command, verbose => $verbose);
    176177    unless ($success) {
    177         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    178         &my_die("Unable to perform ppMerge: $error_code", $det_id, $iter, $class_id, $error_code);
     178        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     179        &my_die("Unable to perform ppMerge: $error_code", $det_id, $iter, $class_id, $error_code);
    179180    }
    180181    &my_die("Unable to find expected output file: $outputStack\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStack);
     
    185186    # Get the statistics on the stacked image
    186187    open(my $statsFile, $ipprc->file_resolve("$outputStats")) or
    187         &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
     188        &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
    188189    my $contents = do { local $/; <$statsFile> }; # Contents of file
    189190    close($statsFile);
    190    
    191     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
     191
     192    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    192193    my $metadata = $mdcParser->parse($contents) or
    193         &my_die("Unable to parse metadata config doc", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
     194        &my_die("Unable to parse metadata config doc", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
    194195
    195196    $stats->parse($metadata)  or
    196         &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
     197        &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
    197198}
    198199
     
    209210unless ($no_update) {
    210211    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    211         run(command => $command, verbose => $verbose);
     212        run(command => $command, verbose => $verbose);
    212213    unless ($success) {
    213         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    214         warn("Unable to perform dettool -addstacked: $error_code\n");
    215         exit($error_code);
     214        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     215        warn("Unable to perform dettool -addstacked: $error_code\n");
     216        exit($error_code);
    216217    }
    217218} else {
     
    222223{
    223224    my $msg = shift; # Warning message on die
    224     my $det_id = shift;         # Detrend identifier
    225     my $iter = shift;           # Iteration
     225    my $det_id = shift;         # Detrend identifier
     226    my $iter = shift;           # Iteration
    226227    my $class_id = shift; # Class identifier
    227228    my $exit_code = shift; # Exit code to add
     
    229230    carp($msg);
    230231    if (defined $det_id and defined $iter and defined $class_id and not $no_update) {
    231         my $command = "$dettool -addstacked";
    232         $command .= " -det_id $det_id";
    233         $command .= " -iteration $iter";
    234         $command .= " -class_id $class_id";
    235         $command .= " -code $exit_code";
    236         $command .= " -dbname $dbname" if defined $dbname;
    237         system ($command);
     232        my $command = "$dettool -addstacked";
     233        $command .= " -det_id $det_id";
     234        $command .= " -iteration $iter";
     235        $command .= " -class_id $class_id";
     236        $command .= " -code $exit_code";
     237        $command .= " -dbname $dbname" if defined $dbname;
     238        system ($command);
    238239    }
    239240    exit $exit_code;
Note: See TracChangeset for help on using the changeset viewer.