Changeset 20101 for trunk/ippScripts/scripts/stack_skycell.pl
- Timestamp:
- Oct 13, 2008, 11:36:56 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/stack_skycell.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/stack_skycell.pl
r19938 r20101 19 19 use IPC::Cmd 0.36 qw( can_run run ); 20 20 use PS::IPP::Metadata::Config; 21 use PS::IPP::Metadata::Stats;22 21 use PS::IPP::Metadata::List qw( parse_md_list ); 23 22 use Data::Dumper; … … 67 66 $ipprc->redirect_output($logDest) if $redirect; 68 67 69 my $STATS =70 [71 # PPSTATS KEYWORD STATISTIC STACKTOOL FLAG72 { name => "ROBUST_MEDIAN", type => "mean", flag => "-bg", dtype => "float" },73 { name => "ROBUST_STDEV", type => "rms", flag => "-bg_stdev", dtype => "float" },74 { name => "TIME_STACK", type => "sum", flag => "-dtime_stack", dtype => "float" },75 { name => "TIME_MATCH", type => "mean", flag => "-dtime_match_mean", dtype => "float" },76 { name => "TIME_MATCH", type => "stdev", flag => "-dtime_match_stdev", dtype => "float" },77 { name => "TIME_INITIAL", type => "sum", flag => "-dtime_initial", dtype => "float" },78 { name => "TIME_REJECT", type => "sum", flag => "-dtime_reject", dtype => "float" },79 { name => "TIME_FINAL", type => "sum", flag => "-dtime_final", dtype => "float" },80 { name => "TIME_PHOT", type => "sum", flag => "-dtime_phot", dtype => "float" },81 { name => "STAMP.MEAN", type => "mean", flag => "-match_mean", dtype => "float" },82 { name => "STAMP.MEAN", type => "stdev", flag => "-match_stdev", dtype => "float" },83 { name => "STAMP.RMS", type => "rms", flag => "-match_rms", dtype => "float" },84 { name => "STAMP.NUM", type => "mean", flag => "-stamps_mean", dtype => "float" },85 { name => "STAMP.NUM", type => "stdev", flag => "-stamps_stdev", dtype => "float" },86 { name => "STAMP.NUM", type => "min", flag => "-stamps_min", dtype => "int" },87 { name => "TIME_PHOT", type => "sum", flag => "-dtime_phot", dtype => "float" },88 { name => "REJECT_IMAGES", type => "sum", flag => "-reject_images", dtype => "int" },89 { name => "REJECT_PIXELS", type => "mean", flag => "-reject_pix_mean", dtype => "float" },90 { name => "REJECT_PIXELS", type => "stdev", flag => "-reject_pix_stdev", dtype => "float" },91 { name => "NUM_SOURCES", type => "sum", flag => "-sources", dtype => "int" },92 { name => "GOOD_PIXEL_FRAC", type => "mean", flag => "-good_frac", dtype => "float" },93 ];94 my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser95 96 68 # Look for programs we need 97 69 my $missing_tools; 98 70 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 99 71 my $ppStack = can_run('ppStack') or (warn "Can't find ppStack" and $missing_tools = 1); 72 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 100 73 if ($missing_tools) { 101 74 warn("Can't find required tools."); … … 208 181 # doesn't know how to resolve paths. (The information is stored in the configuration file) 209 182 $configuration = $ipprc->file_resolve($configuration) if ($run_state eq 'update'); 183 184 my $cmdflags; 210 185 211 186 # Perform stacking … … 244 219 245 220 if ($do_stats) { 246 &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) 247 unless $ipprc->file_exists($outputStats); 248 # Get the statistics on the stacked image 249 my $statsFile; # File handle 250 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR); 251 my @contents = <$statsFile>; # Contents of file 252 close $statsFile; 253 my $metadata = $mdcParser->parse(join "", @contents) or 254 &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR); 255 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR); 221 my $outputStatsReal = $ipprc->file_resolve($outputStats); 222 &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless unless -f $outputStatsReal; 223 224 # measure chip stats 225 $command = "$ppStatsFromMetadata $outputStatsReal - STACK_SKYCELL"; 226 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 227 run(command => $command, verbose => $verbose); 228 unless ($success) { 229 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 230 &my_die("Unable to perform ppStatsFromMetadata: $error_code", $stack_id, $error_code); 231 } 232 foreach my $line (@$stdout_buf) { 233 $cmdflags .= " $line"; 234 } 235 chomp $cmdflags; 256 236 } 257 237 } … … 272 252 } 273 253 $command .= " $mode -stack_id $stack_id"; 274 $command .= $stats->cmdflags()if $do_stats;254 $command .= " $cmdflags" if $do_stats; 275 255 $command .= " -dbname $dbname" if defined $dbname; 276 256
Note:
See TracChangeset
for help on using the changeset viewer.
