Changeset 11837 for trunk/ippScripts/scripts/detrend_reject_imfile.pl
- Timestamp:
- Feb 15, 2007, 2:23:33 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_reject_imfile.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_reject_imfile.pl
r11829 r11837 33 33 use Pod::Usage qw( pod2usage ); 34 34 35 my ($det_id, $iter, $exp_tag, $det_type, $camera, $filter, $reject, $dbname, $workdir, $no_update );35 my ($det_id, $iter, $exp_tag, $det_type, $camera, $filter, $reject, $dbname, $workdir, $no_update, $no_op); 36 36 GetOptions( 37 37 'det_id|d=s' => \$det_id, … … 45 45 'workdir|w=s' => \$workdir, # Working directory, for output files 46 46 'no-update' => \$no_update, 47 'no-op' => \$no_op, 47 48 ) or pod2usage( 2 ); 48 49 … … 129 130 my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2 130 131 131 # Make the jpeg for binning 1 132 { 133 my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run 134 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 135 run(command => $command, verbose => 1); 136 unless ($success) { 137 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 138 &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code); 139 } 140 &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg1Name; 141 } 142 143 # Make the jpeg for binning 2 144 { 145 my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run 146 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 147 run(command => $command, verbose => 1); 148 unless ($success) { 149 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 150 &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code); 151 } 152 &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2Name; 132 unless ($no_op) { 133 134 # Make the jpeg for binning 1 135 { 136 my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run 137 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 138 run(command => $command, verbose => 1); 139 unless ($success) { 140 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 141 &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code); 142 } 143 &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg1Name; 144 } 145 146 # Make the jpeg for binning 2 147 { 148 my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run 149 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 150 run(command => $command, verbose => 1); 151 unless ($success) { 152 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 153 &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code); 154 } 155 &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2Name; 156 } 153 157 } 154 158 … … 172 176 my $stdev = sqrt($variances[$i]); # Stdev for this imfile 173 177 178 last if $no_op; 179 174 180 if ($reject_imfile_mean) { 175 181 if (abs($mean) > $reject_imfile_mean * $stdev) { … … 212 218 print "no rejection for imfile S/N\n"; 213 219 } 214 215 220 } 216 221 … … 235 240 ## Reject based on the exposure ensemble stats 236 241 # reject if the exposure ensemble mean is deviant 237 if ($reject_exp_mean) { 238 if (abs($mean) > $reject_exp_mean * $stdev) { 239 print "Rejecting exposure based on bad mean: \n"; 240 print "mean: $mean, stdev: $stdev (limit is: % $reject_exp_mean\n"; 241 $reject = 1; 242 } 243 } else { 244 print "no rejection for exp mean\n"; 245 } 246 # reject if the exposure ensemble stdev is deviant 247 if ($reject_exp_stdev) { 248 if ($stdev > $reject_exp_stdev) { 249 print "Rejecting exposure based on bad mean stdev: " . $stdev . " vs " . 250 $reject_exp_stdev . "\n"; 251 $reject = 1; 252 } 253 } else { 254 print "no rejection for exp stdev\n"; 255 } 256 # reject if the exposure ensemble mean stdev is deviant 257 if ($reject_exp_meanstdev) { 258 if ($meanStdev > $reject_exp_meanstdev) { 259 print "Rejecting exposure based on bad mean stdev: " . $meanStdev . " vs " . 260 $reject_exp_meanstdev . "\n"; 261 $reject = 1; 262 } 263 } else { 264 print "no rejection for exp mean stdev\n"; 265 } 266 # reject if the signal-to-noise is insufficient 267 if ($reject_exp_sn) { 268 if (abs($mean) < abs($stdev * $reject_exp_sn)) { 269 print "Rejecting exposure based on poor S/N: \n"; 270 print "signal: $mean vs noise: $stdev (s/n limit is: $reject_exp_sn)\n"; 271 $reject = 1; 272 } 273 } else { 274 print "no rejection for exp S/N\n"; 242 unless ($no_op) { 243 if ($reject_exp_mean) { 244 if (abs($mean) > $reject_exp_mean * $stdev) { 245 print "Rejecting exposure based on bad mean: \n"; 246 print "mean: $mean, stdev: $stdev (limit is: % $reject_exp_mean\n"; 247 $reject = 1; 248 } 249 } else { 250 print "no rejection for exp mean\n"; 251 } 252 # reject if the exposure ensemble stdev is deviant 253 if ($reject_exp_stdev) { 254 if ($stdev > $reject_exp_stdev) { 255 print "Rejecting exposure based on bad mean stdev: " . $stdev . " vs " . 256 $reject_exp_stdev . "\n"; 257 $reject = 1; 258 } 259 } else { 260 print "no rejection for exp stdev\n"; 261 } 262 # reject if the exposure ensemble mean stdev is deviant 263 if ($reject_exp_meanstdev) { 264 if ($meanStdev > $reject_exp_meanstdev) { 265 print "Rejecting exposure based on bad mean stdev: " . $meanStdev . " vs " . 266 $reject_exp_meanstdev . "\n"; 267 $reject = 1; 268 } 269 } else { 270 print "no rejection for exp mean stdev\n"; 271 } 272 # reject if the signal-to-noise is insufficient 273 if ($reject_exp_sn) { 274 if (abs($mean) < abs($stdev * $reject_exp_sn)) { 275 print "Rejecting exposure based on poor S/N: \n"; 276 print "signal: $mean vs noise: $stdev (s/n limit is: $reject_exp_sn)\n"; 277 $reject = 1; 278 } 279 } else { 280 print "no rejection for exp S/N\n"; 281 } 275 282 } 276 283 … … 278 285 $jpeg1Name = $ipprc->convert_filename_relative( $jpeg1Name ); 279 286 $jpeg2Name = $ipprc->convert_filename_relative( $jpeg2Name ); 287 288 my $bg = $mean; 289 my $bg_stdev = $stdev; 290 my $bg_mean_stdev = $meanStdev; 291 280 292 unless ($no_update) { 281 293 my $command = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_tag $exp_tag " . 282 "-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $outputRoot " .283 "-bg $mean -bg_stdev $stdev -bg_mean_stdev $meanStdev"; # Command to run 294 "-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $outputRoot "; # Command to run 295 $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev"; 284 296 $command .= ' -reject' if $reject; 285 297 $command .= " -dbname $dbname" if defined $dbname;
Note:
See TracChangeset
for help on using the changeset viewer.
