Changeset 17941 for trunk/ippScripts/scripts/detrend_process_imfile.pl
- Timestamp:
- Jun 5, 2008, 11:43:34 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_process_imfile.pl
r17671 r17941 36 36 'outroot|w=s' => \$outroot, # output file base name 37 37 'dbname|d=s' => \$dbname, # Database name 38 'reduction=s' => \$reduction, # Reduction class38 'reduction=s' => \$reduction, # Reduction class 39 39 'verbose' => \$verbose, # Print to stdout 40 40 'no-update' => \$no_update, … … 44 44 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 45 45 pod2usage( -msg => "Required options: --det_id --exp_id --class_id --det_type --exp_tag --input_uri --camera --outroot", 46 -exitval => 3) unless 46 -exitval => 3) unless 47 47 defined $det_id and 48 defined $exp_id and 49 defined $class_id and 50 defined $det_type and 51 defined $exp_tag and 52 defined $input_uri and 53 defined $camera and 48 defined $exp_id and 49 defined $class_id and 50 defined $det_type and 51 defined $exp_tag and 52 defined $input_uri and 53 defined $camera and 54 54 defined $outroot; 55 55 … … 62 62 63 63 # values to extract from output metadata and the stats to calculate 64 my $STATS = 65 [ 64 my $STATS = 65 [ 66 66 # PPSTATS KEYWORD STATISTIC CHIPTOOL FLAG 67 67 { name => "ROBUST_MEDIAN", type => "mean", flag => "-bg", dtype => "float" }, … … 75 75 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 76 76 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 77 if ($missing_tools) { 77 if ($missing_tools) { 78 78 warn("Can't find required tools."); 79 exit($PS_EXIT_CONFIG_ERROR); 79 exit($PS_EXIT_CONFIG_ERROR); 80 80 } 81 81 $ppImage .= " -dbname $dbname" if defined $dbname; … … 105 105 $command .= " -stats $outputStats"; 106 106 $command .= " -tracedest $traceDest -log $logDest"; 107 $command .= " -dbname $dbname" if defined $dbname; 107 108 108 109 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 109 run(command => $command, verbose => $verbose);110 run(command => $command, verbose => $verbose); 110 111 unless ($success) { 111 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);112 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $class_id, $error_code);112 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 113 &my_die("Unable to perform ppImage: $error_code", $det_id, $exp_id, $class_id, $error_code); 113 114 } 114 115 … … 119 120 120 121 # Get the statistics on the processed image 121 my $statsFile; # File handle122 my $statsFile; # File handle 122 123 open $statsFile, $ipprc->file_resolve("$outputStats") or die "Can't open statistics file $outputStats: $!\n"; 123 124 my @contents = <$statsFile>; # Contents of file … … 125 126 126 127 # parse the statistics MDC file 127 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files128 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 128 129 my $metadata = $mdcParser->parse(join "", @contents) 129 130 or &my_die("Unable to parse metadata config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); … … 146 147 unless ($no_update) { 147 148 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 148 run(command => $command, verbose => $verbose);149 run(command => $command, verbose => $verbose); 149 150 unless ($success) { 150 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);151 warn("Unable to perform dettool -addprocessedimfile: $error_code\n");152 exit($error_code);151 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 152 warn("Unable to perform dettool -addprocessedimfile: $error_code\n"); 153 exit($error_code); 153 154 } 154 155 } else { … … 159 160 { 160 161 my $msg = shift; # Warning message on die 161 my $det_id = shift; # Detrend identifier162 my $det_id = shift; # Detrend identifier 162 163 my $exp_id = shift; # Exposure tag 163 164 my $class_id = shift; # Class identifier … … 166 167 carp($msg); 167 168 if (defined $det_id and defined $exp_id and defined $class_id and not $no_update) { 168 my $command = "$dettool -addprocessedimfile";169 $command .= " -det_id $det_id";170 $command .= " -exp_id $exp_id"; 171 $command .= " -class_id $class_id";172 $command .= " -code $exit_code";173 $command .= " -dbname $dbname" if defined $dbname;169 my $command = "$dettool -addprocessedimfile"; 170 $command .= " -det_id $det_id"; 171 $command .= " -exp_id $exp_id"; 172 $command .= " -class_id $class_id"; 173 $command .= " -code $exit_code"; 174 $command .= " -dbname $dbname" if defined $dbname; 174 175 system ($command); 175 176 }
Note:
See TracChangeset
for help on using the changeset viewer.
