Changeset 11837 for trunk/ippScripts/scripts/detrend_reject_exp.pl
- Timestamp:
- Feb 15, 2007, 2:23:33 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_reject_exp.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_reject_exp.pl
r11829 r11837 32 32 use Pod::Usage qw( pod2usage ); 33 33 34 my ($det_id, $iter, $det_type, $camera, $filter, $workdir, $dbname, $no_update );34 my ($det_id, $iter, $det_type, $camera, $filter, $workdir, $dbname, $no_update, $no_op); 35 35 GetOptions( 36 36 'det_id|d=s' => \$det_id, … … 41 41 'workdir|w=s' => \$workdir, # Working directory for output files 42 42 'dbname|d=s' => \$dbname, # Database name 43 'no-update' => \$no_update 43 'no-update' => \$no_update, 44 'no-op' => \$no_op, 44 45 ) or pod2usage( 2 ); 45 46 … … 133 134 $command = "$dettool -updateresidexp -det_id $det_id -iteration $iter -exp_tag $expTag"; # Command to run 134 135 $command .= " -dbname $dbname" if defined $dbname; 135 136 136 137 $reject = 0; # Reject this exposure? 137 138 … … 143 144 } 144 145 146 # Cop-out if we're not doing any operations 147 if ($no_op) { 148 # Make sure something gets rejected (just once!), just so that 149 # we can trace the full range of the workflow 150 if ($i == 0 and $iter == 0) { 151 $reject = 1; 152 } 153 goto UPDATE; 154 } 155 145 156 if ($reject_mean and defined $meanStats->standard_deviation() ) { 146 157 my $dMean = abs($means[$i] - $meanStats->mean()) ; … … 201 212 } 202 213 } 203 214 204 215 # Decide if the current is sufficient to use as a master, and if we can stop iterating 205 216 my $master = 1; # This is good enough for a master … … 220 231 print "Stop: $stop\n"; 221 232 222 # Put the resultinto the database233 # Put results into the database 223 234 unless ($no_update) { 224 my $varianceStats = Statistics::Descriptive::Sparse->new(); # Statistics calculator 225 $varianceStats->add_data(@variances); 226 227 my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter" . 228 " -bg " . $meanStats->mean() . " -bg_stdev " . sqrt($varianceStats->mean()) . 229 " -bg_mean_stdev " . $meanStats->standard_deviation(); 230 $command .= " -accept" if $master; 231 $command .= " -dbname $dbname" if defined $dbname; 232 233 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 234 run(command => $command, verbose => 1); 235 unless ($success) { 236 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 237 warn("Unable to perform dettool -adddetrunsummary: $error_code"); 238 exit($error_code); 239 } 240 } 241 242 # Re-run processing if required 243 unless ($no_update) { 244 my $command = "$dettool -updatedetrun -det_id $det_id"; 245 if ($stop) { 246 $command .= ' -state stop'; 247 } else { 248 $command .= ' -again'; 249 } 250 251 $command .= " -dbname $dbname" if defined $dbname; 252 253 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 254 run(command => $command, verbose => 1); 255 unless ($success) { 256 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 257 warn("Unable to perform dettool -updatedetrun: $error_code"); 258 exit($error_code); 235 236 { 237 # Add the summary 238 my $varianceStats = Statistics::Descriptive::Sparse->new(); # Statistics calculator 239 $varianceStats->add_data(@variances); 240 241 my $bg = ($meanStats->mean() or 'NAN'); 242 my $bg_stdev = (sqrt( $varianceStats->mean() ) or 'NAN'); 243 my $bg_mean_stdev = ($meanStats->standard_deviation() or 'NAN'); 244 245 my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter"; 246 $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev"; 247 $command .= " -accept" if $master; 248 $command .= " -dbname $dbname" if defined $dbname; 249 250 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 251 run(command => $command, verbose => 1); 252 unless ($success) { 253 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 254 warn("Unable to perform dettool -adddetrunsummary: $error_code"); 255 exit($error_code); 256 } 257 } 258 259 # Re-run processing if required 260 { 261 my $command = "$dettool -updatedetrun -det_id $det_id"; 262 if ($stop) { 263 $command .= ' -state stop'; 264 } else { 265 $command .= ' -again'; 266 } 267 268 $command .= " -dbname $dbname" if defined $dbname; 269 270 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 271 run(command => $command, verbose => 1); 272 unless ($success) { 273 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 274 warn("Unable to perform dettool -updatedetrun: $error_code"); 275 exit($error_code); 276 } 259 277 } 260 278 }
Note:
See TracChangeset
for help on using the changeset viewer.
