Changeset 13618 for trunk/ippScripts/scripts/detrend_resid.pl
- Timestamp:
- Jun 4, 2007, 2:25:37 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_resid.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_resid.pl
r13552 r13618 105 105 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 106 106 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 107 my $ppStats = can_run('ppStats') or (warn "Can't find ppStats" and $missing_tools = 1); 107 108 if ($missing_tools) { 108 109 warn("Can't find required tools."); … … 123 124 my $bin2Name = $ipprc->filename("PPIMAGE.BIN2", $outputRoot, $class_id); 124 125 my $outputStats = $outputRoot . '.' . $class_id . '.stats'; 126 my $outputBinnedStats = $outputRoot . '.' . $class_id . '.bin.stats'; 125 127 126 128 # Run ppImage 127 129 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 130 my $binnedStats = PS::IPP::Metadata::Stats->new(); # Stats parser 128 131 unless ($no_op) { 129 132 my $command = "$ppImage -file $input_uri $outputRoot -recipe PPIMAGE $recipe" . … … 154 157 close $statsFile; 155 158 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 156 my $metadata = $mdcParser->parse(join "", @contents) or 157 &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 158 $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 159 my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 160 # $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 159 161 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 162 163 # run ppStats on the binned image 164 $command = "$ppStats $bin2Name $outputBinnedStats"; 165 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 166 run(command => $command, verbose => 1); 167 168 unless ($success) { 169 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 170 &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_tag, $class_id, $error_code); 171 } 172 173 &my_die("Couldn't find expected output file: $outputBinnedStats", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputBinnedStats); 174 175 open $statsFile, $ipprc->file_resolve($outputBinnedStats) or &my_die("Can't open statistics file $outputBinnedStats: $!", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_SYS_ERROR); 176 @contents = <$statsFile>; # Contents of file 177 close $statsFile; 178 my $binnedMetadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 179 # $binnedStats = PS::IPP::Metadata::Stats->new(); # Stats parser 180 $binnedStats->parse($binnedMetadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 160 181 } 161 182 … … 164 185 my $bg_stdev = ($stats->bg_stdev() or 'NAN'); 165 186 my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN'); 187 my $bin_stdev = ($binnedStats->bg_stdev() or 'NAN'); 166 188 167 189 unless ($no_update) { 168 my $command = "$dettool -addresidimfile -det_id $det_id -iteration $iter -exp_tag $exp_tag " . 169 "-class_id $class_id -recip $recipe -uri $outputName -path_base $outputRoot"; # Command to run dettool 190 my $command = "$dettool -addresidimfile -det_id $det_id -iteration $iter"; 191 $command .= " -exp_tag $exp_tag -class_id $class_id"; 192 $command .= " -recip $recipe -uri $outputName -path_base $outputRoot"; 170 193 $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev"; 194 $command .= " -bin_stdev $bin_stdev"; 171 195 $command .= " -dbname $dbname" if defined $dbname; 172 196 … … 179 203 } 180 204 } 181 182 183 205 184 206 sub my_die
Note:
See TracChangeset
for help on using the changeset viewer.
