Changeset 11837 for trunk/ippScripts/scripts/detrend_process_imfile.pl
- Timestamp:
- Feb 15, 2007, 2:23:33 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_process_imfile.pl
r11830 r11837 32 32 use Pod::Usage qw( pod2usage ); 33 33 34 my ($det_id, $exp_tag, $class_id, $det_type, $input_uri, $camera, $dbname, $workdir, $no_update );34 my ($det_id, $exp_tag, $class_id, $det_type, $input_uri, $camera, $dbname, $workdir, $no_update, $no_op); 35 35 GetOptions( 36 36 'det_id|d=s' => \$det_id, … … 42 42 'dbname|d=s' => \$dbname, # Database name 43 43 'workdir|w=s' => \$workdir, # Working directory, for output files 44 'no-update' => \$no_update 44 'no-update' => \$no_update, 45 'no-op' => \$no_op, 45 46 ) or pod2usage( 2 ); 46 47 … … 105 106 106 107 # Run ppImage 107 { 108 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 109 unless ($no_op) { 108 110 my $command = "$ppImage -file $input_uri $outputRoot -recipe PPIMAGE $recipe" . 109 111 " -stat $outputStats"; # Command to run ppImage … … 118 120 &my_die("Couldn't find expected output file: $outputBin1", $det_id, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1; 119 121 &my_die("Couldn't find expected output file: $outputBin2", $det_id, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2; 120 }121 122 122 # Get the statistics on the processed image 123 my $stats; # Statistics from ppImage 124 { 123 # Get the statistics on the processed image 125 124 my $statsFile; # File handle 126 125 open $statsFile, "$outputStats" or die "Can't open statistics file $outputStats: $!\n"; … … 130 129 my $metadata = $mdcParser->parse(join "", @contents) 131 130 or &my_die("Unable to parse metadata config", $det_id, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 132 $stats = PS::IPP::Metadata::Stats->new(); # Stats parser133 131 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 134 132 } … … 139 137 $outputBin2 = $ipprc->convert_filename_relative( $outputBin2 ); 140 138 139 my $bg = ($stats->bg_mean() or 'NAN'); 140 my $bg_stdev = ($stats->bg_stdev() or 'NAN'); 141 my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN'); 142 141 143 # Add the processed file to the database 142 144 unless ($no_update) { 143 145 my $command = "$dettool -addprocessedimfile -det_id $det_id -exp_tag $exp_tag " . 144 146 "-class_id $class_id -recip $recipe -uri $outputImage -b1_uri $outputRoot"; # Command to run dettool 145 $command .= " -bg " . $stats->bg_mean(); 146 if (defined($stats->bg_mean_stdev())) { 147 $command .= " -bg_mean_stdev " . $stats->bg_mean_stdev(); 148 } else { 149 # May be undefined if there's only a single imfile 150 $command .= " -bg_mean_stdev 0"; 151 } 152 $command .= " -bg_stdev " . $stats->bg_stdev(); 147 $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev"; 153 148 $command .= " -dbname $dbname" if defined $dbname; 154 149
Note:
See TracChangeset
for help on using the changeset viewer.
