Changeset 28003 for branches/pap/ippScripts/scripts/magic_process.pl
- Timestamp:
- May 18, 2010, 12:49:05 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/magic_process.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/ippScripts/scripts/magic_process.pl
r27634 r28003 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 98 99 } 99 100 100 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or101 $inputs = $mdcParser->parse_list(join "", @$stdout_buf) or 101 102 &my_die("Unable to parse metadata config doc", $magic_id, $node, $PS_EXIT_PROG_ERROR); 102 103 $inputs = parse_md_list($metadata) or104 &my_die("Unable to parse metadata list", $magic_id, $node, $PS_EXIT_PROG_ERROR);105 103 } 106 104 107 105 108 106 my @outputs; 107 my $inverse; # Using inverse diff? 109 108 ### Do the heavy lifting 110 109 { … … 262 261 cat_list_to_list($mfh, $in_path_base, "mask.list"); 263 262 cat_list_to_list($wfh, $in_path_base, "weight.list"); 263 264 if ($innode->{inverse}) { 265 $inverse = 1; 266 } 264 267 } 265 268 close $in_fh; … … 329 332 } 330 333 } 334 331 335 if ($node eq "root") { 332 336 my $streaks_file = "$outroot.streaks"; … … 347 351 &run_verifystreaks($baseroot); 348 352 349 my $command = "$magictool -addmask"; 350 $command .= " -magic_id $magic_id"; 351 $command .= " -uri $streaks_file"; 352 $command .= " -streaks $num_streaks"; 353 $command .= " -dbname $dbname" if defined $dbname; 354 355 # Add the processed file to the database 356 unless ($no_update) { 353 my $exp_id; # Exposure identifier 354 my $cam_path; # Camera stage path_base 355 { 356 my $command = "magictool -exposure -magic_id $magic_id"; 357 $command .= " -inverse" if defined $inverse; 358 $command .= " -dbname $dbname" if defined $dbname; 357 359 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 358 360 run(command => $command, verbose => $verbose); 359 unless ($success) { 360 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 361 # This isn't going to work because our result was already entered. 362 &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code); 363 } 364 } else { 365 print "Skipping command: $command\n"; 361 my $exposures = $mdcParser->parse_list(join "", @$stdout_buf); 362 my $exp = $$exposures[0]; # Exposure of interest (should only be one) 363 364 $exp_id = $exp->{exp_id}; 365 $cam_path = $exp->{path_base}; 366 } 367 368 { 369 my $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path); # Astrometry file 370 my $streaks = "$outroot.streaks"; # Streaks file 371 my $clusters = "$baseroot.verify/${exp_id}_clusterPos.txt"; # Clusters file 372 373 my $command = "ppCoord -astrom $astrom -streaks $streaks"; 374 if ($ipprc->file_exists($clusters)) { 375 $command .= " -clusters $clusters"; 376 } 377 378 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 379 run(command => $command, verbose => $verbose); 380 open my $coords, "> $outroot.coords"; 381 print $coords join("", @$stdout_buf); 382 close $coords; 383 } 384 385 386 { 387 my $command = "$magictool -addmask"; 388 $command .= " -magic_id $magic_id"; 389 $command .= " -uri $streaks_file"; 390 $command .= " -streaks $num_streaks"; 391 $command .= " -dbname $dbname" if defined $dbname; 392 393 # Add the processed file to the database 394 unless ($no_update) { 395 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 396 run(command => $command, verbose => $verbose); 397 unless ($success) { 398 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 399 # This isn't going to work because our result was already entered. 400 &my_die("Unable to perform magictool -addmask: $error_code", $magic_id, $node, $error_code); 401 } 402 } else { 403 print "Skipping command: $command\n"; 404 } 366 405 } 367 406 }
Note:
See TracChangeset
for help on using the changeset viewer.
