- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pstamp/scripts/pstampparse.pl (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/pstamp/scripts/pstampparse.pl
r26289 r27517 151 151 print STDERR @$stderr_buf; 152 152 } 153 my $table = $mdcParser->parse(join "", @$stdout_buf) or 154 my_die("Unable to parse metdata config doc", $PS_EXIT_UNKNOWN_ERROR); 155 156 $rows = parse_md_list($table); 153 if (@$stdout_buf) { 154 my $table = $mdcParser->parse(join "", @$stdout_buf) or 155 my_die("Unable to parse metdata config doc", $PS_EXIT_UNKNOWN_ERROR); 156 $rows = parse_md_list($table); 157 } 158 157 159 } 158 160 … … 191 193 192 194 my $filter = $row->{REQFILT}; 195 if ($filter) { 196 if (length($filter) == 1) { 197 # allow single character filter cuts to work 198 $filter .= '%'; 199 } 200 } 193 201 my $mjd_min = $row->{MJD_MIN}; 194 202 my $mjd_max = $row->{MJD_MAX}; … … 197 205 # backwards compatability hook 198 206 $data_group = $row->{LABEL}; 207 $data_group = "null" if !defined $data_group; 208 $row->{DATA_GROUP} = $data_group; 199 209 } 200 210 … … 202 212 my $y = $row->{CENTER_Y}; 203 213 214 # XXX things don't work if bit zero of option mask is not set; 215 $row->{OPTION_MASK} |= 1; 204 216 my $option_mask= $row->{OPTION_MASK}; 205 217 my $inverse = ($option_mask & $PSTAMP_SELECT_INVERSE) ? 1 : 0; 206 218 $row->{inverse} = $inverse; 219 my $unconvolved = ($option_mask & $PSTAMP_SELECT_UNCONV) ? 1 : 0; 220 $row->{unconvolved} = $unconvolved; 207 221 208 222 my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS); … … 217 231 } 218 232 233 # user requested us to search all components. Set to "" 219 234 $search_component = "" if $search_component eq "all"; 220 235 … … 226 241 } 227 242 243 if (($req_type eq "byexp") and ($stage eq "stack")) { 244 print STDERR "byexp not implemented for stack stage. row: $rownum\n" if $verbose; 245 insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED); 246 $num_jobs++; 247 next; 248 } 249 228 250 229 251 # $mode list_uri is a debugging mode (it may used by the http interface) … … 236 258 237 259 # Temporary hack so that MOPS can get at non-magicked data 238 if ($product and ($product eq "mops-pstamp-results")) {239 $need_magic = 0;240 }260 # if ($product and ($product eq "mops-pstamp-results")) { 261 # $need_magic = 0; 262 # } 241 263 242 264 # For "stamp" and "list_uri" jobs collect rows with the same images of interest in a list so that they … … 267 289 next; 268 290 } 269 if ($stage eq "stack") { 270 print STDERR "lookup bycoord is not yet implemented for stage stack" if $verbose; 271 insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED); 291 } 292 if (($req_type eq "byid") or ($req_type eq "bydiff")) { 293 if (!validID($id)) { 294 print STDERR "ID must be a positive integer for req_type $req_type\n" if $verbose; 295 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 272 296 $num_jobs++; 273 297 next; … … 277 301 # request specification. An array reference is returned. 278 302 $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component, 279 $ inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose);303 $option_mask, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose); 280 304 281 305 if (!$imageList or !@$imageList) { … … 291 315 } 292 316 293 if (($mode eq "queue_job s") and ($num_jobs eq 0)) {317 if (($mode eq "queue_job") and ($num_jobs eq 0)) { 294 318 print STDERR "no jobs created for $req_name\n" if $verbose; 295 insertFakeJobForRow(undef, 0, $PSTAMP_ UNKNOWN_ERROR);319 insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST); 296 320 } 297 321 … … 317 341 my $roi_string; 318 342 319 # note values were insured to be numbers in validROI()343 # note values were checked by the function validROI() 320 344 my $x = $row->{CENTER_X}; 321 345 my $y = $row->{CENTER_Y}; … … 323 347 my $h = $row->{HEIGHT}; 324 348 my $coord_mask = $row->{COORD_MASK}; 325 if ($x && ($x ne "null") && $y && ($y ne "null") && $w && ($w ne "null") && $h && ($h ne "null")) { 326 if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) { 327 $roi_string = "-pixcenter $x $y"; 328 } else { 329 $roi_string = "-skycenter $x $y"; 330 } 331 if ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) { 332 $roi_string .= " -pixrange $w $h"; 333 } else { 334 $roi_string .= " -arcrange $w $h"; 335 } 349 if ($coord_mask & $PSTAMP_CENTER_IN_PIXELS) { 350 $roi_string = "-pixcenter $x $y"; 351 } else { 352 $roi_string = "-skycenter $x $y"; 353 } 354 if ($coord_mask & $PSTAMP_RANGE_IN_PIXELS) { 355 $roi_string .= " -pixrange $w $h"; 356 } else { 357 $roi_string .= " -arcrange $w $h"; 336 358 } 337 359 … … 354 376 if (($stage ne "stack") and ($need_magic and !$image->{magicked})) { 355 377 # XXX: should we add a faulted job so the client can know what happened if no images come back? 356 # Th is testis made in locate_images now so this code never runs. This leads to no feedback357 # to users, but speeds up processing significa tnly378 # The test for destreaked is made in locate_images now so this code never runs. This leads to no feedback 379 # to users, but speeds up processing significantly 358 380 print STDERR "skipping non-magicked image $imagefile\n" if $verbose; 359 381 … … 391 413 } 392 414 393 my $base = basename($image->{path_base}); 415 my $base = basename($image->{image}); 416 if (! $base =~ /.fits$/ ) { 417 my_die("unexpected image file name found $image->{image}", $PS_EXIT_PROG_ERROR); 418 } 419 $base =~ s/.fits$//; 420 394 421 # XXX: TODO use filerule for this. I don't have a camera defined here 395 422 if (($stage eq 'chip') and ($image->{camera} eq 'GPC1')) { … … 724 751 $job_type = $row->{JOB_TYPE}; 725 752 $rownum = $row->{ROWNUM}; 753 $rownum = 0 if !defined $rownum; 754 if ($job_type) { 755 if (($job_type ne "stamp") and ($job_type ne "get_image")) { 756 print STDERR "invalid job type: $job_type found in row $rownum\n"; 757 $job_type = "none"; 758 } 759 } else { 760 print STDERR "undefined job type found in row $rownum\n"; 761 $job_type = "none"; 762 } 726 763 } else { 727 764 $job_type = "none"; … … 799 836 my $r2 = shift; 800 837 838 return 0 if (($r1->{REQ_TYPE} eq "bycoord") or ($r2->{REQ_TYPE} eq "bycoord")); 801 839 return 0 if ($r1->{PROJECT} ne $r2->{PROJECT}); 802 840 return 0 if ($r1->{JOB_TYPE} ne $r2->{JOB_TYPE}); … … 810 848 return 0 if ($r1->{MJD_MAX} ne $r2->{MJD_MAX}); 811 849 return 0 if ($r1->{inverse} ne $r2->{inverse}); 850 return 0 if ($r1->{unconvolved} ne $r2->{unconvolved}); 812 851 813 852 if (defined($r1->{COMPONENT})) { … … 828 867 my $val = shift; 829 868 830 return $val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/; 869 return 0 if !defined $val; 870 871 return ($val =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/); 872 } 873 sub validID 874 { 875 my $val = shift; 876 877 return 0 if !$val; 878 879 return ! ($val =~ /\D/); 831 880 } 832 881
Note:
See TracChangeset
for help on using the changeset viewer.
