IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 15, 2007, 2:23:33 PM (19 years ago)
Author:
Paul Price
Message:

Adding --no-op option which turns off processing (so one can track only the database work flow) for everything except the phase 0 scripts (need to have some real data in the database in order to track it).

File:
1 edited

Legend:

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

    r11830 r11837  
    3333use Pod::Usage qw( pod2usage );
    3434
    35 my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update);
     35my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op);
    3636GetOptions(
    3737    'det_id|d=s'        => \$det_id,
     
    4242    'dbname|d=s'        => \$dbname, # Database name
    4343    'workdir|w=s'       => \$workdir,   # Working directory, for output files
    44     'no-update'         => \$no_update
     44    'no-update'         => \$no_update,
     45    'no-op'             => \$no_op,
    4546) or pod2usage( 2 );
    4647
     
    112113my $outputStats = $outputRoot . '.stats'; # Statistics name
    113114
    114 {
     115my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
     116unless ($no_op) {
    115117    my $command = "$ppMerge $outputStack"; # Command to run
    116118    foreach my $file (@$files) {
     
    122124    $command .= ' -type ' . uc($det_type); # Type of stacking to perform
    123125    $command .= " -stats $outputStats"; # Statistics output filename
    124 
     126   
    125127    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    126128        run(command => $command, verbose => 1);
     
    131133    &my_die("Unable to find expected output file: $outputStack\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStack;
    132134    &my_die("Unable to find expected output file: $outputStats\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
    133 }
    134135
    135 # Get the statistics on the stacked image
    136 my $stats;                      # Statistics from ppMerge
    137 {
     136    # Get the statistics on the stacked image
    138137    open(my $statsFile, "$outputStats") or
    139138        &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
    140139    my $contents = do { local $/; <$statsFile> }; # Contents of file
    141140    close($statsFile);
    142 
     141   
    143142    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    144143    my $metadata = $mdcParser->parse($contents) or
     
    149148}
    150149
     150my $bg = ($stats->bg_mean() or 'NAN');
     151my $bg_stdev = ($stats->bg_stdev() or 'NAN');
     152my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN');
     153
    151154# Add the resultant into the database
    152155$outputStack = $ipprc->convert_filename_relative($outputStack);
     
    154157    my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" .
    155158        " -uri $outputStack -recip $recipe"; # Command to run
    156     $command .= ' -bg ' . $stats->bg_mean();
    157     if (defined($stats->bg_mean_stdev())) {
    158     $command .= ' -bg_mean_stdev ' . $stats->bg_mean_stdev();
    159     } else {
    160         # May be undefined if there is only a single imfile
    161         $command .= ' -bg_mean_stdev 0';
    162     }
    163     $command .= ' -bg_stdev ' . $stats->bg_stdev();
     159    $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev";
    164160    $command .= " -dbname $dbname" if defined $dbname;
     161
    165162    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    166163        run(command => $command, verbose => 1);
Note: See TracChangeset for help on using the changeset viewer.