Changeset 11837 for trunk/ippScripts/scripts/detrend_stack.pl
- Timestamp:
- Feb 15, 2007, 2:23:33 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_stack.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_stack.pl
r11830 r11837 33 33 use Pod::Usage qw( pod2usage ); 34 34 35 my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update );35 my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op); 36 36 GetOptions( 37 37 '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 … … 112 113 my $outputStats = $outputRoot . '.stats'; # Statistics name 113 114 114 { 115 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 116 unless ($no_op) { 115 117 my $command = "$ppMerge $outputStack"; # Command to run 116 118 foreach my $file (@$files) { … … 122 124 $command .= ' -type ' . uc($det_type); # Type of stacking to perform 123 125 $command .= " -stats $outputStats"; # Statistics output filename 124 126 125 127 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 126 128 run(command => $command, verbose => 1); … … 131 133 &my_die("Unable to find expected output file: $outputStack\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStack; 132 134 &my_die("Unable to find expected output file: $outputStats\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 133 }134 135 135 # Get the statistics on the stacked image 136 my $stats; # Statistics from ppMerge 137 { 136 # Get the statistics on the stacked image 138 137 open(my $statsFile, "$outputStats") or 139 138 &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR); 140 139 my $contents = do { local $/; <$statsFile> }; # Contents of file 141 140 close($statsFile); 142 141 143 142 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 144 143 my $metadata = $mdcParser->parse($contents) or … … 149 148 } 150 149 150 my $bg = ($stats->bg_mean() or 'NAN'); 151 my $bg_stdev = ($stats->bg_stdev() or 'NAN'); 152 my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN'); 153 151 154 # Add the resultant into the database 152 155 $outputStack = $ipprc->convert_filename_relative($outputStack); … … 154 157 my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" . 155 158 " -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"; 164 160 $command .= " -dbname $dbname" if defined $dbname; 161 165 162 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 166 163 run(command => $command, verbose => 1);
Note:
See TracChangeset
for help on using the changeset viewer.
