Changeset 28015
- Timestamp:
- May 18, 2010, 4:16:25 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (7 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r27994 r28015 632 632 if (($img_type eq "raw") or ($img_type eq "chip")) { 633 633 634 my $ runs = lookup_runs_by_cam_id_and_coords($ipprc, $imagedb, $img_type,634 my $chips = lookup_by_cam_id_and_coords($ipprc, $imagedb, $img_type, 635 635 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose); 636 636 637 # lookup is going to filter these we don't need to do it here 638 # $runs = filterRuns($img_type, $need_magic, $runs, $verbose); 639 foreach my $run (@$runs) { 640 next if $component and ($run->{component} ne $component); 641 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $img_type, $run->{id}, 642 $tess_id, $run->{component}, $need_magic, 643 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose); 644 645 next if !$these_results; 646 push @$results, @$these_results; 637 if (!$chips or scalar @$chips == 0) { 638 setErrorCodes($rowList, $PSTAMP_NO_IMAGE_MATCH); 639 } else { 640 foreach my $chip (@$chips) { 641 next if $component and ($chip->{component} ne $component); 642 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $img_type, $chip->{id}, 643 $tess_id, $chip->{component}, $need_magic, 644 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose); 645 646 next if !$these_results; 647 push @$results, @$these_results; 648 } 647 649 } 648 650 649 651 } else { 650 # this should bechecked elsewhere652 # this should have been checked elsewhere 651 653 die "unexpected image type $img_type" if ($img_type ne "warp") 652 654 and ($img_type ne "stack") and ($img_type ne "diff"); … … 654 656 my $skycells = lookup_skycell_by_coords($ipprc, $tess_id, $component, $ra, $dec, $verbose); 655 657 656 foreach my $skycell (@$skycells) { 657 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $img_type, undef, 658 $skycell->{tess_id}, $skycell->{component}, $need_magic, 659 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose); 660 661 next if !$these_results; 662 push @$results, @$these_results; 658 if (!$skycells or scalar @$skycells == 0) { 659 setErrorCodes($rowList, $PSTAMP_NO_IMAGE_MATCH); 660 } else { 661 foreach my $skycell (@$skycells) { 662 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $img_type, undef, 663 $skycell->{tess_id}, $skycell->{component}, $need_magic, 664 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose); 665 666 next if !$these_results; 667 push @$results, @$these_results; 668 } 663 669 } 664 670 } … … 667 673 } 668 674 669 # lookup_ runs_by_cam_id_and_coords670 # given an ra, dec, and optionally other param ters, find camera runs for exposures675 # lookup__by_cam_id_and_coords 676 # given an ra, dec, and optionally other parameters, find camera runs for exposures 671 677 # that are within some distance of the coordinates 672 sub lookup_runs_by_cam_id_and_coords { 678 679 sub lookup_by_cam_id_and_coords { 673 680 my $ipprc = shift; 674 681 my $imagedb = shift; … … 686 693 687 694 { 695 my $search_radius = 1.6; # XXX: this should be camera specific 696 688 697 my $command = "$camtool -dbname $imagedb -processedexp -pstamp_order"; 689 $command .= " -ra $ra -decl $dec -radius 1.6";698 $command .= " -ra $ra -decl $dec -radius $search_radius"; 690 699 $command .= " -dateobs_begin $dateobs_begin" if $dateobs_begin; 691 700 $command .= " -dateobs_end $dateobs_end" if $dateobs_end ; … … 693 702 # NOTE: we are applying the data_group to the camera run. 694 703 # If we're looking for chip stage images there is no guarentee that 695 # chipRun.data_group =camRun.data_group. In practice this is almost704 # chipRun.data_group eq camRun.data_group. In practice this is almost 696 705 # always the case. If this turns out to be a problem we can defer 697 706 # the data_group test to when we look up the chipProcessedImfiles … … 705 714 return undef; 706 715 } 707 my $ runs;716 my $components; 708 717 my $last_exp_id = 0; 709 718 foreach my $camRun (@$camruns) { … … 773 782 774 783 # build the hash to return 775 my $run = { 784 # XXX: very few of the entries in this hash are currently used. 785 # Used are: id, component 786 # I had plans to use it for the camRun lookup optimization, but the cache solves the 787 # problem 788 my $comp = { 776 789 exp_id => $camRun->{exp_id}, 777 790 exp_name => $camRun->{exp_name}, 778 791 chip_id => $camRun->{chip_id}, 779 792 cam_id => $camRun->{cam_id}, 780 astrom => $astrom_resolved, # XXX: is astrom used?781 793 class_id => $class_id, 782 794 component => $class_id 783 795 }; 784 796 if ($img_type eq "chip") { 785 $ run->{id} = $camRun->{chip_id};786 $ run->{state} = $camRun->{chip_state};787 $ run->{magicked} = $camRun->{chip_magicked};788 } else { 789 $ run->{id} = $camRun->{exp_id};790 $ run->{state} = 'full';791 $ run->{magicked} = $camRun->{raw_magicked};792 } 793 push @$ runs, $run;794 } 795 796 return $ runs;797 $comp->{id} = $camRun->{chip_id}; 798 $comp->{state} = $camRun->{chip_state}; 799 $comp->{magicked} = $camRun->{chip_magicked}; 800 } else { 801 $comp->{id} = $camRun->{exp_id}; 802 $comp->{state} = 'full'; 803 $comp->{magicked} = $camRun->{raw_magicked}; 804 } 805 push @$components, $comp; 806 } 807 808 return $components; 797 809 } 798 810 -
trunk/pstamp/scripts/pstampparse.pl
r27993 r28015 528 528 my $data_state = $image->{data_state}; 529 529 $data_state = $run_state if $stage eq 'stack'; 530 if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or 531 ($run_state eq 'drop') or 532 ($run_state eq 'error_cleaned') or ($data_state eq 'error_cleaned') or 533 ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) { 530 if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/)) { 534 531 # image is gone and it's not coming back 535 532 $newState = 'stop'; 536 533 $fault = $PSTAMP_GONE; 534 } elsif (($run_state eq "error_cleaned") or ($data_state eq 'error_cleaned')) { 535 # if cleanup had an error don't get the user's hopes up 536 $newState = 'stop'; 537 $fault = $PSTAMP_NOT_AVAILABLE; 537 538 } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) { 538 539 if ($stage eq 'chip') { 539 540 my $burntool_state = $image->{burntool_state}; 540 if ($burntool_state and (abs($burntool_state) < 14)) { 541 # XXX: get value 13 from ppImage recipe 542 if ($burntool_state and (abs($burntool_state) < 13)) { 541 543 $newState = 'stop'; 542 544 $fault = $PSTAMP_NOT_AVAILABLE; … … 708 710 my $data_state = $image->{data_state}; 709 711 $data_state = $run_state if $stage eq "stack"; 710 if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or 711 ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) { 712 # if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or 713 # ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) { 714 if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/)) { 712 715 # image is gone and it's not coming back 713 716 $newState = 'stop'; 714 717 $fault = $PSTAMP_GONE; 718 } elsif ($run_state eq "error_cleaned") { 719 # if cleanup had an error don't get the user's hopes up 720 $newState = 'stop'; 721 $fault = $PSTAMP_NOT_AVAILABLE; 715 722 } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) { 716 723 # wait for update unless the customer asks us to not to
Note:
See TracChangeset
for help on using the changeset viewer.
