Changeset 25029
- Timestamp:
- Aug 8, 2009, 5:41:19 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/magic_destreak.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/magic_destreak.pl
r25016 r25029 207 207 my ($image, $mask, $ch_mask, $weight, $astrom, $sources); 208 208 209 # if we're destreaking a bothways diff need to combine the 210 # two streaks files 211 my ($allstreaks_fh, $allstreaks_name); 212 209 213 if ($stage eq "raw") { 210 214 $image = $uri; … … 239 243 $weight = $ipprc->filename("PPSUB.OUTPUT.VARIANCE", $path_base); 240 244 $sources = $ipprc->filename("PPSUB.OUTPUT.SOURCES", $path_base); 245 246 if ($inv_streaks) { 247 # create a temporary file containing the contents of the 248 # two streaks files 249 ($allstreaks_fh, $allstreaks_name) = tempfile ("/tmp/all.streaks.XXXX", 250 UNLINK => !$save_temps); 251 252 combine_streaks($allstreaks_fh, $streaks, $inv_streaks); 253 254 # apply the combined streaks to both the forward and inverse diffs 255 $streaks = $allstreaks_name; 256 } 241 257 } 242 258 … … 272 288 $sources = $ipprc->filename("PPSUB.INVERSE.SOURCES", $path_base); 273 289 274 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $ inv_streaks -image $image";290 my $command = "$streaksremove -stage $stage -tmproot $tmproot -streaks $streaks -image $image"; 275 291 276 292 $command .= " -recovery $recoveryroot" if defined $recoveryroot; … … 402 418 } 403 419 420 sub combine_streaks 421 { 422 my $fout = shift; 423 my $fn1 = shift; 424 my $fn2 = shift; 425 426 my ($n1, @streaks1) = read_streaks_file($fn1); 427 my_die("failed to read streaks from $fn1", $magic_ds_id, $component, 428 $PS_EXIT_UNKNOWN_ERROR) if $n1 < 0; 429 430 my ($n2, @streaks2) = read_streaks_file($fn2); 431 my_die("failed to read streaks from $fn2", $magic_ds_id, $component, 432 $PS_EXIT_UNKNOWN_ERROR) if $n2 < 0; 433 434 print $fout $n1 + $n2 . "\n"; 435 436 foreach my $line (@streaks1, @streaks2) { 437 print $fout $line; 438 } 439 440 close $fout 441 or my_die("failed to close combined streaks file", $magic_ds_id, 442 $component, $PS_EXIT_UNKNOWN_ERROR); 443 } 444 445 sub read_streaks_file 446 { 447 my $filename = shift; 448 my $fh; 449 open $fh, "<$filename" or my_die("failed to open $filename", 450 $magic_ds_id, $component, $PS_EXIT_UNKNOWN_ERROR); 451 452 # first line is the number of streaks 453 my $line = <$fh>; 454 chomp $line; 455 my $nstreaks = $line; 456 457 my @streaks; 458 459 foreach $line (<$fh>) { 460 push @streaks, $line; 461 } 462 463 close $fh; 464 465 return ($nstreaks, @streaks); 466 } 467 404 468 405 469 sub my_die
Note:
See TracChangeset
for help on using the changeset viewer.
