Changeset 30826
- Timestamp:
- Mar 8, 2011, 4:44:37 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/diff_skycell.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/diff_skycell.pl
r30599 r30826 68 68 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $diff_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 69 69 70 # XXX camera is not known here; cannot use filerules... 70 my $neb; 71 my $scheme = file_scheme($outroot); 72 if ($scheme and $scheme eq 'neb') { 73 $neb = $ipprc->nebulous(); 74 } 75 76 # XXX camera is not known here; cannot use filerules... 77 # bills 2011-03-07 This is unfortunate because it prevents us from using prepare_output ... 71 78 # my $logDest = $ipprc->filename("LOG.EXP", $outroot); 72 79 my $logDest = "$outroot.log"; 73 $logDest .= ".update" if $run_state eq "update"; 80 if ($run_state eq 'update') { 81 $logDest .= '.update'; 82 # ... well we can just do the dirty work here 83 $ipprc->kill_file($logDest); 84 } 74 85 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect; 75 86 … … 249 260 250 261 # Get the output filenames 251 my $outputName = $ipprc->filename("PPSUB.OUTPUT", $outroot); 252 my $outputMask = $ipprc->filename("PPSUB.OUTPUT.MASK", $outroot); 253 my $outputVariance = $ipprc->filename("PPSUB.OUTPUT.VARIANCE", $outroot); 254 my $outputSources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $outroot); 255 my $jpeg1Name = $ipprc->filename("PPSUB.OUTPUT.JPEG1", $outroot); 256 my $jpeg2Name = $ipprc->filename("PPSUB.OUTPUT.JPEG2", $outroot); 257 my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 258 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 259 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 260 261 if ($run_state eq 'update') { 262 $traceDest .= '.update'; 263 $outputStats .= '.update'; 264 262 my $configuration; 263 my $outputStats; 264 my $traceDest; 265 my $do_photom = 1; 266 my $dump_config = 1; 267 if ($run_state eq 'new') { 268 $configuration = prepare_output("PPSUB.CONFIG", $outroot, 1); 269 $traceDest = prepare_output("TRACE.EXP", $outroot, 1); 270 $outputStats = prepare_output("SKYCELL.STATS", $outroot, 1); 271 } else { 272 $do_photom = 0; 273 $dump_config = 0; 274 $traceDest = prepare_output("TRACE.EXP.UPDATE", $outroot, 1); 275 # we rerun stats because we need the quality value 276 $outputStats = prepare_output("SKYCELL.STATS.UPDATE", $outroot, 1); 277 $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 278 if (!$ipprc->file_exists($configuration)) { 279 print STDERR "WARNING: Config dump file $configuration is missing. Using current recipes and file rules.\n"; 280 $configuration = undef; 281 } 282 # use WARPSTATS if we're updating, as we don't care about the new stuff from the STACK and DIFF STATS recipes 265 283 $recipe_ppstats = 'WARPSTATS'; 266 284 } 285 286 my $outputName = prepare_output("PPSUB.OUTPUT", $outroot, 1); 287 my $outputMask = prepare_output("PPSUB.OUTPUT.MASK", $outroot, 1); 288 my $outputVariance = prepare_output("PPSUB.OUTPUT.VARIANCE", $outroot, 1); 289 my $outputSources = prepare_output("PPSUB.OUTPUT.SOURCES", $outroot, 1) if $do_photom; 290 my $jpeg1Name = prepare_output("PPSUB.OUTPUT.JPEG1", $outroot, 1); 291 my $jpeg2Name = prepare_output("PPSUB.OUTPUT.JPEG2", $outroot, 1); 267 292 268 293 my ($inverseName, $inverseMask, $inverseVariance, $inverseSources); 269 294 if ($inverse) { 270 $inverseName = $ipprc->filename("PPSUB.INVERSE", $outroot);271 $inverseMask = $ipprc->filename("PPSUB.INVERSE.MASK", $outroot);272 $inverseVariance = $ipprc->filename("PPSUB.INVERSE.VARIANCE", $outroot);273 $inverseSources = $ipprc->filename("PPSUB.INVERSE.SOURCES", $outroot);295 $inverseName = prepare_output("PPSUB.INVERSE", $outroot, 1); 296 $inverseMask = prepare_output("PPSUB.INVERSE.MASK", $outroot, 1); 297 $inverseVariance = prepare_output("PPSUB.INVERSE.VARIANCE", $outroot, 1); 298 $inverseSources = prepare_output("PPSUB.INVERSE.SOURCES", $outroot, 1) if $do_photom; 274 299 } 275 300 … … 289 314 $command .= " -stats $outputStats"; 290 315 $command .= " -threads $threads" if defined $threads; 291 if ($ run_state eq "new") {316 if ($dump_config) { 292 317 $command .= " -dumpconfig $configuration"; 293 } else { 294 my $configurationReal = $ipprc->file_resolve($configuration) or &my_die("Couldn't resolve configuration file: $configuration", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR); 295 $command .= " -ipprc $configurationReal"; 318 } elsif ($configuration) { 319 $command .= " -ipprc $configuration"; 296 320 } 297 321 $command .= " -save-inconv" if defined $saveInConv and $run_state eq "new"; … … 303 327 $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF"; 304 328 $command .= " -F PSPHOT.BACKMDL PSPHOT.BACKMDL.MEF"; 305 if ($ run_state eq "new") {329 if ($do_photom) { 306 330 $command .= " -photometry"; 307 331 } else { … … 322 346 } 323 347 348 check_output($outputStats, 1); 324 349 my $outputStatsReal = $ipprc->file_resolve($outputStats); 325 &my_die("Couldn't find expected output file: $outputStats", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);326 350 327 351 # measure chip stats … … 341 365 342 366 if (!$quality) { 343 &my_die("Couldn't find expected output file: $outputName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);344 &my_die("Couldn't find expected output file: $outputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);345 &my_die("Couldn't find expected output file: $outputVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);346 &my_die("Couldn't find expected output file: $outputSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);347 &my_die("Couldn't find expected output file: $jpeg1Name", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($jpeg1Name);348 &my_die("Couldn't find expected output file: $jpeg2Name", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($jpeg2Name);367 check_output($outputName, 0); 368 check_output($outputMask, 0); 369 check_output($outputVariance, 0); 370 check_output($outputSources, 1) if $do_photom; 371 check_output($jpeg1Name, 1); 372 check_output($jpeg2Name, 1); 349 373 if ($inverse) { 350 &my_die("Couldn't find expected output file: $inverseName", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseName);351 &my_die("Couldn't find expected output file: $inverseMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseMask);352 &my_die("Couldn't find expected output file: $inverseVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseVariance);353 &my_die("Couldn't find expected output file: $inverseSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inverseSources);374 check_output($inverseName, 0); 375 check_output($inverseMask, 0); 376 check_output($inverseVariance, 0); 377 check_output($inverseSources, 1) if $do_photom; 354 378 if ($run_state eq 'new') { 355 &my_die("Couldn't find expected output file: $configuration", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($configuration);379 check_output($configuration, 1); 356 380 } 357 381 } … … 391 415 } 392 416 } 417 exit 0; 418 419 420 # Prepare to write to an output file 421 # Lookup the filename in the rules. 422 # Make sure that if file exists and is a nebulous file that there is only one instance 423 # Deal with files that have been lost. 424 sub prepare_output 425 { 426 my $filerule = shift; 427 my $outroot = shift; 428 my $delete = shift; 429 $delete = 0 if !defined $delete; 430 431 my $error; 432 my $output = $ipprc->prepare_output($filerule, $outroot, undef, $delete, \$error) 433 or &my_die("failed to prepare output file for: $filerule", $diff_id, $skycell_id, $error); 434 return $output; 435 } 436 437 sub check_output 438 { 439 my $file = shift; 440 my $replicate = shift; 441 442 if (!defined $file) { 443 return; 444 } 445 446 &my_die("Couldn't find expected output file: $file", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file); 447 448 if ($replicate and $neb) { 449 $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR); 450 } 451 } 393 452 394 453
Note:
See TracChangeset
for help on using the changeset viewer.
