Changeset 14048 for trunk/ippScripts/scripts/detrend_resid.pl
- Timestamp:
- Jul 6, 2007, 3:44:38 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_resid.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_resid.pl
r14009 r14048 32 32 use Pod::Usage qw( pod2usage ); 33 33 34 my ($det_id, $iter, $exp_ tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op);34 my ($det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op); 35 35 GetOptions( 36 36 'det_id|d=s' => \$det_id, 37 37 'iteration=s' => \$iter, 38 'exp_tag|e=s' => \$exp_tag, 38 'exp_id|e=s' => \$exp_id, 39 'exp_tag|=s' => \$exp_tag, 39 40 'class_id|i=s' => \$class_id, 40 41 'det_type|t=s' => \$det_type, … … 51 52 52 53 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 53 pod2usage( -msg => "Required options: --det_id --iteration --exp_ tag --class_id --det_type --camera --input_uri --mode --detrend (not for 'verify' mode)",54 pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend (not for 'verify' mode)", 54 55 -exitval => 3) 55 56 unless defined $det_id 56 57 and defined $iter 58 and defined $exp_id 57 59 and defined $exp_tag 58 60 and defined $class_id … … 73 75 $recipe = uc($det_type) . '_VERIFY'; 74 76 } else { 75 &my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_PROG_ERROR);77 &my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 76 78 } 77 79 $recipe = $ipprc->reduction($reduction, $recipe); … … 139 141 if (lc($mode) ne 'verify') { 140 142 my $detFlag = DETRENDS->{lc($det_type)}; 141 &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag;143 &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR) unless defined $detFlag; 142 144 $command .= " $detFlag $detrend"; 143 145 } … … 147 149 unless ($success) { 148 150 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 149 &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $exp_ tag, $class_id, $error_code);150 } 151 &my_die("Couldn't find expected output file: $outputName", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputName);152 &my_die("Couldn't find expected output file: $outputStats", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats);153 &my_die("Couldn't find expected output file: $bin1Name", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin1Name);154 &my_die("Couldn't find expected output file: $bin2Name", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name);151 &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code); 152 } 153 &my_die("Couldn't find expected output file: $outputName", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputName); 154 &my_die("Couldn't find expected output file: $outputStats", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($outputStats); 155 &my_die("Couldn't find expected output file: $bin1Name", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin1Name); 156 &my_die("Couldn't find expected output file: $bin2Name", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($bin2Name); 155 157 156 158 # Load the raw output stats file 157 159 my $statsFile; # File handle 158 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_SYS_ERROR);160 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR); 159 161 my @contents = <$statsFile>; # Contents of file 160 162 close $statsFile; … … 162 164 # Parse the stats file contents into a metadata 163 165 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 164 my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_PROG_ERROR);166 my $metadata = $mdcParser->parse(join "", @contents) or &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 165 167 166 168 # Parse the statistics on the residual image 167 169 my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser 168 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_PROG_ERROR);170 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 169 171 170 172 # run ppStats on the binned image … … 174 176 unless ($success) { 175 177 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 176 &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_ tag, $class_id, $error_code);178 &my_die("Unable to perform ppStats: $error_code", $det_id, $iter, $exp_id, $class_id, $error_code); 177 179 } 178 180 179 181 # parse the binned image statistics 180 my $binnedMetadata = $mdcParser->parse(join "", @$stdout_buf) or &my_die("Unable to parse metadata output", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_PROG_ERROR);182 my $binnedMetadata = $mdcParser->parse(join "", @$stdout_buf) or &my_die("Unable to parse metadata output", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 181 183 182 184 my $binnedStats = PS::IPP::Metadata::Stats->new($BINNED_STATS); # Stats parser 183 $binnedStats->parse($binnedMetadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_ tag, $class_id, $PS_EXIT_PROG_ERROR);185 $binnedStats->parse($binnedMetadata) or &my_die("Unable to find all values in statistics output.", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 184 186 } 185 187 … … 188 190 $command .= " -det_id $det_id"; 189 191 $command .= " -iteration $iter"; 190 $command .= " -exp_ tag $exp_tag";192 $command .= " -exp_id $exp_id"; 191 193 $command .= " -class_id $class_id"; 192 194 $command .= " -recip $recipe"; … … 196 198 197 199 # add in the elements from the selected stats above 198 foreach my $entry (@$STATS @$BINNED_STATS) {200 foreach my $entry (@$STATS, @$BINNED_STATS) { 199 201 my $value = $entry->{value}; 200 202 my $flag = $entry->{flag}; … … 220 222 my $det_id = shift; # Detrend identifier 221 223 my $iter = shift; # Iteration 222 my $exp_ tag= shift; # Exposure tag224 my $exp_id = shift; # Exposure tag 223 225 my $class_id = shift; # Class identifier 224 226 my $exit_code = shift; # Exit code to add 225 227 226 228 carp($msg); 227 if ($det_id and $iter and $exp_ tagand not $no_update) {229 if ($det_id and $iter and $exp_id and not $no_update) { 228 230 my $command = "$dettool -addresidimfile"; 229 231 $command .= " -det_id $det_id"; 230 232 $command .= " -iteration $iter"; 231 $command .= " -exp_ tag $exp_tag";233 $command .= " -exp_id $exp_id"; 232 234 $command .= " -class_id $class_id"; 233 235 $command .= " -code $exit_code";
Note:
See TracChangeset
for help on using the changeset viewer.
