Changeset 31587 for branches/eam_branches/ipp-20110505/ippScripts
- Timestamp:
- May 29, 2011, 11:26:31 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110505/ippScripts/scripts
- Files:
-
- 7 edited
-
camera_exp.pl (modified) (1 diff)
-
dist_advancerun.pl (modified) (1 diff)
-
dist_bundle.pl (modified) (6 diffs)
-
ipp_apply_burntool_single.pl (modified) (1 prop)
-
lap_science.pl (modified) (21 diffs)
-
receive_file.pl (modified) (2 diffs)
-
warp_skycell.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110505/ippScripts/scripts/camera_exp.pl
r30071 r31587 153 153 } 154 154 chomp $cmdflags; 155 156 { # Determine if FWHM is too large to bother continuing. 157 my $command = "$ppConfigDump -camera $camera -dump-camera -"; 158 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 159 run(command => $command, verbose => $verbose); 160 unless ($success) { 161 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 162 &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR); 163 } 164 my $cameraConfig = $mdcParser->parse(join "", @$stdout_buf) or 165 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR); 166 167 my $maxFWHM = metadataLookupStr($cameraConfig, 'MAX_ALLOWED_FWHM'); 168 if ($maxFWHM) { 169 my $expFWHM; 170 ($expFWHM) = $cmdflags =~ /-fwhm_major (\d+)/; 171 172 if ($expFWHM > $maxFWHM) { 173 print "Setting quality to 4007 due to large FWHM: exposure: $expFWHM maximum: $maxFWHM\n"; 174 $cmdflags .= " -quality 4007 "; # This corresponds to PSASTRO_ERR_DATA 175 $no_op = 1; 176 } 177 } 178 } 155 179 } 156 180 -
branches/eam_branches/ipp-20110505/ippScripts/scripts/dist_advancerun.pl
r30489 r31587 114 114 $tool_cmd = "$staticskytool -sky_id"; 115 115 $list_mode = "-result"; 116 $component_key = " ";116 $component_key = "skycell_id"; 117 117 } elsif ($stage eq "diff") { 118 118 $tool_cmd = "$difftool -diff_id"; -
branches/eam_branches/ipp-20110505/ippScripts/scripts/dist_bundle.pl
r30922 r31587 62 62 my $streaksrelease = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1); 63 63 my $bgtool = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1); 64 my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1); 64 65 my $file_cmd = can_run('file') or (warn "can't find program file" and $missing_tools = 1); 65 66 my $zcat = can_run('zcat') or (warn "can't find program zcat" and $missing_tools = 1); … … 106 107 defined $stage_id and 107 108 defined $component and 108 defined $exp_type and109 109 defined $path_base and 110 110 defined $outroot; 111 111 112 if ($stage eq 'raw' and !$clean and !$no_magic) { 113 114 # for raw stage need to have exposure type defined and if the type is OBJECT we need 115 # a chip_path_base so we can find the chip mask file 116 if (!defined $exp_type or ($exp_type eq 'OBJECT' and !defined $chip_path_base)) { 117 pod2usage( -msg => "Required options: --chip_path_base --exp_type for raw stage", -exitval => 3); 118 } 119 } 120 112 121 $ipprc->redirect_output($logfile) if $logfile; 113 122 114 if ($stage eq 'raw' and !$clean and !$no_magic) {115 # need to be able to find chip mask file116 if ($exp_type eq 'OBJECT' and !defined $chip_path_base) {117 pod2usage( -msg => "Required options: --chip_path_base for raw stage", -exitval => 3);118 }119 }120 121 123 $ipprc->define_camera($camera); 122 124 123 125 $ipprc->outroot_prepare($outroot); 124 126 127 my $num_sky_inputs; 128 if ($stage eq 'sky') { 129 $num_sky_inputs = get_num_sky_inputs($stage_id); 130 } 125 131 # Get the list of data products for this component 126 132 # note: We my_die in get_file_list if something goes wrong. 127 133 128 my $file_list = get_file_list($stage, $component, $path_base, $clean );134 my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs); 129 135 130 136 if (($stage ne 'raw') and ($stage ne 'fake') and !$poor_quality) { … … 184 190 # it must exist) 185 191 next if $poor_quality; 192 193 # skip file stats file. Due to a bug the update process destroys them sometimes 194 # XXX: perhaps only do this for stages where we know that this happens 195 next if $file_rule =~ /STATS/; 186 196 187 197 &my_die("failed to resolve $file_name", $component, $PS_EXIT_DATA_ERROR); … … 480 490 my $path_base = shift; 481 491 my $clean = shift; 492 my $num_sky_inputs = shift; 482 493 483 494 my @file_list; … … 531 542 $config_file_rule = "PPSTACK.CONFIG"; 532 543 } elsif ($stage eq "sky") { 533 $config_file_rule = "PSPHOT.STACK.CONFIG"; 544 if ($num_sky_inputs > 1) { 545 $config_file_rule = "PSPHOT.STACK.CONFIG"; 546 } else { 547 $config_file_rule = "PSPHOT.SKY.CONFIG"; 548 } 534 549 } else { 535 550 &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR); … … 627 642 return \@file_list; 628 643 } 644 sub get_num_sky_inputs { 645 my $sky_id = shift; 646 647 my $command = "$staticskytool -inputs -sky_id $sky_id -simple"; 648 $command .= " -dbname $dbname" if $dbname; 649 $command .= " | wc"; 650 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 651 run(command => $command, verbose => $verbose); 652 unless ($success) { 653 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 654 &my_die("Unable to perform $command: $error_code", $component, $error_code); 655 } 656 my ($num_inputs, $words, $chars) = split " ", (join "", @$stdout_buf); 657 if (!$num_inputs) { 658 $num_inputs = "undefined" if !defined $num_inputs; 659 &my_die("unexpected number of static sky inputs $num_inputs", $PS_EXIT_PROG_ERROR, $component, $error_code); 660 } 661 662 return $num_inputs; 663 } 629 664 630 665 sub my_die -
branches/eam_branches/ipp-20110505/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110505/ippScripts/scripts/lap_science.pl
r31454 r31587 99 99 my $status = queue_chips($lap_id); 100 100 101 if ( $status) {101 if (!$status) { # This is the culprit. 102 102 my $command = "$laptool -updaterun -lap_id $lap_id"; 103 103 $command .= " -dbname $dbname " if defined $dbname; … … 120 120 # This is a puzzler... chiptool doesn't actually return a useful metadata. We'll just scrape it from the database for now. 121 121 122 my $command = "$chiptool -listrun - exp_id $exp_id -label $label -data_group $data_group";122 my $command = "$chiptool -listrun -pstamp_order -exp_id $exp_id -label $label -data_group $data_group"; 123 123 $command .= " -dbname $dbname " if defined $dbname; 124 124 … … 236 236 my $comment = $exposure->{comment}; 237 237 238 # This is a hack to fix old exposures that have no object. 239 unless(defined($comment)) { 240 $comment = ''; 241 } 242 if ((!defined($object))||($object eq 'NULL')||($object eq '')) { 243 if ($comment =~ /3pi_/) { 244 $object = $comment; 245 $object =~ s/^.*?(3pi_\d\d_\d\d\d\d).*?$/$1/; 246 } 247 elsif ($comment =~ / ps1_/) { 248 $object = $comment; 249 $object =~ s/^.*?(ps1_\d\d_\d\d\d\d).*$/$1/; 250 } 251 else { 252 $exposure->{data_state} = 'new'; 253 $exposure->{pairwise} = 0; 254 $exposure->{private} = 1; 255 $exposure->{pair_id} = 9223372036854775807; 256 update_this_exposure($exposure); 257 $counter++; 258 next; 259 } 260 } 261 262 238 263 if (S64_IS_NOT_NULL($chip_id)) { # We already have a defined chip_id 239 264 if (($pairwise) && !($pair_id)) { … … 255 280 $counter++; 256 281 } 282 print "ZZ: $exp_id $object $comment $matching{$object}{$comment}\n"; 257 283 } 258 284 … … 262 288 foreach my $comment (keys %{ $matching{$object} }) { 263 289 push @exp_ids_to_diff, $matching{$object}{$comment}; 290 print "$object $comment $matching{$object}{$comment} $indexing{$matching{$object}{$comment}} $exp_ids_to_diff[-1]\n"; 264 291 } 265 292 @exp_ids_to_diff = sort { $indexing{$a} <=> $indexing{$b} } @exp_ids_to_diff; … … 275 302 my $exp_A = ${ $exposures }[$indexing{$exp_id_A}]; 276 303 my $exp_B = ${ $exposures }[$indexing{$exp_id_B}]; 277 304 print "$exp_A $exp_B $exp_id_A $exp_id_B $indexing{$exp_id_A} $indexing{$exp_id_B}\n"; 278 305 $exp_A->{pairwise} = 1; 279 306 $exp_A->{private} = 0; … … 292 319 # Scan all exposures, and ensure that pairwise and private are set correctly 293 320 foreach my $exposure (@$exposures) { 321 print "YY: $exposure\n"; 294 322 if ($exposure->{pairwise} && !($exposure->{pair_id})) { 295 323 $exposure->{pairwise} = 0; # We marked it for pairwise diffs, but didn't match it. Probably an error. … … 299 327 } 300 328 301 $exposure =update_this_exposure($exposure);302 } 303 return( 1);329 update_this_exposure($exposure); 330 } 331 return(0); 304 332 } 305 333 … … 432 460 my $companion; 433 461 434 if ($exposure->{pair_id}) { # Load companion exposure information 435 if (exists($match_hash{$exposure->{chip_id}})) { 462 if ($exposure->{pairwise}) { 463 # Load companion exposure information 464 if (($exposure->{pair_id})&&(exists($match_hash{$exposure->{chip_id}}))) { 436 465 $companion = ${ $exposures }[$match_hash{$exposure->{chip_id}}]; # Match! 466 } 467 else { # We claimed to be pairwise, but do not have a valid pair_id. 468 $exposure->{pairwise} = 0; 469 $exposure->{private} = 1; 470 &update_this_exposure($exposure); 437 471 } 438 472 } … … 446 480 $exposure = remake_this_exposure($exposure); 447 481 } 448 if ($exposure->{cam_quality}) { 449 $needs_qstack = 1; 450 $needs_something_private = 1; 451 if ($companion) { 452 $companion->{private} = 1; 453 $companion->{pairwise} = 0; 454 &update_this_exposure($companion); 482 # Do quality checks here 483 my $is_bad_quality = 0; 484 if ((defined($exposure->{chipRun_state}))&&($exposure->{chipRun_state} eq 'full')&& 485 ($exposure->{chip_component_count} > 0)&&($exposure->{chip_bad_quality} / $exposure->{chip_component_count} > 0.05)) { 486 printf("QUALITY: $exposure->{exp_id} has bad chip quality: %d / %d\n", 487 $exposure->{chip_bad_quality} , $exposure->{chip_component_count}); 488 $is_bad_quality = 1; 489 } 490 elsif ((defined($exposure->{camRun_state}))&&($exposure->{camRun_state} eq 'full')&& 491 ($exposure->{cam_bad_quality} / $exposure->{cam_component_count} > 0)) { 492 printf("QUALITY: $exposure->{exp_id} has bad cam quality: %d / %d\n", 493 $exposure->{cam_bad_quality} , $exposure->{cam_component_count}); 494 $is_bad_quality = 1; 495 } 496 elsif ((defined($exposure->{warpRun_state}))&&($exposure->{warpRun_state} eq 'full')&& 497 ($exposure->{warp_bad_quality} / $exposure->{warp_component_count} > 0.2)) { 498 printf("QUALITY: $exposure->{exp_id} has bad warp quality: %d / %d\n", 499 $exposure->{warp_bad_quality} , $exposure->{warp_component_count}); 500 $is_bad_quality = 1; 501 } 502 elsif ((defined($exposure->{diffRun_state}))&&($exposure->{diffRun_state} eq 'full')&& 503 ($exposure->{diff_bad_quality} / $exposure->{diff_component_count} > 0.5)) { 504 printf("QUALITY: $exposure->{exp_id} has bad diff quality: %d / %d\n", 505 $exposure->{diff_bad_quality} , $exposure->{diff_component_count}); 506 $is_bad_quality = 1; 507 } 508 # If we've detected a bad quality exposure, drop it, and tell the companion. 509 if ($is_bad_quality) { 510 unless ((defined($exposure->{diffRun_state}))&& 511 ($exposure->{diffRun_state} eq 'full')) { 512 $needs_qstack = 1; 513 $needs_something_private = 1; 514 if ($companion) { 515 $companion->{private} = 1; 516 $companion->{pairwise} = 0; 517 &update_this_exposure($companion); 518 } 519 $exposure->{private} = 1; 520 $exposure->{pairwise} = 0; 455 521 } 456 $exposure->{private} = 1;457 $exposure->{pairwise} = 0;458 522 $exposure->{data_state} = 'drop'; 459 523 &update_this_exposure($exposure); 460 524 461 525 } 462 # if ($companion) { # Validate that there are no problems with the companion exposure 463 # if ($companion->{cam_quality}) { # Maybe other things here? 464 # $exposure->{private} = 1; 465 # $exposure->{data_state} = 'drop'; 466 # &update_this_exposure($exposure); 467 # $needs_qstack = 1; 468 # } 469 # } 526 470 527 if ($exposure->{data_state} eq 'drop') { # This exposure is impossible, so fudge the counts so we get through. 471 528 $can_qstack ++; … … 564 621 } 565 622 623 my $warps = ''; 624 foreach $exposure (@$exposures) { 625 if (($exposure->{data_state} != 'drop')&& 626 (S64_IS_NOT_NULL($exposure->{warp_id}))) { 627 $warps .= " -warp_id $exposure->{warp_id} "; 628 } 629 } 630 566 631 my @utctime = gmtime(); 567 632 $utctime[5] += 1900; … … 570 635 my $workdir_date = sprintf("%4d/%02d/%02d",$utctime[5],$utctime[4],$utctime[3]); 571 636 my $workdir = "neb://\@HOST\@.0/${dbname}/${label}/${workdir_date}"; 572 my $data_group = "${label}.${ date}";637 my $data_group = "${label}.${proj_cell}.quick.${date}"; 573 638 574 639 my $command = "$stacktool "; … … 576 641 $command .= " -dbname $dbname " if defined $dbname; 577 642 $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter "; 578 $command .= " -set_label ${label} -set_data_group $ {proj_cell}.quick.${date}";643 $command .= " -set_label ${label} -set_data_group $data_group "; 579 644 $command .= " -set_workdir $workdir -set_dist_group NODIST "; 580 645 $command .= " -min_num 2 -set_reduction QUICKSTACK "; 646 $command .= " $warps "; 581 647 582 648 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 589 655 $command = "$stacktool "; 590 656 $command .= " -dbname $dbname " if defined $dbname; 591 $command .= " -sassskyfile -data_group $ {proj_cell}.quick.${date}";657 $command .= " -sassskyfile -data_group $data_group "; 592 658 $command .= " -filter $filter -projection_cell ${proj_cell} "; 593 659 … … 632 698 unless (defined($label) && defined($filter) && defined($proj_cell)) { 633 699 &my_die("Unable to perform stacktool. Insufficient information.", $lap_id); 700 } 701 702 my $warps = ''; 703 foreach $exposure (@$exposures) { 704 if (($exposure->{data_state} != 'drop')&& 705 (S64_IS_NOT_NULL($exposure->{magicked}))&& 706 (S64_IS_NOT_NULL($exposure->{warp_id}))) { 707 $warps .= " -warp_id $exposure->{warp_id} "; 708 } 634 709 } 635 710 … … 640 715 my $workdir_date = sprintf("%4d/%02d/%02d",$utctime[5],$utctime[4],$utctime[3]); 641 716 my $workdir = "neb://\@HOST\@.0/${dbname}/${label}/${workdir_date}"; 642 my $data_group = "${label}.${ date}";717 my $data_group = "${label}.${proj_cell}.final.${date}"; 643 718 644 719 my $command = "$stacktool "; … … 646 721 $command .= " -dbname $dbname " if defined $dbname; 647 722 $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter "; 648 $command .= " -set_label ${label} -set_workdir $workdir -set_data_group ${proj_cell}.final.${date} "; 649 $command .= " -min_num 2 -set_reduction THREEPI_STACK "; 723 $command .= " -set_label ${label} -set_workdir $workdir -set_data_group $data_group "; 724 $command .= " -min_num 2 -set_reduction THREEPI_STACK -set_dist_group ${label} "; 725 $command .= " $warps "; 650 726 651 727 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 659 735 $command = "$stacktool "; 660 736 $command .= " -dbname $dbname " if defined $dbname; 661 $command .= " -sassskyfile -data_group $ {proj_cell}.final.${date}";737 $command .= " -sassskyfile -data_group $data_group "; 662 738 $command .= " -filter $filter -projection_cell ${proj_cell} "; 663 739 … … 734 810 $command .= " -set_dist_group $exposure->{dist_group} "; 735 811 } 736 737 if ( $exposure->{pairwise}) { # warpwarp812 my $retry_command; 813 if (($exposure->{pairwise})&&(defined(${ $exposures }[$match_hash{$exposure->{chip_id}}]))) { # warpwarp 738 814 my $companion = ${ $exposures }[$match_hash{$exposure->{chip_id}}]; 739 815 $command .= " -definewarpwarp "; 740 $command .= "-input_label $label -template_label $label -backwards";816 $command .= "-input_label $label -template_label $label "; 741 817 $command .= "-warp_id $exposure->{warp_id} -template_warp_id $companion->{warp_id} "; 818 $retry_command = $command; 819 $command .= " -backwards "; # This usually works. 742 820 $already_queued{$exposure->{warp_id}} = 1; 743 821 $already_queued{$companion->{warp_id}} = 1; … … 763 841 my $diff_id = $diff->{diff_id}; 764 842 unless (defined($diff_id)) { 765 $exposure->{data_state} = 'drop'; 766 &update_this_exposure($exposure); 767 } 768 843 if ($retry_command) { 844 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 845 run(command => $retry_command, verbose => $verbose); 846 unless ($success) { 847 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 848 &my_die("unable to perform difftool -definewarp(warp|stack): $error_code", $exposure->{lap_id}, $exposure->{proj_cell}); 849 } 850 851 $diffs = $mdcParser->parse_list(join "", @$stdout_buf) or 852 &my_die("Unable to parse metadata from difftool -definewarp(warp|stack)", $lap_id, ""); 853 854 $diff = ${ $diffs }[0]; 855 $diff_id = $diff->{diff_id}; 856 } 857 unless (defined($diff_id)) { 858 $exposure->{data_state} = 'drop'; 859 &update_this_exposure($exposure); 860 } 861 } 769 862 } 770 863 } … … 872 965 873 966 my $command = "$laptool -updateexp -lap_id $lap_id -exp_id $exp_id "; 967 $command .= " -dbname $dbname " if defined $dbname; 874 968 if (($exposure->{chip_id})&&(S64_IS_NOT_NULL($exposure->{chip_id}))) { 875 969 $command .= " -set_chip_id $exposure->{chip_id} "; -
branches/eam_branches/ipp-20110505/ippScripts/scripts/receive_file.pl
r30674 r31587 224 224 $stage = 'sky'; 225 225 # XXX: This should be skycell, but the distribution code uses exposure 226 $comp_name = ' exposure';227 $current_component = $comp_name;226 $comp_name = 'skycell_id'; 227 # $current_component = $comp_name; 228 228 } else { 229 229 &my_die( "unexpected run type line found in $filename: $runType\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); … … 237 237 $new_workdir_value = "$workdir/$destdir"; 238 238 } 239 240 if ($stage eq 'sky') { 241 # the dbinfo file for a skyRun only has one component and it doesn't contain 242 # skycell_id which is the way components are listed in the dirinfo file. 243 my @ids = keys %$components; 244 &my_die( "unexpected number of components scalar @ids found in staticsky dirinfo file\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) if scalar @ids != 1; 245 $current_component = $ids[0]; 246 } 247 239 248 my $component_dir; 240 249 if ($current_component) { -
branches/eam_branches/ipp-20110505/ippScripts/scripts/warp_skycell.pl
r30825 r31587 72 72 73 73 my ($logDest, $traceDest); 74 my $do_stats; 74 75 if ($run_state eq 'new') { 75 76 $logDest = prepare_output("LOG.EXP", $outroot, $skycell_id, 0); 76 77 $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1); 78 $do_stats = 1; 77 79 } elsif ($run_state eq 'update') { 78 80 $logDest = prepare_output("LOG.EXP.UPDATE", $outroot, $skycell_id, 1); … … 162 164 my $outputBin1 = prepare_output ("PSWARP.BIN1", $outroot, $skycell_id, 1); 163 165 my $outputBin2 = prepare_output ("PSWARP.BIN2", $outroot, $skycell_id, 1); 164 my $outputStats = prepare_output ("SKYCELL.STATS", $outroot, $skycell_id, 1); 166 my $outputStats; 167 if ($do_stats) { 168 $outputStats = prepare_output ("SKYCELL.STATS", $outroot, $skycell_id, 1) if $do_stats; 169 } 165 170 my $configuration; 166 171 … … 257 262 # Run pswarp 258 263 my $cmdflags; 259 my $do_stats;260 264 unless ($no_op) { 261 265 my $command = "$pswarp"; … … 279 283 if ($run_state eq 'new') { 280 284 $command .= " -dumpconfig $configuration"; 281 $do_stats = 1;282 285 } else { 283 286 $command .= " -ipprc $configuration";
Note:
See TracChangeset
for help on using the changeset viewer.
