Changeset 11316 for trunk/ippScripts/scripts/detrend_reject_exp.pl
- Timestamp:
- Jan 25, 2007, 7:10:31 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_reject_exp.pl (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_reject_exp.pl
r11297 r11316 12 12 use Statistics::Descriptive; 13 13 14 use PS::IPP::Config; 14 use PS::IPP::Config qw( 15 $PS_EXIT_SUCCESS 16 $PS_EXIT_UNKNOWN_ERROR 17 $PS_EXIT_SYS_ERROR 18 $PS_EXIT_CONFIG_ERROR 19 $PS_EXIT_PROG_ERROR 20 $PS_EXIT_DATA_ERROR 21 $PS_EXIT_TIMEOUT_ERROR 22 ); 15 23 my $ipprc = PS::IPP::Config->new(); # IPP configuration 16 24 … … 42 50 my $missing_tools; 43 51 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 44 die "Can't find required tools.\n" if $missing_tools; 52 if ($missing_tools) { 53 warn("Can't find required tools."); 54 exit($PS_EXIT_CONFIG_ERROR); 55 } 56 45 57 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 46 58 … … 52 64 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 53 65 run(command => $command, verbose => 1); 54 die "Unable to perform dettool -residexp: $error_code\n" if not $success; 55 my $metadata = $mdcParser->parse(join "", @$stdout_buf) 56 or die "unable to parse metadata config doc"; 57 $exposures = parse_md_list($metadata); 66 unless ($success) { 67 $error_code >> 8; 68 &my_die("Unable to perform dettool -residexp: $error_code", $det_id, $iter, $error_code); 69 } 70 71 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 72 &my_die("Unable to parse metadata config doc", $det_id, $iter, $PS_EXIT_PROG_ERROR); 73 $exposures = parse_md_list($metadata) or 74 &my_die("Unable to parse metadata list", $det_id, $iter, $PS_EXIT_PROG_ERROR); 58 75 } 59 76 … … 66 83 my @include; # Array of include flags 67 84 foreach my $exposure (@$exposures) { 68 die "Unable to find exposure id.\n" if notdefined $exposure->{exp_tag};69 die "Unable to find mean.\n" if notdefined $exposure->{bg};70 die "Unable to find stdev.\n" if notdefined $exposure->{bg_stdev};71 die "Unable to find mean stdev.\n" if notdefined $exposure->{bg_mean_stdev};72 die "Unable to find accept.\n" if notdefined $exposure->{accept};73 die "Unable to find include.\n" if notdefined $exposure->{include};85 &my_die("Unable to find exposure id.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless defined $exposure->{exp_tag}; 86 &my_die("Unable to find mean.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless defined $exposure->{bg}; 87 &my_die("Unable to find stdev.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless defined $exposure->{bg_stdev}; 88 &my_die("Unable to find mean stdev.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless defined $exposure->{bg_mean_stdev}; 89 &my_die("Unable to find accept.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless defined $exposure->{accept}; 90 &my_die("Unable to find include.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless defined $exposure->{include}; 74 91 push @expTags, $exposure->{exp_tag}; 75 92 push @means, $exposure->{bg}; … … 170 187 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 188 run(command => $command, verbose => 1); 172 die "Unable to perform dettool -updateresidexp: $error_code\n" if not $success; 189 unless ($success) { 190 $error_code >> 8; 191 &my_die("Unable to perform dettool -updateresidexp: $error_code", $det_id, $iter, $error_code); 192 } 173 193 } 174 194 } … … 205 225 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 206 226 run(command => $command, verbose => 1); 207 die "Unable to perform dettool -adddetrunsummary: $error_code\n" if not $success; 227 unless ($success) { 228 $error_code >> 8; 229 warn("Unable to perform dettool -adddetrunsummary: $error_code"); 230 exit($error_code); 231 } 208 232 } 209 233 … … 221 245 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 222 246 run(command => $command, verbose => 1); 223 die "Unable to perform dettool -updatedetrun: $error_code\n" if not $success; 247 unless ($success) { 248 $error_code >> 8; 249 warn("Unable to perform dettool -updatedetrun: $error_code"); 250 exit($error_code); 251 } 224 252 } 225 253 … … 231 259 } 232 260 233 # Retrieve the requested rejection limit, dying if not extant 261 262 sub my_die 263 { 264 my $msg = shift; # Warning message on die 265 my $det_id = shift; # Detrend identifier 266 my $iter = shift; # Iteration 267 my $exit_code = shift; # Exit code to add 268 269 warn($msg); 270 if ($det_id and $iter) { 271 my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter -code $exit_code"; 272 $command .= " -dbname $dbname" if defined $dbname; 273 system ($command); 274 } 275 exit $exit_code; 276 } 277 278 279 280 # Retrieve the requested rejection limit, dying unless extant 234 281 sub rejection_limit 235 282 { … … 240 287 my $value = $ipprc->rejection( $name, $det_type, $filter ); 241 288 if (not defined $value) { 242 $filter = "(no filter)" if notdefined $filter;289 $filter = "(no filter)" unless defined $filter; 243 290 die "Unable to determine $name rejection limit for $det_type with $filter.\n"; 244 291 }
Note:
See TracChangeset
for help on using the changeset viewer.
