Changeset 20101 for trunk/ippScripts/scripts/diff_skycell.pl
- Timestamp:
- Oct 13, 2008, 11:36:56 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/diff_skycell.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/diff_skycell.pl
r20062 r20101 18 18 use IPC::Cmd 0.36 qw( can_run run ); 19 19 use PS::IPP::Metadata::Config; 20 use PS::IPP::Metadata::Stats;21 20 use PS::IPP::Metadata::List qw( parse_md_list ); 22 21 use Data::Dumper; … … 53 52 $ipprc->redirect_output($logDest) if $redirect; 54 53 55 my $STATS =56 [57 # PPSTATS KEYWORD STATISTIC DIFFTOOL FLAG58 { name => "ROBUST_MEDIAN", type => "mean", flag => "-bg", dtype => "float" },59 { name => "ROBUST_STDEV", type => "rms", flag => "-bg_stdev", dtype => "float" },60 { name => "TIME_SUB", type => "sum", flag => "-dtime_diff", dtype => "float" },61 { name => "TIME_MATCH", type => "sum", flag => "-dtime_match", dtype => "float" },62 { name => "TIME_PHOT", type => "sum", flag => "-dtime_phot", dtype => "float" },63 { name => "SUBTRACTION.STAMPS", type => "mean", flag => "-stamps_num", dtype => "int" },64 { name => "SUBTRACTION.DEV.MEAN", type => "mean", flag => "-stamps_mean", dtype => "float" },65 { name => "SUBTRACTION.DEV.RMS", type => "mean", flag => "-stamps_rms", dtype => "float" },66 { name => "SUBTRACTION.NORM", type => "mean", flag => "-norm", dtype => "float" },67 { name => "SUBTRACTION.BGDIFF", type => "mean", flag => "-bg_diff", dtype => "float" },68 { name => "SUBTRACTION.MX", type => "mean", flag => "-kernel_x", dtype => "float" },69 { name => "SUBTRACTION.MY", type => "mean", flag => "-kernel_y", dtype => "float" },70 { name => "SUBTRACTION.MXX", type => "mean", flag => "-kernel_xx", dtype => "float" },71 { name => "SUBTRACTION.MXY", type => "mean", flag => "-kernel_xy", dtype => "float" },72 { name => "SUBTRACTION.MYY", type => "mean", flag => "-kernel_yy", dtype => "float" },73 { name => "NUM_SOURCES", type => "sum", flag => "-sources", dtype => "int" },74 { name => "GOOD_PIXEL_FRAC", type => "mean", flag => "-good_frac", dtype => "float" },75 ];76 my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser77 78 54 # Look for programs we need 79 55 my $missing_tools; 80 56 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 81 57 my $ppSub = can_run('ppSub') or (warn "Can't find ppSub" and $missing_tools = 1); 58 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 82 59 if ($missing_tools) { 83 60 warn("Can't find required tools."); … … 204 181 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 205 182 183 my $cmdflags; 184 206 185 # Perform subtraction 207 186 unless ($no_op) { … … 233 212 # &my_die("Couldn't find expected output file: $bin1Name", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name); 234 213 # &my_die("Couldn't find expected output file: $bin2Name", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name); 235 &my_die("Couldn't find expected output file: $outputStats", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats); 236 237 # Get the statistics on the residual image 238 my $statsFile; # File handle 239 open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR); 240 my @contents = <$statsFile>; # Contents of file 241 close $statsFile; 242 my $metadata = $mdcParser->parse(join "", @contents) or 243 &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR); 244 $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $diff_id, $PS_EXIT_PROG_ERROR); 214 215 my $outputStatsReal = $ipprc->file_resolve($outputStats); 216 &my_die("Couldn't find expected output file: $outputStats", $diff_id, $PS_EXIT_SYS_ERROR) unless unless -f $outputStatsReal; 217 218 # measure chip stats 219 $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL"; 220 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 221 run(command => $command, verbose => $verbose); 222 unless ($success) { 223 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 224 &my_die("Unable to perform ppStatsFromMetadata: $error_code", $diff_id, $error_code); 225 } 226 foreach my $line (@$stdout_buf) { 227 $cmdflags .= " $line"; 228 } 229 chomp $cmdflags; 245 230 } 246 231 … … 250 235 { 251 236 my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot"; 252 $command .= $stats->cmdflags();237 $command .= " $cmdflags"; 253 238 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 254 239 $command .= " -hostname $host" if defined $host;
Note:
See TracChangeset
for help on using the changeset viewer.
