Changeset 31083 for branches/eam_branches/ipp-20110213/ippScripts
- Timestamp:
- Mar 30, 2011, 9:36:02 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/ippScripts/scripts
- Files:
-
- 12 edited
-
diff_skycell.pl (modified) (9 diffs)
-
dist_bundle.pl (modified) (8 diffs)
-
dist_component.pl (modified) (4 diffs)
-
ipp_apply_burntool_single.pl (modified) (2 diffs, 1 prop)
-
ipp_cleanup.pl (modified) (2 diffs)
-
magic_destreak_revert.pl (modified) (1 diff)
-
minidvodb_merge.pl (modified) (8 diffs)
-
register_exp.pl (modified) (1 diff)
-
register_imfile.pl (modified) (2 diffs)
-
stack_skycell.pl (modified) (8 diffs)
-
summit_copy.pl (modified) (6 diffs)
-
warp_skycell.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ippScripts/scripts/diff_skycell.pl
r30599 r31083 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 … … 137 148 $templateVariance = "PPSTACK.UNCONV.VARIANCE"; 138 149 } 139 $templateSources = "PSPHOT.OUT.CMF.MEF"; ## this must be consistent with the value in stack_skycell.pl :161150 $templateSources = "PSPHOT.OUT.CMF.MEF"; ## this must be consistent with the value in stack_skycell.pl 140 151 # template is a stack so it doesn't need to be magicked 141 152 $templateMagic = 1; … … 163 174 $inputVariance = "PPSTACK.UNCONV.VARIANCE"; 164 175 } 165 $inputSources = "PSPHOT.OUT.CMF.MEF"; ## this must be consistent with the value in stack_skycell.pl :161176 $inputSources = "PSPHOT.OUT.CMF.MEF"; ## this must be consistent with the value in stack_skycell.pl 166 177 } else { 167 178 $input = "PSWARP.OUTPUT"; … … 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 -
branches/eam_branches/ipp-20110213/ippScripts/scripts/dist_bundle.pl
r30676 r31083 70 70 71 71 # Parse the command-line arguments 72 my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $alt_path_base, $clean );72 my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $alt_path_base, $clean, $exp_type); 73 73 my ($outroot, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file, $prefix); 74 74 my ($dbname, $save_temps, $verbose, $no_update, $logfile); … … 89 89 'alt_path_base=s'=> \$alt_path_base, # path to alternate inputs 90 90 'outroot=s' => \$outroot, # outroot 91 'exp_type=s' => \$exp_type, # exp_type (only used for raw stage 91 92 'prefix=s' => \$prefix, # "prefix" to apply to filenames 92 93 'clean' => \$clean, # create clean distribution … … 99 100 100 101 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 101 pod2usage( -msg => "Required options: --camera --stage --stage_id --component -- path_base --outroot",102 pod2usage( -msg => "Required options: --camera --stage --stage_id --component --exp_type --path_base --outroot", 102 103 -exitval => 3) unless 103 104 defined $camera and … … 105 106 defined $stage_id and 106 107 defined $component and 108 defined $exp_type and 107 109 defined $path_base and 108 110 defined $outroot; … … 110 112 $ipprc->redirect_output($logfile) if $logfile; 111 113 112 if (($stage eq 'raw') and !$clean and !defined $chip_path_base) { 113 pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3); 114 if ($stage eq 'raw' and !$clean and !$no_magic) { 115 # need to be able to find chip mask file 116 if ($exp_type eq 'OBJECT' and !defined $chip_path_base) { 117 pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3); 118 } 114 119 } 115 120 … … 123 128 my $file_list = get_file_list($stage, $component, $path_base, $clean); 124 129 125 if (($stage ne 'raw') and ($stage ne 'fake') ) {130 if (($stage ne 'raw') and ($stage ne 'fake') and !$poor_quality) { 126 131 # If the file list is empty it is an error because we should at least get a config dump file 127 132 # except for fake stage which doesn't do anything yet … … 493 498 push @file_list, \%image; 494 499 495 my %burntool_table; 496 $burntool_table{file_rule} = "BURNTOOL.TABLE"; 497 $burntool_table{name} = "$path_base.burn.tbl"; 498 push @file_list, \%burntool_table; 500 if ($exp_type eq 'OBJECT' and $camera eq 'GPC1') { 501 my %burntool_table; 502 $burntool_table{file_rule} = "BURNTOOL.TABLE"; 503 $burntool_table{name} = "$path_base.burn.tbl"; 504 push @file_list, \%burntool_table; 505 } 499 506 } 500 507 return \@file_list; … … 541 548 my $resolved = $ipprc->file_resolve($config_file); 542 549 550 if (!$resolved and $poor_quality) { 551 print STDERR "non config file found but continuing since component has poor quality\n"; 552 return undef 553 } 543 554 &my_die("failed to resolve name of config dump file: $config_file_rule", $component, 544 555 $PS_EXIT_CONFIG_ERROR) if (!$resolved); -
branches/eam_branches/ipp-20110213/ippScripts/scripts/dist_component.pl
r30489 r31083 37 37 # Parse the command-line arguments 38 38 my ($dist_id, $camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $clean, $alt_path_base); 39 my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality );39 my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $exp_type); 40 40 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 41 41 … … 53 53 'no_magic' => \$no_magic, # magic is not required for this distribution run 54 54 'magicked' => \$magicked, # magicked state for this component 55 'exp_type=s' => \$exp_type, 55 56 'alt_path_base=s'=> \$alt_path_base, # path to alternate inputs 56 57 'outdir=s' => \$outdir, # "directory" for outputs … … 81 82 $temproot = "/tmp" if !defined $temproot; 82 83 83 if (($stage eq 'raw') and !$clean and ! defined $chip_path_base) {84 pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3);84 if (($stage eq 'raw') and !$clean and !(defined $chip_path_base and defined $exp_type)) { 85 pod2usage( -msg => "Required options: --chip_path_base --exp_type for raw stage", -exitval => 3); 85 86 } 86 87 … … 105 106 $command .= " --magicked" if defined $magicked; 106 107 $command .= " --alt_path_base $alt_path_base" if defined $alt_path_base; 108 $command .= " --exp_type $exp_type" if defined $exp_type; 107 109 $command .= " --clean" if defined $clean; 108 110 $command .= " --save-temps" if defined $save_temps; -
branches/eam_branches/ipp-20110213/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed
/trunk/ippScripts/scripts/ipp_apply_burntool_single.pl merged: 30944,30999
r30812 r31083 131 131 run ( command => $regtool_status_cmd, verbose => $verbose ); 132 132 unless ($success) { 133 print "Unsuccessful at running regtool -checkstatus, aborting continue\n"; 133 134 $continue = 0; 134 135 } … … 237 238 $command .= " -set_state full "; 238 239 } 240 239 241 $status = vsystem ($command, $REALRUN); 240 242 if ($status) { - Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110213/ippScripts/scripts/ipp_cleanup.pl
r30676 r31083 130 130 $status = 0 unless defined $path_base and $path_base ne "NULL"; 131 131 132 my $poor_quality = $imfile->{quality} > 0; 133 132 134 # don't clean up unless the data needed to update is available 133 135 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 134 136 # goto_scrubbed now requires the config file to not exist. 135 if ($status ) {137 if ($status and !$poor_quality) { 136 138 if ($mode eq "goto_cleaned") { 137 139 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); … … 1902 1904 1903 1905 foreach my $file (@$files) { 1904 print STDERR "unlinking $stage $stage_id $file ";1906 print STDERR "unlinking $stage $stage_id $file\n"; 1905 1907 1906 1908 my $error_code = $ipprc->kill_file($file); -
branches/eam_branches/ipp-20110213/ippScripts/scripts/magic_destreak_revert.pl
r30812 r31083 204 204 205 205 # only revert sources if this is a new run, not one being updated 206 if ( $run_state eq 'new') {206 if (($run_state eq 'new') or ($run_state eq 'goto_restored')) { 207 207 $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id); 208 208 $bsources = $ipprc->filename("PSPHOT.OUTPUT", $backup_path_base, $class_id); -
branches/eam_branches/ipp-20110213/ippScripts/scripts/minidvodb_merge.pl
r28311 r31083 16 16 my $dtime_relphot; 17 17 my $dtime_merge; 18 my $dtime_verify; 19 my $dtime_script; 18 20 19 21 use vars qw( $VERSION ); … … 36 38 my $relphot = can_run('relphot') or (warn "Can't find relphot" and $missing_tools = 1); 37 39 my $relastro = can_run('relastro') or (warn "Can't find relastro" and $missing_tools = 1); 40 my $dvoverify = can_run('dvoverify') or (warn "Can't find dvoverify" and $missing_tools = 1); 41 42 38 43 if ($missing_tools) { 39 44 warn("Can't find required tools."); … … 87 92 unless ($no_op) { 88 93 if (defined $mergedvodbReal) { 94 95 #this is chopped into several parts: addstar, relphot, dvoverify, merge 96 97 98 #addstar 89 99 { 90 100 my $command = "$addstar -resort"; … … 105 115 print "addstar -resort time $dtime_addstar\n"; 106 116 } 117 118 #relphot 107 119 108 120 { … … 124 136 print "relphot time $dtime_relphot\n"; 125 137 } 138 #dvoverify 139 { 140 my $command = "$dvoverify -s $minidvodb"; 141 print "$command\n"; 142 my $mjd_dvoverify_start = DateTime->now->mjd; # MJD of starting script 143 144 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 145 run(command => $command, verbose => $verbose); 146 unless ($success) { 147 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 148 &my_die("Unable to perform dvoverify: $error_code", $mergedvodb, $error_code); 149 } 150 $dtime_verify = 86400.0*(DateTime->now->mjd - $mjd_dvoverify_start); # MJD of starting script 151 print "dvoverify time $dtime_verify\n"; 152 } 153 154 155 #Merge 126 156 127 157 my $this_is_the_first; … … 190 220 191 221 { 222 223 $dtime_script = 86400.0*(DateTime->now->mjd - $mjd_start); 224 225 192 226 my $command = "addtool -minidvodb_id $minidvodb_id"; 193 227 $command .= " -addminidvodbprocessed"; … … 197 231 $command .= " -dtime_resort $dtime_resort" if defined $dtime_resort; 198 232 $command .= " -dtime_merge $dtime_merge" if defined $dtime_merge; 199 $command .= " -dbname $dbname" if defined $dbname; 233 $command .= " -dtime_script $dtime_script" if defined $dtime_script; 234 $command .= " -dtime_verify $dtime_verify" if defined $dtime_verify; 235 $command .= " -dbname $dbname" if defined $dbname; 200 236 #print $command; 201 237 … … 236 272 $command .= " -dtime_resort $dtime_resort" if defined $dtime_resort; 237 273 $command .= " -dtime_merge $dtime_merge" if defined $dtime_merge; 274 $command .= " -dtime_script $dtime_script" if defined $dtime_script; 275 $command .= " -dtime_verify $dtime_verify" if defined $dtime_verify; 238 276 $command .= " -dbname $dbname" if defined $dbname; 239 277 -
branches/eam_branches/ipp-20110213/ippScripts/scripts/register_exp.pl
r30553 r31083 189 189 190 190 if ($exptype ne 'OBJECT') { 191 print " Aborting because exptype doesn't claim to be OBJECT: $exptype\n";191 print "Skipping because exptype doesn't claim to be OBJECT: $exptype\n"; 192 192 return(undef,undef,undef,"reg",undef,undef,undef); 193 193 } 194 194 if ($obsmode eq 'ENGINEERING') { 195 print " Aborting because we don't queue engineering data to chip\n";195 print "Skipping because we don't queue engineering data to chip\n"; 196 196 return(undef,undef,undef,"reg",undef,undef,undef); 197 197 } -
branches/eam_branches/ipp-20110213/ippScripts/scripts/register_imfile.pl
r30812 r31083 267 267 268 268 if ((abs($burntoolStateCurrent) != $burntoolStateTarget)&& 269 (!is_daytime($dateobs,$sunrise,$sunset))) { 269 (!is_daytime($dateobs,$sunrise,$sunset))&& 270 (!is_ccim($tmp_exp_name,$exp_type))) { 270 271 my $mdcParser = PS::IPP::Metadata::Config->new; 271 272 … … 389 390 my $exp_name = shift; 390 391 my $exp_type = shift; 391 392 $exp_type =~ s/'//g; 392 393 # needs to match regtool.c checks for "is_ccim". 393 394 if ($exp_name =~ /c/) { -
branches/eam_branches/ipp-20110213/ippScripts/scripts/stack_skycell.pl
r30676 r31083 65 65 and defined $run_state; 66 66 67 # lists of file rules which we expect to produce output output 68 my @outputList = qw( 69 PPSTACK.OUTPUT 70 PPSTACK.OUTPUT.MASK 71 PPSTACK.OUTPUT.VARIANCE 72 PPSTACK.OUTPUT.EXP 73 PPSTACK.OUTPUT.EXPNUM 74 PPSTACK.OUTPUT.EXPWT 75 PPSTACK.TARGET.PSF 76 PPSTACK.OUTPUT.JPEG1 77 PPSTACK.OUTPUT.JPEG2 78 PPSTACK.CONFIG 79 ); 80 # produced if we run photometry 81 my @outputListPhotom = qw( 82 PSPHOT.OUT.CMF.MEF 83 ); 84 # extra outputs when convolving 85 my @outputListUnconv = qw( 86 PPSTACK.UNCONV 87 PPSTACK.UNCONV.MASK 88 PPSTACK.UNCONV.VARIANCE 89 PPSTACK.UNCONV.EXP 90 PPSTACK.UNCONV.EXPNUM 91 PPSTACK.UNCONV.EXPWT 92 ); 93 67 94 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $stack_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 68 95 $| = 1; … … 73 100 my $logDest = "$outroot.log"; 74 101 75 my $do_stats; 76 if ($run_state eq 'new') { 77 $do_stats = 1; 78 } else { 102 if ($run_state eq 'update') { 79 103 $logDest .= ".update"; 80 104 } 81 105 82 106 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $stack_id, $PS_EXIT_SYS_ERROR ) if $redirect; 107 108 my $neb; 109 my $scheme = file_scheme($outroot); 110 if ($scheme and $scheme eq 'neb') { 111 $neb = $ipprc->nebulous(); 112 } 113 83 114 84 115 my $temp_images_exist = 0; … … 173 204 my $output_nocomp = metadataLookupBool($recipe, 'OUTPUT.NOCOMP'); # change filerules to produced uncompressed output images 174 205 my $output_logflux = metadataLookupBool($recipe, 'OUTPUT.LOGFLUX'); # change filerules to produce logflux compressed output images. 175 206 my $replicate_outputs = (defined($neb) and metadataLookupBool($recipe, 'OUTPUT.REPLICATE')); # replicate output images 176 207 if ($output_nocomp and $output_logflux) { 177 208 &my_die("Unable to not compress and logflux compress simultaneously. Check config.",$stack_id, $PS_EXIT_CONFIG_ERROR); … … 212 243 print "I've checked everything: $stack_id\n"; 213 244 214 # Get the output filenames 215 my $outputName = $ipprc->filename("PPSTACK.OUTPUT", $outroot); 216 my $outputMask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $outroot); 217 my $outputWeight = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $outroot); 218 my $outputSources = $photometry ? $ipprc->filename("PSPHOT.OUT.CMF.MEF", $outroot) : undef; ## this must be consistent with the value in diff_skycell.pl:101 245 # Prepare the output files 246 my @outputFiles; 247 prepare_outputs(\@outputFiles, \@outputList, $outroot); 248 prepare_outputs(\@outputFiles, \@outputListPhotom, $outroot) if $photometry; 249 prepare_outputs(\@outputFiles, \@outputListUnconv, $outroot) if $convolve; 250 251 # we need the output image name for the database 252 my $outputName = $outputFiles[0]; 219 253 220 254 ## use an explicit stack name for psphot output objects 221 #my $bin1Name = $ipprc->filename("PPSTACK.BIN1", $outroot); 222 #my $bin2Name = $ipprc->filename("PPSTACK.BIN2", $outroot); 223 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 224 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 225 $traceDest .= ".update" if $run_state eq 'update'; 226 my $configuration = $ipprc->filename("PPSTACK.CONFIG", $outroot); 255 my $do_stats = 1; 256 my $outputStats; 257 my $traceDest; 258 my $configuration = prepare_output("PPSTACK.CONFIG", $outroot, 1); 259 if ($run_state eq 'new') { 260 $outputStats = prepare_output("SKYCELL.STATS", $outroot, 1); 261 $traceDest = prepare_output("TRACE.EXP", $outroot, 1); 262 push @outputFiles, $configuration; 263 push @outputFiles, $outputStats; 264 } else { 265 # we need to do stats regardless because we need the quality flag 266 # $do_stats = 0; 267 $outputStats = prepare_output("SKYCELL.STATS.UPDATE", $outroot, 1) if $do_stats; 268 $traceDest = prepare_output("TRACE.EXP.UPDATE", $outroot, 1); 269 } 270 227 271 $temp_images_exist = 1; # failures after this point should attempt to delete the temp images 228 272 229 # for update we need to resolve the config filename here because the code that reads it230 # doesn't know how to resolve paths. (The information is stored in the configuration file)231 $configuration = $ipprc->file_resolve($configuration) if ($run_state eq 'update');232 233 273 my $cmdflags; 234 235 274 236 275 # Perform stacking 237 276 unless ($no_op) { 238 277 my $command = "$ppStack -input $listName $outroot"; 239 $command .= " -stats $outputStats" if $do_stats; ;278 $command .= " -stats $outputStats" if $do_stats; 240 279 $command .= " -recipe PPSTACK $recipe_ppStack"; 241 280 $command .= " -recipe PPSUB $recipe_ppSub"; … … 311 350 312 351 if (!$quality) { 313 &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); 314 &my_die("Couldn't find expected output file: $outputMask", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 315 &my_die("Couldn't find expected output file: $outputWeight", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight); 316 if ($photometry) { 317 &my_die("Couldn't find expected output file: $outputSources", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 318 } 319 if ($run_state eq 'new') { 320 &my_die("Couldn't find expected output file: $configuration", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($configuration); 321 } 322 # &my_die("Couldn't find expected output file: $bin1Name", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name); 323 # &my_die("Couldn't find expected output file: $bin2Name", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name); 352 check_outputs(\@outputFiles, $replicate_outputs); 324 353 } 325 354 … … 357 386 } 358 387 359 print "I've updated t ehdatabase: $stack_id\n";388 print "I've updated the database: $stack_id\n"; 360 389 361 390 … … 423 452 } 424 453 } 454 sub prepare_output 455 { 456 my $filerule = shift; 457 my $outroot = shift; 458 my $delete = shift; 459 $delete = 0 if !defined $delete; 460 461 my $error; 462 my $output = $ipprc->prepare_output($filerule, $outroot, undef, $delete, \$error) 463 or &my_die("failed to prepare output file for: $filerule", $stack_id, $error); 464 return $output; 465 } 466 467 sub prepare_outputs 468 { 469 my $fileList = shift; 470 my $ruleList = shift; 471 my $outroot = shift; 472 473 foreach my $rule (@$ruleList) { 474 push @$fileList, prepare_output($rule, $outroot, 1); 475 } 476 } 477 478 sub check_output 479 { 480 my $file = shift; 481 my $replicate = shift; 482 483 if (!defined $file) { 484 return; 485 } 486 487 &my_die("Couldn't find expected output file: $file", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file); 488 489 if ($replicate and $neb) { 490 $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n", $stack_id, $PS_EXIT_SYS_ERROR); 491 } 492 } 493 494 sub check_outputs 495 { 496 my $fileList = shift; 497 my $replicate = shift; 498 foreach my $file (@$fileList) { 499 check_output($file, $replicate); 500 } 501 } 425 502 426 503 print "I've reached the end of processing with a code of $?: $stack_id\n"; … … 432 509 } 433 510 511 434 512 __END__ -
branches/eam_branches/ipp-20110213/ippScripts/scripts/summit_copy.pl
r25418 r31083 22 22 23 23 # Parse the command-line arguments 24 my ( $uri, $filename, $compress, $bytes, $md5, $nebulous, $ exp_name, $inst, $telescope, $class, $class_id,24 my ( $uri, $filename, $compress, $bytes, $md5, $nebulous, $summit_id, $exp_name, $inst, $telescope, $class, $class_id, 25 25 $dbname, $verbose, $no_update, $no_op, $timeout, $copies ); 26 26 GetOptions( … … 31 31 'md5=s' => \$md5, # reported md5 checksum 32 32 'nebulous' => \$nebulous, # use nebulous for the target file 33 'summit_id=s' => \$summit_id, # summit_id for this exposure 33 34 'exp_name=s' => \$exp_name, # Exposure name 34 35 'inst=s' => \$inst, # Instrument … … 45 46 46 47 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 47 pod2usage( -msg => "Required options: --uri --filename -- exp_name --inst --telescope --class --class_id",48 pod2usage( -msg => "Required options: --uri --filename --summit_id --exp_name --inst --telescope --class --class_id", 48 49 -exitval => 3) 49 50 unless defined $uri 50 51 and defined $filename 52 and defined $summit_id 51 53 and defined $exp_name 52 54 and defined $inst … … 110 112 $command = "$pztool -copydone"; 111 113 $command .= " -row_lock"; 114 $command .= " -summit_id $summit_id"; 112 115 $command .= " -exp_name $exp_name"; 113 116 $command .= " -inst $inst"; … … 236 239 my $command; 237 240 $command = "$pztool -copydone"; 241 $command .= " -summit_id $summit_id"; 238 242 $command .= " -exp_name $exp_name"; 239 243 $command .= " -inst $inst"; … … 246 250 247 251 system ($command); 252 253 if ($exit_code == 110) { 254 $command = "$pztool -updatepzexp"; 255 $command .= " -exp_name $exp_name"; 256 $command .= " -camera $inst"; 257 $command .= " -telescope $telescope"; 258 $command .= " -set_state drop"; 259 $command .= " -dbname $dbname" if defined $dbname; 260 261 system ($command); 262 } 263 248 264 } 249 265 -
branches/eam_branches/ipp-20110213/ippScripts/scripts/warp_skycell.pl
r30590 r31083 76 76 $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1); 77 77 } elsif ($run_state eq 'update') { 78 $logDest = prepare_output("LOG.EXP.UPDATE", $outroot, $skycell_id, 0);78 $logDest = prepare_output("LOG.EXP.UPDATE", $outroot, $skycell_id, 1); 79 79 $traceDest = prepare_output("TRACE.EXP.UPDATE", $outroot, $skycell_id, 1); 80 80 } else { … … 318 318 319 319 if (!$quality) { 320 # &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);321 # &my_die("Couldn't find expected output file: $outputMask", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);322 # &my_die("Couldn't find expected output file: $outputWeight", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);323 # &my_die("Couldn't find expected output file: $outputSources", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);324 # &my_die("Couldn't find expected output file: $outputPSF", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) if metadataLookupBool($recipe, 'PSF') and not $ipprc->file_exists($outputPSF);325 326 320 check_output($outputImage, 0); 327 321 check_output($outputMask, 0); … … 331 325 if ($dump_config) { 332 326 check_output($configuration, 1); 333 # &my_die("Couldn't find expected output file: $configuration", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($configuration);334 327 } 335 328 }
Note:
See TracChangeset
for help on using the changeset viewer.
