Changeset 17943 for trunk/ippScripts/scripts/detrend_process_exp.pl
- Timestamp:
- Jun 5, 2008, 12:09:48 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_process_exp.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_process_exp.pl
r17671 r17943 45 45 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 46 pod2usage( -msg => "Required options: --det_id --det_type --exp_id --exp_tag --camera --outroot", 47 -exitval => 3) unless 48 defined $det_id and 49 defined $det_type and 50 defined $exp_id and 51 defined $exp_tag and 47 -exitval => 3) unless 48 defined $det_id and 49 defined $det_type and 50 defined $exp_id and 51 defined $exp_tag and 52 52 defined $camera and 53 53 defined $outroot; … … 68 68 # XXX -bg_mean_stdev should take stdev of bg_mean if bg_mean_stdev == 0 (B) 69 69 # XXX (A) if imfile.Ncomp > 1, (B) if imfile.Ncomp == 1 70 my $STATS = 71 [ 70 my $STATS = 71 [ 72 72 # KEYWORD STATISTIC CHIPTOOL FLAG 73 73 { name => "bg", type => "mean", flag => "-bg", dtype => "float" }, … … 82 82 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 83 83 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 84 if ($missing_tools) { 84 if ($missing_tools) { 85 85 warn("Can't find required tools."); 86 exit($PS_EXIT_CONFIG_ERROR); 86 exit($PS_EXIT_CONFIG_ERROR); 87 87 } 88 88 … … 93 93 $command .= " -dbname $dbname" if defined $dbname; 94 94 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 95 run(command => $command, verbose => $verbose);96 unless ($success) { 97 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);98 &my_die("Unable to perform dettool -processedimfile: $error_code", $det_id, $exp_id, $error_code);95 run(command => $command, verbose => $verbose); 96 unless ($success) { 97 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 98 &my_die("Unable to perform dettool -processedimfile: $error_code", $det_id, $exp_id, $error_code); 99 99 } 100 100 101 101 # convert stdout to a metadata 102 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files102 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 103 103 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 104 &my_die("Unable to parse metadata config doc", $det_id, $exp_id, $PS_EXIT_PROG_ERROR);104 &my_die("Unable to parse metadata config doc", $det_id, $exp_id, $PS_EXIT_PROG_ERROR); 105 105 106 106 # parse the file info in the metadata 107 107 $files = parse_md_list($metadata) or 108 &my_die("Unable to parse metadata list", $det_id, $exp_id, $PS_EXIT_PROG_ERROR);108 &my_die("Unable to parse metadata list", $det_id, $exp_id, $PS_EXIT_PROG_ERROR); 109 109 110 110 # parse the stats in the metadata 111 111 unless ($stats->parse($metadata)) { 112 &my_die("Unable to find all values in statistics output.\n", $det_id, $exp_id, $PS_EXIT_PROG_ERROR);112 &my_die("Unable to find all values in statistics output.\n", $det_id, $exp_id, $PS_EXIT_PROG_ERROR); 113 113 } 114 114 } … … 138 138 # Make the jpeg for binning 1 139 139 $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run 140 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 141 run(command => $command, verbose => $verbose); 142 unless ($success) { 143 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 144 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $error_code); 140 $command .= " -dbname $dbname" if defined $dbname; 141 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 142 run(command => $command, verbose => $verbose); 143 unless ($success) { 144 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 145 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $error_code); 145 146 } 146 147 &my_die("Unable to find expected output file: $jpeg1", $det_id, $exp_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg1); 147 148 148 149 # Make the jpeg for binning 2 149 150 $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run 150 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 151 run(command => $command, verbose => $verbose); 152 unless ($success) { 153 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 154 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $error_code); 151 $command .= " -dbname $dbname" if defined $dbname; 152 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 153 run(command => $command, verbose => $verbose); 154 unless ($success) { 155 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 156 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $error_code); 155 157 } 156 158 &my_die("Unable to find expected output file: $jpeg2", $det_id, $exp_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg2); … … 168 170 unless ($no_update) { 169 171 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 170 run(command => $command, verbose => $verbose);171 unless ($success) { 172 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);173 warn("Unable to perform dettool -addprocessedexp: $error_code");174 exit($error_code);172 run(command => $command, verbose => $verbose); 173 unless ($success) { 174 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 175 warn("Unable to perform dettool -addprocessedexp: $error_code"); 176 exit($error_code); 175 177 } 176 178 } else { … … 181 183 { 182 184 my $msg = shift; # Warning message on die 183 my $det_id = shift; # Detrend identifier185 my $det_id = shift; # Detrend identifier 184 186 my $exp_id = shift; # Exposure tag 185 187 my $exit_code = shift; # Exit code to add … … 187 189 carp($msg); 188 190 if (defined $det_id and defined $exp_id and not $no_update) { 189 my $command = "$dettool -addprocessedexp";190 $command .= " -det_id $det_id";191 $command .= " -exp_id $exp_id";192 $command .= " -code $exit_code";193 $command .= " -dbname $dbname" if defined $dbname;191 my $command = "$dettool -addprocessedexp"; 192 $command .= " -det_id $det_id"; 193 $command .= " -exp_id $exp_id"; 194 $command .= " -code $exit_code"; 195 $command .= " -dbname $dbname" if defined $dbname; 194 196 system ($command); 195 197 }
Note:
See TracChangeset
for help on using the changeset viewer.
