- Timestamp:
- Aug 7, 2009, 12:45:24 PM (17 years ago)
- Location:
- branches/eam_branches/20090715
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715
- Property svn:mergeinfo changed
/trunk (added) merged: 24801-24824,24827-24834,24836-24859,24861-24901,24903-24912,24914-24950,24953-24971,24973-24977,24986-24989,24993-25017
- Property svn:mergeinfo changed
-
branches/eam_branches/20090715/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r23292 r25022 24 24 use PS::IPP::Metadata::List qw( parse_md_list ); 25 25 use PS::IPP::Config qw( :standard ); 26 use Carp; 26 27 27 28 ### my @images = locate_images($image_db, $req_type, $img_type, $id, $component, … … 121 122 my $command; 122 123 my $id_opt; # option for the lookup 124 my $image_name; 123 125 my $mask_name; 124 126 my $weight_name; … … 130 132 131 133 # special class_id value "null" means ignore 132 if ($component eq "null") {134 if ($component and ($component eq "null")) { 133 135 $component = undef; 134 136 } … … 146 148 $command .= " -class_id $class_id" if $class_id; 147 149 $id_opt = "-chip_id"; 150 $image_name = "PPIMAGE.CHIP"; 148 151 $mask_name = "PPIMAGE.CHIP.MASK"; 149 152 $weight_name = "PPIMAGE.CHIP.VARIANCE"; … … 156 159 $command .= " -skycell_id $skycell_id" if $skycell_id; 157 160 $id_opt = "-warp_id"; 161 $image_name = "PSWARP.OUTPUT"; 158 162 $mask_name = "PSWARP.OUTPUT.MASK"; 159 163 $weight_name = "PSWARP.OUTPUT.VARIANCE"; … … 164 168 $command .= " -skycell_id $skycell_id" if $skycell_id; 165 169 $id_opt = "-diff_id"; 170 $image_name = "PPSUB.OUTPUT"; 166 171 $mask_name = "PPSUB.OUTPUT.MASK"; 167 172 $weight_name = "PPSUB.OUTPUT.VARIANCE"; … … 171 176 $id_opt = "-stack_id"; 172 177 178 $image_name = "PPSTACK.OUTPUT"; 173 179 $mask_name = "PPSTACK.OUTPUT.MASK"; 174 180 $weight_name = "PPSTACK.OUTPUT.VARIANCE"; … … 210 216 my $base; 211 217 212 next if ($img_type eq "warp" and $image->{ignored}); 218 next if $image->{fault}; 219 next if ($img_type ne "raw") and $image->{quality}; 213 220 214 221 if ($base_name) { … … 224 231 $ipprc->define_camera($camera); 225 232 } 226 my $out = {}; 227 $out->{exp_id} = $image->{exp_id}; 228 $out->{exp_name} = $image->{exp_name}; 233 my $out = $image; 234 235 # if uri is nil this will get overridded below 236 # (this is for raw stage) 229 237 $out->{image} = $image->{uri}; 230 $out->{state} = $image->{state}; # state is undef for rawExp, but that's ok231 238 if ($set_class_id) { 232 239 $class_id = $image->{class_id}; 233 $out->{c lass_id} = $class_id;240 $out->{component} = $class_id; 234 241 } 235 242 236 243 # find the mask and weight images 237 244 if ($base) { 245 $out->{image} = $ipprc->filename($image_name, $base, $class_id) if $image_name; 238 246 $out->{mask} = $ipprc->filename($mask_name, $base, $class_id) if $mask_name; 239 247 $out->{weight} = $ipprc->filename($weight_name, $base, $class_id) if $weight_name; 240 248 } 241 $out->{camera} = $camera;242 243 249 $out->{astrom} = find_astrometry($ipprc, $image_db, $image, $verbose) if $want_astrom; 244 250 … … 432 438 } 433 439 440 # cache of results of ppConfigDump 441 my %astromSources; 442 my $last_exp_id = 0; 443 my $lastAstromFile; 444 434 445 # find the astrometry file for a given exposure 435 446 # return undef if no completed camRun exists … … 440 451 my $verbose = shift; 441 452 453 my $exp_id = $image->{exp_id}; 454 if (($exp_id eq $last_exp_id) and $lastAstromFile) { 455 # running camtool 60 times is really expensive when the answer is the same 456 return $lastAstromFile; 457 } 458 $last_exp_id = 0; 459 $lastAstromFile = undef; 460 442 461 my $missing_tools; 443 462 my $camtool = can_run("camtool") or (warn "Can't find camtool" and $missing_tools = 1); … … 448 467 } 449 468 450 my $command = "$camtool -dbname $image_db -processedexp -exp_id $ image->{exp_id}";469 my $command = "$camtool -dbname $image_db -processedexp -exp_id $exp_id"; 451 470 # run the tool and parse the output 452 471 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 478 497 my $camRoot = $camdata->{path_base}; 479 498 my $camera = $image->{camera}; 480 my $astromSource ;481 {499 my $astromSource = $astromSources{$camera}; 500 if (!$astromSource) { 482 501 my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -"; 483 502 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 490 509 die("Unable to parse metadata config doc"); 491 510 $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE'); 511 $astromSources{$camera} = $astromSource; 492 512 } 493 513 494 514 my $astromFile = $ipprc->filename($astromSource, $camRoot); 515 if ($astromFile) { 516 $lastAstromFile = $astromFile; 517 $last_exp_id = $exp_id; 518 } 495 519 496 520 return $astromFile; … … 538 562 # resolve_project() 539 563 # get project specific information 564 my $last_project = ""; 540 565 sub resolve_project { 541 566 my $ipprc = shift; 542 567 my $project_name = shift; 568 569 if (!$project_name) { 570 carp ("project is not defined"); 571 return undef; 572 } 573 574 if ($project_name eq $last_project) { 575 return $last_project; 576 } 577 543 578 my $dbname = shift; 544 die "project is not defined" if !$project_name;579 my $dbserver = shift; 545 580 546 581 my $verbose = 0; … … 555 590 my $command = "$pstamptool -project -name $project_name"; 556 591 $command .= " -dbname $dbname" if defined $dbname; 592 $command .= " -dbserver $dbserver" if defined $dbserver; 557 593 # run the tool and parse the output 558 594 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 572 608 my $proj_hash = parse_md_fast($mdcParser, $output); 573 609 574 return $proj_hash->[0]; 610 $last_project = $proj_hash->[0]; 611 612 return $last_project; 575 613 } 576 614 1;
Note:
See TracChangeset
for help on using the changeset viewer.
