Changeset 28031 for branches/czw_branch/20100427/PS-IPP-PStamp
- Timestamp:
- May 19, 2010, 2:11:08 PM (16 years ago)
- Location:
- branches/czw_branch/20100427
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100427
- Property svn:mergeinfo changed
/trunk merged: 28007-28008,28010,28013-28016,28019-28027
- Property svn:mergeinfo changed
-
branches/czw_branch/20100427/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r28017 r28031 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) { … … 774 783 775 784 # build the hash to return 776 my $run = { 785 # XXX: very few of the entries in this hash are currently used. 786 # Used are: id, component 787 # I had plans to use it for the camRun lookup optimization, but the cache solves the 788 # problem 789 my $comp = { 777 790 exp_id => $camRun->{exp_id}, 778 791 exp_name => $camRun->{exp_name}, 779 792 chip_id => $camRun->{chip_id}, 780 793 cam_id => $camRun->{cam_id}, 781 astrom => $astrom_resolved, # XXX: is astrom used?782 794 class_id => $class_id, 783 795 component => $class_id 784 796 }; 785 797 if ($img_type eq "chip") { 786 $ run->{id} = $camRun->{chip_id};787 $ run->{state} = $camRun->{chip_state};788 $ run->{magicked} = $camRun->{chip_magicked};789 } else { 790 $ run->{id} = $camRun->{exp_id};791 $ run->{state} = 'full';792 $ run->{magicked} = $camRun->{raw_magicked};793 } 794 push @$ runs, $run;795 } 796 797 return $ runs;798 $comp->{id} = $camRun->{chip_id}; 799 $comp->{state} = $camRun->{chip_state}; 800 $comp->{magicked} = $camRun->{chip_magicked}; 801 } else { 802 $comp->{id} = $camRun->{exp_id}; 803 $comp->{state} = 'full'; 804 $comp->{magicked} = $camRun->{raw_magicked}; 805 } 806 push @$components, $comp; 807 } 808 809 return $components; 798 810 } 799 811
Note:
See TracChangeset
for help on using the changeset viewer.
