Changeset 35549
- Timestamp:
- May 9, 2013, 11:30:13 AM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130419/PS-IPP-PStamp/lib/PS/IPP/PStamp
- Files:
-
- 2 edited
-
Job.pm (modified) (31 diffs)
-
RequestFile.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130419/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r35398 r35549 51 51 52 52 my $default_data_groups = ""; 53 54 # old locate_images() function. Still used by dqueryparse 55 # Postage stamp server now uses locate_images_for_row() 53 56 54 57 sub locate_images { … … 172 175 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $stage, $id, $tess_id, $component, 173 176 $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 177 0, 0, # fwhm cuts are not applied here 174 178 undef, undef, undef, $verbose); 175 179 … … 217 221 if (!iszero($mjd_min)) { 218 222 $dateobs_begin = mjd_to_dateobs($mjd_min); 223 if (!$dateobs_begin) { 224 $row->{error_code} = $PSTAMP_INVALID_REQUEST; 225 print STDERR "Invalid MJD_MIN: $mjd_min\n"; 226 return undef; 227 } 219 228 } 220 229 if (!iszero($mjd_max)) { 221 230 $dateobs_end = mjd_to_dateobs($mjd_max); 231 if (!$dateobs_begin) { 232 $row->{error_code} = $PSTAMP_INVALID_REQUEST; 233 print STDERR "Invalid MJD_MAX: $mjd_max\n"; 234 return undef; 235 } 222 236 } 223 237 if (isnull($tess_id)) { … … 250 264 } 251 265 252 my ($release_name, $survey) = get_release_info($row); 266 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 267 if (!$tess_id and $default_tess_id) { 268 $tess_id = $default_tess_id; 269 } 253 270 254 271 if ($req_type eq "bydiff") { … … 304 321 my $results = lookup($ipprc, $rowList, $imagedb, $req_type, $stage, $id, $tess_id, $component, 305 322 0, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 323 getValOrZero($row->{FWHM_MIN}), getValOrZero($row->{FWHM_MAX}), 306 324 undef, $release_name, $survey, 307 325 $verbose); … … 330 348 my $mjd_min = shift; 331 349 my $mjd_max = shift; 350 my $fwhm_min = shift; 351 my $fwhm_max = shift; 332 352 my $selectedAstrom = shift; 333 353 my $release_name = shift; … … 365 385 my $release_args; 366 386 if (($req_type eq 'byexp' and $stage ne 'raw') or ($req_type eq 'byskycell' and $stage ne 'diff')) { 367 unless (isnull($release_name) and isnull($survey)) {387 if ($release_name or $survey) { 368 388 $use_releasetool = 1; 369 $release_args = " -release_name $release_name" if $release_name; 389 if ($release_name) { 390 $release_args = " -release_name $release_name"; 391 } else { 392 $release_args = " -priority_order"; 393 } 370 394 $release_args .= " -surveyName $survey" if $survey; 371 395 } … … 402 426 # choose the chips containing the center pixel by calling selectComponets() below 403 427 if ($use_releasetool) { 404 $command = "$releasetool -dbname $imagedb - priority_order -listrelexp $release_args";428 $command = "$releasetool -dbname $imagedb -listrelexp $release_args"; 405 429 $choose_components = 1; 406 430 } else { … … 433 457 } elsif ($stage eq 'warp') { 434 458 if ($use_releasetool) { 435 $command = "$releasetool -dbname $imagedb -priority_order -listrelexp $release_args"; 459 $command = "$releasetool -dbname $imagedb -listrelexp $release_args"; 460 $skycell_id = $component; 436 461 $choose_components = 1; 437 462 } else { … … 444 469 } 445 470 } else { 446 $command = " -listrun";471 $command .= " -listrun"; 447 472 $choose_components = 1; 448 473 } … … 456 481 $base_name = "path_base"; # name of the field for the warptool output 457 482 } elsif ($stage eq "diff") { 458 # XXX: is this path ever used for diff images anymore? 483 459 484 if ($component or $use_imfile_id or !$skycenter) { 460 485 $command = "$difftool -diffskyfile -pstamp_order -dbname $imagedb"; … … 475 500 $psf_name = "PSPHOT.PSF.SKY.SAVE"; 476 501 $base_name = "path_base"; 502 my $diff_mode = getDiffMode($row->{RUN_TYPE}); 503 $command .= " -diff_mode $diff_mode" if $diff_mode; 477 504 } elsif ($stage eq "stack") { 478 505 $skycell_id = $component; … … 480 507 $command = "$releasetool -listrelstack -dbname $imagedb $release_args"; 481 508 $base_name = 'stack_path_base'; 509 my $stack_type = $row->{RUN_TYPE}; 510 if (!isnull($stack_type)) { 511 if (lc($stack_type) eq 'notnightly') { 512 $command .= " -stack_type deep -stack_type reference"; 513 } else { 514 $command .= " -stack_type $stack_type"; 515 } 516 } 482 517 } else { 483 518 $command = "$stacktool -sumskyfile -dbname $imagedb"; … … 539 574 $command .= " -dateobs_end $dateobs_end" if $dateobs_end; 540 575 } elsif ($req_type ne "byid") { 541 $command .= " -mjd_ obs_begin $mjd_min" if $mjd_min;542 $command .= " -mjd_ obs_end$mjd_max" if $mjd_max;576 $command .= " -mjd_min $mjd_min" if $mjd_min; 577 $command .= " -mjd_max $mjd_max" if $mjd_max; 543 578 } 544 579 … … 552 587 } 553 588 589 if ($use_releasetool) { 590 # fwhm arguments are currently only supported when using releasetool for lookups 591 $command .= " -fwhm_min $fwhm_min" if $fwhm_min; 592 $command .= " -fwhm_max $fwhm_max" if $fwhm_max; 593 } 594 554 595 my $images = runToolAndParse($command, $verbose); 555 596 … … 568 609 # match the coords in the rows to the components in the runs 569 610 # returns an actual list of images 570 if ($skycenter ) {611 if ($skycenter and $req_type ne 'byskycell') { 571 612 $images = selectComponents($ipprc, $imagedb, $req_type, $stage, $rowList, $images, $verbose); 572 613 } else { … … 644 685 $out->{data_state} = $out->{state} = $out->{stack_state}; 645 686 } else { 687 # XXX: Consider looking up skycal results even if we are 688 # not using releasetool 646 689 $out->{data_state} = $out->{state}; 647 690 } … … 655 698 if ($selectedAstrom) { 656 699 $out->{astrom} = $selectedAstrom; 657 $out->{cam_path_base} = basename($selectedAstrom); 700 $out->{cam_path_base} = $selectedAstrom; 701 if ($selectedAstrom =~ /\.smf$/) { 702 $out->{cam_path_base} =~ s/\.smf$//; 703 } elsif ($selectedAstrom =~ /\.cmf$/) { 704 $out->{cam_path_base} =~ s/\.cmf$//; 705 } else { 706 die ("ERROR: don't know how to extract cam_path_base from $selectedAstrom\n"); 707 } 658 708 } elsif (! defined $out->{astrom}) { 659 709 if (! find_astrometry($ipprc, $imagedb, $out, $verbose)) { … … 697 747 698 748 my $command = "$difftool -dbname $imagedb -pstamp_order"; 699 749 700 750 my $choose_components = 0; 701 751 if ($byid) { … … 713 763 } 714 764 765 my $diff_mode = getDiffMode($rowList->[0]->{RUN_TYPE}); 766 $command .= " -diff_mode $diff_mode" if $diff_mode; 767 715 768 my $output = runToolAndParse($command, $verbose); 716 769 … … 742 795 } 743 796 797 # XXX: The logic below is somewhat messed up. See XXX: ... below 798 # 744 799 # The standard way to do a diff is warp - stack 745 800 # so we interpret the requested image in that way … … 756 811 } 757 812 my $stack_id; 813 if ($image->{diff_mode} == 2) { 814 # XXX: .. stack_id wasn't getting set 815 $stack_id = $stack2; 816 $image->{stack_id} = $stack_id; 817 } 758 818 if ($stack1 and $stack2) { 759 819 # we have a stack - stack diff (well it might be stack - warp....) … … 850 910 my $ra = shift; 851 911 my $dec = shift; 852 my $dateobs_begin = shift; 912 my $dateobs_begin = shift; # these are used for single frame lookups 853 913 my $dateobs_end = shift; 854 914 my $filter = shift; 855 915 my $data_group = shift; 856 916 my $option_mask = shift; 857 my $mjd_min = shift; 858 my $mjd_max = shift; 859 my $astrom = shift; 917 my $mjd_min = shift; # these are used for stack lookups 918 my $mjd_max = shift; # these are used for stack lookups 860 919 my $verbose = shift; 861 920 862 my ($release_name, $survey) = get_release_info($row); 921 my $fwhm_min = getValOrZero($row->{FWHM_MIN}); 922 my $fwhm_max = getValOrZero($row->{FWHM_MAX}); 923 924 925 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 926 if (!$tess_id and $default_tess_id) { 927 $tess_id = $default_tess_id; 928 } 863 929 864 930 my $rowList = [$row]; … … 868 934 869 935 my $chips = lookup_by_cam_id_and_coords($ipprc, $imagedb, $stage, 870 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose, $release_name, $survey, $row->{FWHM_MIN}, $row->{FWHM_MAX}); 936 $ra, $dec, $need_magic, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose, 937 $release_name, $survey, $fwhm_min, $fwhm_max); 871 938 872 939 if (!$chips or scalar @$chips == 0) { … … 878 945 $tess_id, $chip->{component}, $need_magic, 879 946 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 947 $fwhm_min, $fwhm_max, 880 948 $chip->{astrom}, undef, undef, 881 949 $verbose); … … 896 964 setErrorCodes($rowList, $PSTAMP_NO_IMAGE_MATCH); 897 965 } else { 966 # XXX: We are not applying the fwhm cuts 898 967 foreach my $skycell (@$skycells) { 899 968 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $stage, undef, 900 969 $skycell->{tess_id}, $skycell->{component}, $need_magic, 901 970 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 971 $fwhm_min, $fwhm_max, 902 972 undef, $release_name, $survey, 903 973 $verbose); … … 939 1009 if ($release_name or $survey) { 940 1010 $command = "$releasetool -dbname $imagedb -listrelexp"; 941 if ( !isnull($survey)) {942 $command .= " -survey _name $survey";943 } 944 if ( !isnull($release_name)) {1011 if ($survey) { 1012 $command .= " -surveyName $survey"; 1013 } 1014 if ($release_name) { 945 1015 $command .= " -release_name $release_name"; 946 1016 } else { … … 1268 1338 my $mjd = shift; 1269 1339 1340 if ($mjd < 54000) { 1341 print STDERR "MJD value too small minimum is 54000\n"; 1342 return undef; 1343 } 1344 1270 1345 my $ticks = ($mjd - 40587.0) * 86400; 1271 1346 … … 1292 1367 my $val = shift; 1293 1368 return (!defined($val) or ($val == 0)); 1369 } 1370 1371 sub getValOrZero { 1372 my $val = shift; 1373 return iszero($val) ? 0.0 : $val; 1294 1374 } 1295 1375 … … 1525 1605 } 1526 1606 1527 if (($req_type eq "byid") or ($req_type eq "byexp")) { 1607 # XXX: Why did I make this restriction? I added byskycell 1608 if (($req_type eq "byid") or ($req_type eq "byexp") or ($req_type eq 'byskycell')) { 1528 1609 my ($last_tess_id, $tess_dir_abs, $astrom_file) = ("", "", ""); 1529 1610 foreach my $run (@$runList) { … … 1757 1838 $release_name = ""; 1758 1839 # no release check for survey 1759 $survey = $row->{SURVEY_NAME};1840 $survey = isnull($row->{SURVEY_NAME}) ? "" : $row->{SURVEY_NAME}; 1760 1841 } else { 1842 # if release is given leave survey empty 1761 1843 $survey = ""; 1762 1844 } 1763 1845 1764 return ($release_name, $survey); 1765 } 1846 my $tess_id; 1847 if ($release_name) { 1848 # hack to optimize bycoord and byskycell lookups for well known releases 1849 # XXX: todo query database and return a list for the survey or release 1850 if ($release_name eq '3PI.PV1') { 1851 $tess_id = 'RINGS.V3'; 1852 } 1853 } 1854 1855 return ($release_name, $survey, $tess_id); 1856 } 1857 1858 sub getDiffMode { 1859 my $run_type = shift; 1860 my $diff_mode; 1861 if (!isnull($run_type)) { 1862 $run_type = lc($run_type); 1863 if ($run_type eq 'warp_warp') { 1864 $diff_mode = 1; 1865 } elsif ($run_type eq 'warp_stack') { 1866 $diff_mode = 2; 1867 } elsif ($run_type eq 'stack_stack') { 1868 $diff_mode = 4; 1869 } else { 1870 print STDERR "Ingnoring unrecognized diff RUN_TYPE : $run_type\n"; 1871 } 1872 } 1873 return $diff_mode; 1874 } 1875 1766 1876 1767 1877 sub my_die -
branches/eam_branches/ipp-20130419/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r35384 r35549 44 44 $PSTAMP_DUP_REQUEST 45 45 $PSTAMP_INVALID_REQUEST 46 $PSTAMP_UNKNOWN_PROJECT 46 47 $PSTAMP_UNKNOWN_PRODUCT 47 48 $PSTAMP_NO_IMAGE_MATCH … … 52 53 $PSTAMP_NO_OVERLAP 53 54 $PSTAMP_NOT_AUTHORIZED 54 $PSTAMP_UNKNOWN_PROJECT55 55 ); 56 56 our %EXPORT_TAGS = (standard => [@EXPORT_OK]); … … 81 81 our $PSTAMP_USE_IMFILE_ID = 16384; 82 82 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 83 84 # these bits will be repurposed 83 85 our $PSTAMP_REQUEST_UNCENSORED = 0x10000; 84 86 our $PSTAMP_REQUIRE_UNCENSORED = 0x20000; … … 94 96 our $PSTAMP_DUP_REQUEST = 20; 95 97 our $PSTAMP_INVALID_REQUEST = 21; 96 our $PSTAMP_UNKNOWN_PRODUCT = 22; 98 our $PSTAMP_UNKNOWN_PROJECT = 22; 99 our $PSTAMP_UNKNOWN_PRODUCT = 22; #this error code was mis-named it is left for compatabiliyt 97 100 our $PSTAMP_NO_IMAGE_MATCH = 23; 98 101 our $PSTAMP_NOT_DESTREAKED = 24; 99 102 our $PSTAMP_NOT_AVAILABLE = 25; 100 our $PSTAMP_GONE = 26; 103 our $PSTAMP_GONE = 26; # this value is used in ippTools 101 104 our $PSTAMP_NO_JOBS_QUEUED = 27; 102 105 our $PSTAMP_NO_OVERLAP = 28; 103 106 our $PSTAMP_NOT_AUTHORIZED = 29; 104 our $PSTAMP_UNKNOWN_PROJECT = 22;105 107 106 108 … … 133 135 PSTAMP_DUP_REQUEST 134 136 PSTAMP_INVALID_REQUEST 135 PSTAMP_UNKNOWN_PRO DUCT137 PSTAMP_UNKNOWN_PROJECT 136 138 PSTAMP_NO_IMAGE_MATCH 137 139 PSTAMP_NOT_DESTREAKED … … 140 142 PSTAMP_NO_JOBS_QUEUED 141 143 PSTAMP_NO_OVERLAP 144 PSTAMP_NOT_AUTHORIZED 142 145 PSTAMP_NOT_AUTHORIZED 143 146 );
Note:
See TracChangeset
for help on using the changeset viewer.
