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_norm_apply.pl

    r11830 r11837  
    3939    $dbname,                    # Database name
    4040    $workdir,                   # Working directory, for output files
    41     $no_update                  # Don't update the database
     41    $no_update,                 # Don't update the database
     42    $no_op,                     # Don't do any operations
    4243    );
    4344GetOptions(
     
    5152    'dbname|d=s'        => \$dbname,
    5253    'workdir|w=s'       => \$workdir, # Working directory, for output files
    53     'no-update'         => \$no_update
     54    'no-update'         => \$no_update,
     55    'no-op'             => \$no_op,
    5456    ) or pod2usage( 2 );
    5557   
     
    100102
    101103# Run normalisation
    102 {
     104my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
     105unless ($no_op) {
    103106    my $command = "$ppImage -file $input $outputRoot -norm $value -stat $statsName -recipe PPIMAGE " . RECIPE(); # Command to run
    104107    $command .= ' -isfringe' if lc($det_type) eq 'fringe';
     
    113116    &my_die("Can't find expected output file: $b2name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $b2name;
    114117    &my_die("Can't find expected output file: $statsName", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -e $statsName;
    115 }
    116 
    117 # Get the statistics on the normalised image
    118 my $stats;                      # Statistics from ppImage
    119 {
     118   
     119    # Get the statistics on the normalised image
    120120    my $statsFile;              # File handle
    121121    open $statsFile, $statsName or &my_die("Can't open statistics file $statsName: $!\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR);
     
    124124    my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    125125    my $metadata = $mdcParser->parse(join "", @contents)
    126         or &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    127     $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
     126        or &my_die("Unable to parse metadata config", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    128127    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR);
    129 }
     128}   
    130129
    131130# Update the database
     
    133132$b1name = $ipprc->convert_filename_relative( $b1name );
    134133$b2name = $ipprc->convert_filename_relative( $b2name );
     134
     135my $bg = ($stats->bg_mean() or 'NAN');
     136my $bg_stdev = ($stats->bg_stdev() or 'NAN');
     137my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN');
     138
    135139unless ($no_update) {
    136140    my $command = "$dettool -addnormalizedimfile -det_id $det_id -iteration $iter -class_id $class_id ".
    137141        "-uri $output -b1_uri $outputRoot"; # Command to run
    138     # Add the statistics triplet
    139     $command .= " -bg " . $stats->bg_mean();
    140     if (defined($stats->bg_mean_stdev())) {
    141         $command .= " -bg_mean_stdev " . $stats->bg_mean_stdev();
    142     } else {
    143         # May be undefined if there's only a single imfile
    144         $command .= " -bg_mean_stdev 0";
    145     }
    146     $command .= " -bg_stdev " . $stats->bg_stdev();
    147 
     142    $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev";
    148143    $command .= " -dbname $dbname" if defined $dbname;
    149144
Note: See TracChangeset for help on using the changeset viewer.