Changeset 38163
- Timestamp:
- Apr 21, 2015, 10:22:57 AM (11 years ago)
- Location:
- tags/ipp-20141024/PS-IPP-PStamp
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
lib/PS/IPP/PStamp/Job.pm (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20141024/PS-IPP-PStamp
- Property svn:mergeinfo set to
-
tags/ipp-20141024/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r36645 r38163 83 83 ($req_type ne "byskycell"); 84 84 85 if (0) { 85 86 if (!$data_group and !$default_data_groups) { 86 87 $default_data_groups = load_data_groups($verbose); 87 88 } 89 } 88 90 89 91 my $dateobs_begin; … … 211 213 my $mjd_max = $row->{MJD_MAX}; 212 214 my $data_group = $row->{DATA_GROUP}; 215 216 # default_data_groups is a concept far past it's sell by date 217 if (0) { 213 218 if (isnull($data_group) and !$default_data_groups) { 214 219 $default_data_groups = load_data_groups($verbose); 215 220 } 221 } 216 222 217 223 my $rownum = $row->{ROWNUM}; … … 273 279 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 274 280 if (!$tess_id and $default_tess_id) { 275 $tess_id = $default_tess_id; 281 # Don't want to set default tess_id in this context 282 # byid: no the tess_id is defined by the run 283 # byexp warp: This is the one case where it might make sense to use a default to avoid double lookup. 284 # this could be avoided if we did a two level lookup in that case. Find the warpRun first then use the 285 # run's tess id to find the specific skycell(s). 286 # bydiff: no tess_id defined by the diff 287 # byskycell requires tess_id so this does not apply 288 # note: currently get_release_info only sets default_tess_id for byskycell and bycoord requests 289 if (ref($default_tess_id) eq 'ARRAY') { 290 $tess_id = $default_tess_id->[0]; 291 } else { 292 $tess_id = $default_tess_id; 293 } 276 294 } 277 295 … … 393 411 my $release_args; 394 412 if (($req_type eq 'byexp' and $stage ne 'raw') or ($req_type eq 'byskycell' and $stage ne 'diff')) { 395 if ($release_name or $survey) { 413 # we use releasetool for lookups if we get here and have a survey or release specfied and 414 # the survey is not 'bypass' 415 # That is a hook to allow sophisticated users to bypass the release mechanisms. Useful for 416 # MOPS which is interested primarily in nightly data and wants to get their data immediately 417 # without regard to timeleness of the relexp tables. 418 # This also alows us to defer loading release tables for gpc2 419 if ($release_name or ($survey and $survey ne 'bypass')) { 396 420 $use_releasetool = 1; 397 421 if ($release_name) { … … 554 578 # $cmf_name = "PSPHOT.OUTPUT"; # this puts .fpa. in the name 555 579 $psf_name = "PPSTACK.TARGET.PSF"; 580 # XXX TODO should we filter stacks so that only one per skycell/filter combintation is returned for 581 # most requests. Currently unless a release is provided all that match are returned. 582 # Actually maybe that is the right answer. User's simply need to specify a release value 583 # if that is all that they want. 556 584 } else { 585 # this should have been caught before we get here. 557 586 die "Unknown IMG_TYPE supplied: $stage"; 558 587 } … … 590 619 $command .= " -dateobs_end $dateobs_end" if $dateobs_end; 591 620 } elsif ($req_type ne "byid") { 621 # stacks 592 622 $command .= " -mjd_obs_begin $mjd_min" if $mjd_min; 593 623 $command .= " -mjd_obs_end $mjd_max" if $mjd_max; … … 599 629 $command .= " -data_group $data_group"; 600 630 } elsif (!$use_releasetool and $req_type eq 'byskycell') { 601 # XXX: Why am I using default data_groups only for byskycell requests? 631 # Default data_groups are used by bycoord in the camera run lookup and 632 # here for byskycell. 602 633 $command .= $default_data_groups; 603 634 } … … 773 804 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 774 805 if (!$tess_id and $default_tess_id) { 775 $tess_id = $default_tess_id; 806 if (ref($default_tess_id) eq 'ARRAY') { 807 # XXX: handle the case where default_tess_id is an array 808 # For now just take the first entry (RINGS.V3) 809 $tess_id = $default_tess_id->[0]; 810 } else { 811 $tess_id = $default_tess_id; 812 } 776 813 } 777 814 … … 1061 1098 1062 1099 1100 my @tess_ids; 1063 1101 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 1064 if (!$tess_id and $default_tess_id) { 1065 $tess_id = $default_tess_id; 1102 if ($tess_id) { 1103 push @tess_ids, $tess_id; 1104 } elsif ($default_tess_id) { 1105 if (ref($default_tess_id) eq 'ARRAY') { 1106 @tess_ids = @$default_tess_id; 1107 } else { 1108 push @tess_ids, $default_tess_id; 1109 } 1066 1110 } 1067 1111 1068 1112 my $rowList = [$row]; 1069 1113 1070 my $results = ();1114 my $results = []; 1071 1115 if (($stage eq "raw") or ($stage eq "chip")) { 1072 1116 … … 1081 1125 next if $component and ($chip->{component} ne $component); 1082 1126 my $these_results = lookup($ipprc, $rowList, $imagedb, "byid", $stage, $chip->{id}, 1083 $tess_id, $chip->{component}, $need_magic, 1127 # lookup doesn't need tess_id in this context 1128 # $tess_id, 1129 undef, 1130 $chip->{component}, $need_magic, 1084 1131 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 1085 1132 $fwhm_min, $fwhm_max, … … 1097 1144 and ($stage ne "stack") and ($stage ne "diff"); 1098 1145 1099 my $skycells = lookup_skycell_by_coords($ipprc, $tess_id, $component, $ra, $dec, $verbose); 1100 1101 if (!$skycells or scalar @$skycells == 0) { 1146 foreach my $tess_id (@tess_ids) { 1147 my $skycells = lookup_skycell_by_coords($ipprc, $tess_id, $component, $ra, $dec, $verbose); 1148 1149 if ($skycells and scalar @$skycells != 0) { 1150 # XXX: We are not applying the fwhm cuts unless we use releasetool 1151 foreach my $skycell (@$skycells) { 1152 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $stage, undef, 1153 $skycell->{tess_id}, $skycell->{component}, $need_magic, 1154 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, 1155 $fwhm_min, $fwhm_max, 1156 undef, 0, $release_name, $survey, 1157 $verbose); 1158 1159 next if !$these_results; 1160 push @$results, @$these_results; 1161 } 1162 } 1163 } 1164 if (scalar @$results == 0) { 1102 1165 setErrorCodes($rowList, $PSTAMP_NO_IMAGE_MATCH); 1103 } else {1104 # XXX: We are not applying the fwhm cuts unless we use releasetool1105 foreach my $skycell (@$skycells) {1106 my $these_results = lookup($ipprc, $rowList, $imagedb, "byskycell", $stage, undef,1107 $skycell->{tess_id}, $skycell->{component}, $need_magic,1108 $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $mjd_min, $mjd_max,1109 $fwhm_min, $fwhm_max,1110 undef, 0, $release_name, $survey,1111 $verbose);1112 1113 next if !$these_results;1114 push @$results, @$these_results;1115 }1116 1166 } 1117 1167 } … … 1976 2026 } 1977 2027 2028 # get user supplied release paramters and the asssociated default_tess_id. 2029 # If release parameters are not supplied set defaults. 1978 2030 sub get_release_info { 1979 2031 my $row = shift; … … 1985 2037 # no release check for survey 1986 2038 $survey = isnull($row->{SURVEY_NAME}) ? "" : $row->{SURVEY_NAME}; 1987 } else { 1988 # if release is given leave survey empty 1989 $survey = ""; 1990 } 1991 1992 my $tess_id; 1993 if ($release_name) { 1994 # hack to optimize bycoord and byskycell lookups for well known releases 1995 # XXX: todo query database and return a list for the survey or release 1996 if ($release_name eq '3PI.PV1') { 1997 $tess_id = 'RINGS.V3'; 1998 } 1999 } 2000 2001 return ($release_name, $survey, $tess_id); 2039 } 2040 2041 # XXX: From here down this function is currently very PS1 specific and depends on 2042 # conventions being used for release names. 2043 # The comments following the lines marked 'XXX to improve' give suggestions on 2044 # how these hacks can be cleaned up. 2045 2046 my $tess_id = $row->{TESS_ID}; 2047 if (!$release_name and !$survey) { 2048 # no release or survey. If user does not supply 2049 # a data group use a default survey 2050 my $req_type = $row->{REQ_TYPE}; 2051 if ($req_type eq "bycoord" or $req_type eq 'byskycell') { 2052 # USING 3PI for bycoord and byskycell requests 2053 # XXX to improve 2054 # get default survey from project 2055 my $data_group = $row->{DATA_GROUP}; 2056 if (isnull($data_group) and isnull($tess_id)) { 2057 print "No release information supplied for this row. Defaulting to 3PI survey\n"; 2058 $survey = '3PI'; 2059 } 2060 } 2061 } 2062 2063 # if survey was not supplied, guess it from the release_name. This is used below 2064 # to choose the default_tess_id 2065 if (!$survey) { 2066 if ($release_name) { 2067 # XXX: to improve 2068 # get survey from ippRelease(release_name) in database. Would need to cache 2069 # such results 2070 if ($release_name =~ "^3PI") { 2071 $survey = '3PI'; 2072 } elsif ($release_name =~ "^MD") { 2073 $survey = substr($release_name, 0, 4); 2074 } elsif ($release_name =~ "^SSS") { 2075 $survey = 'SSS'; 2076 } elsif ($release_name =~ "^SAS") { 2077 $survey = 'SAS'; 2078 } else { 2079 # we don't know 2080 print "Can't guess survey for $release_name\n"; 2081 } 2082 } elsif (!isnull($tess_id)) { 2083 # finally if it is a MD tessellation use the MD field as the survey 2084 # (This will also work for M31 and STS when that data is released. 2085 if ($tess_id =~ "^MD") { 2086 $survey = substr($tess_id, 0, 4); 2087 } 2088 } 2089 } 2090 2091 # choose default tess_id based on the survey 2092 2093 # Note: Setting a default_tess_id effectively disables lookup bycoord requests 2094 # for previous tessellations unless the user supplies the tess_id (which is 2095 # applied by the caller to this function). 2096 # bills has decided that this is desirable behaviour since most everything has 2097 # been processed on a V3 tess. 2098 my $default_tess_id; 2099 if ($survey) { 2100 # XXX: to improve 2101 # Put default tess_id in survey table. 2102 # note users will need to supply tessellation to get at 3pi skycells 2103 # in the cnp tessellation. Hmm. Maybe we need to be clever and look 2104 # at declination or perhaps allow default_tess_id to be an array. 2105 if ($survey eq '3PI') { 2106 $default_tess_id = ['RINGS.V3', 'CNP.V3']; 2107 } elsif ($survey eq 'SSS' or $survey eq 'SAS') { 2108 $default_tess_id = 'RINGS.V3'; 2109 } elsif ($survey =~ 'MD') { 2110 $default_tess_id = $survey . '.V3'; 2111 } 2112 } 2113 2114 # leave the returned survey blank if release_name was supplied 2115 # XXX: Why? Answer: this is how this function always behaved and I'm not sure if the 2116 # callers depend on that behavior. 2117 $survey = "" if $release_name; 2118 2119 return ($release_name, $survey, $default_tess_id); 2002 2120 } 2003 2121 … … 2007 2125 if (!isnull($run_type)) { 2008 2126 $run_type = lc($run_type); 2127 # XXX: these diff_mode values should be defined somewhere else. 2009 2128 if ($run_type eq 'warp_warp') { 2010 2129 $diff_mode = 1;
Note:
See TracChangeset
for help on using the changeset viewer.
