Changeset 8614 for trunk/ippScripts/scripts/detrend_reject_exp.pl
- Timestamp:
- Aug 25, 2006, 3:35:55 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_reject_exp.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_reject_exp.pl
r8510 r8614 13 13 # This measures how close it is to what's expected 14 14 use constant REJECT_MEAN => { 15 'bias' => 0.01, # Should be fairly flat; some CRs16 'dark' => 0.05, # Lots of CRs15 'bias' => 10, # Should be fairly flat; some CRs 16 'dark' => 100, # Lots of CRs 17 17 'flat' => undef # Can't define expected value (depends on exposure level) 18 18 }; … … 21 21 # This measures how much variation there is within the components of an exposure, compared to "typical" 22 22 use constant REJECT_STDEV => { 23 'bias' => 3,# Components should have the same degree of variation24 'dark' => 3,# Components should have the same degree of variation25 'flat' => 3# Components should have the same degree of variation23 'bias' => 10, # Components should have the same degree of variation 24 'dark' => 10, # Components should have the same degree of variation 25 'flat' => 10 # Components should have the same degree of variation 26 26 }; 27 27 … … 29 29 # This measures how structured the images are, compared to "typical" 30 30 use constant REJECT_MEAN_STDEV => { 31 'bias' => 3, # All images should be equally structured32 'dark' => 3, # All images should be equally structured33 'flat' => 3# All images should be equally structured31 'bias' => 5, # All images should be equally structured 32 'dark' => 5, # All images should be equally structured 33 'flat' => 5 # All images should be equally structured 34 34 }; 35 35 … … 51 51 my $exposures; # Array of exposures 52 52 { 53 my $command = "$dettool -residexp -det_id $detId -iter $iter"; # Command to run53 my $command = "$dettool -residexp -det_id $detId -iteration $iter"; # Command to run 54 54 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 55 55 run(command => $command, verbose => 1); … … 66 66 die "Unable to find exposure id.\n" if not defined $exposure->{exp_id}; 67 67 die "Unable to find mean.\n" if not defined $exposure->{bg}; 68 die "Unable to find stdev.\n" if not defined $exposure->{ stdev};68 die "Unable to find stdev.\n" if not defined $exposure->{bg_stdev}; 69 69 die "Unable to find mean stdev.\n" if not defined $exposure->{bg_mean_stdev}; 70 70 push @expIds, $exposure->{exp_id}; … … 92 92 for (my $i = 0; $i < scalar @means; $i++) { 93 93 my $expId = $expIds[$i]; # Exposure ID 94 my $command = "$dettool -updateresidexp -det_id $detId -iter $iter -exp_id $expId"; # Command to run 95 if ((defined REJECT_MEAN->{$detType} and 96 ($means[$i] - $meanStats->mean()) / $meanStats->standard_deviation() > REJECT_MEAN->{$detType}) 97 or 98 (defined REJECT_STDEV->{$detType} and 99 ($stdevs[$i] - $stdevStats->mean()) / $stdevStats->standard_deviation() > REJECT_STDEV->{$detType}) 100 or 101 (defined REJECT_MEAN_STDEV->{$detType} and 102 ($meanStdevs[$i] - $meanStdevStats->mean()) / $meanStdevStats->standard_deviation > 103 REJECT_MEAN_STDEV->{$detType})) { 104 $expId .= ' -reject'; 94 my $command = "$dettool -updateresidexp -det_id $detId -iteration $iter -exp_id $expId"; # Command to run 95 my $reject = 0; # Reject this exposure? 96 if (defined REJECT_MEAN->{$detType} and 97 defined $meanStats->standard_deviation() and 98 $meanStats->standard_deviation() > 0 and 99 ($means[$i] - $meanStats->mean()) / $meanStats->standard_deviation() > REJECT_MEAN->{$detType}) { 100 print "Rejecting $expId based on bad mean: " . 101 (($means[$i] - $meanStats->mean()) / $meanStats->standard_deviation()) . 102 " vs " . REJECT_MEAN->{$detType} . "\n"; 103 $reject = 1; 104 } elsif (defined REJECT_STDEV->{$detType} and 105 defined $stdevStats->standard_deviation() and 106 $stdevStats->standard_deviation() > 0 and 107 ($stdevs[$i] - $stdevStats->mean()) / $stdevStats->standard_deviation() > 108 REJECT_STDEV->{$detType}) { 109 print "Rejecting $expId based on bad stdev: " . 110 (($stdevs[$i] - $stdevStats->mean()) / $stdevStats->standard_deviation()) . 111 " vs " . REJECT_STDEV->{$detType} . "\n"; 112 $reject = 1; 113 } elsif (defined REJECT_MEAN_STDEV->{$detType} and 114 defined $meanStdevStats->standard_deviation() and 115 $meanStdevStats->standard_deviation() > 0 and 116 ($meanStdevs[$i] - $meanStdevStats->mean()) / $meanStdevStats->standard_deviation() > 117 REJECT_MEAN_STDEV->{$detType}) { 118 print "Rejecting $expId based on bad stdev: " . 119 (($meanStdevs[$i] - $meanStdevStats->mean()) / $meanStdevStats->standard_deviation()) . 120 " vs " . REJECT_MEAN_STDEV->{$detType} . "\n"; 121 $reject = 1; 122 } 105 123 124 if ($reject) { 125 $command .= ' -reject'; 106 126 ### XXX: Need some way to know whether the exposure has already been rejected. 107 127 ### rejection flag in $exposures? … … 126 146 # Put the result into the database 127 147 { 128 my $command = "$dettool -adddetrunsummary -det_id $detId -iter $iter " .148 my $command = "$dettool -adddetrunsummary -det_id $detId -iteration $iter " . 129 149 "-bg " . $meanStats->mean() . " -bg_stdev " . $stdevStats->mean() . 130 150 " -bg_mean_stdev " . $meanStdevStats->mean(); 131 151 $command .= " -reject" if not $master; 152 132 153 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 133 154 run(command => $command, verbose => 1); … … 136 157 137 158 # Re-run processing if required 138 if (not $stop){139 my $command = "$dettool -updatedetrun -det_id $detId -iter $iter";159 { 160 my $command = "$dettool -updatedetrun -det_id $detId"; 140 161 if ($stop) { 141 162 $command .= ' -stop'; 142 163 } else { 143 $command .= ' - go';164 $command .= ' -again'; 144 165 } 166 145 167 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 146 168 run(command => $command, verbose => 1); 147 169 die "Unable to perform dettool -updatedetrun: $error_code\n" if not $success; 148 170 } 149 150 171 __END__
Note:
See TracChangeset
for help on using the changeset viewer.
