- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/magic_destreak.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ippScripts/scripts/magic_destreak.pl
r26554 r27517 32 32 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 33 33 my $censorObjects = can_run('censorObjects') or (warn "Can't find censorObjects" and $missing_tools = 1); 34 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 34 35 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 35 36 if ($missing_tools) { … … 39 40 40 41 # Parse the command-line arguments 41 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $exp_id, $stage, $stage_id, $component, $uri, $path_base, $cam_path_base );42 my ($magic_ds_id, $camera, $streaks, $inv_streaks, $exp_id, $stage, $stage_id, $component, $uri, $path_base, $cam_path_base, $cam_reduction); 42 43 my ($outroot, $recoveryroot); 43 44 my ($replace, $release); … … 56 57 'path_base=s' => \$path_base, # path_base of the input 57 58 'cam_path_base=s'=> \$cam_path_base, # path_base from camera stage (for chip and raw) 59 'cam_reduction=s'=> \$cam_reduction, # reduction class from camera stage (for chip and raw) 58 60 'outroot=s' => \$outroot, # "directory" for temporary images (may be nebulous) 59 61 'recoveryroot=s' => \$recoveryroot,# "directory" for saving the images of excised pixels … … 85 87 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR ) if $logfile; 86 88 89 $cam_reduction = 'DEFAULT' if !$cam_reduction or ($cam_reduction eq 'NULL'); 90 91 my $recipe_psastro = $ipprc->reduction($cam_reduction, 'PSASTRO'); # Recipe to use 92 &my_die("Unrecognised PSASTRO recipe", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro; 93 87 94 my ($skycell_args, $class_id, $skycell_id); 88 95 … … 97 104 } elsif ($stage ne "camera") { 98 105 &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 99 } 106 } 100 107 $inv_streaks = undef if defined($inv_streaks) and ($inv_streaks eq "NULL"); 101 108 … … 114 121 if ($stage eq 'camera') { 115 122 my $nebulousServer = metadataLookupStr( $ipprc->{_siteConfig}, 'NEB_SERVER' ); 116 &my_die("cannot find NEB_SERVER in site configuration", 117 $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) 123 &my_die("cannot find NEB_SERVER in site configuration", 124 $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) 118 125 if !$ nebulousServer; 119 126 … … 233 240 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id) if $release ; 234 241 } elsif ($stage eq "chip") { 242 243 # Check to see if we're using dynamic masks 244 my $dynamicMasks; # Use dynamic masks? 245 { 246 # Get the PSASTRO recipe 247 my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -"; 248 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 249 run(command => $command, verbose => $verbose); 250 unless ($success) { 251 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 252 &my_die("Unable to perform ppConfigDump: $error_code", $magic_ds_id, $component, 253 $PS_EXIT_CONFIG_ERROR); 254 } 255 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 256 &my_die("Unable to parse metadata config doc", $magic_ds_id, $component, 257 $PS_EXIT_CONFIG_ERROR); 258 259 $dynamicMasks = metadataLookupBool($recipeData, 'REFSTAR_MASK'); 260 } 261 235 262 # we use the mask output from the camera stage for input and replace 236 263 # the output of the chip stage with that mask as well. 237 264 $image = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id); 238 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id);239 $ch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id);240 265 $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $path_base, $class_id); 241 266 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path_base); 242 if (!$ipprc->file_exists($mask)) { 243 carp("camera mask file $mask for $component not found. Continuing using mask from chip stage."); 244 $mask = $ch_mask; 245 $ch_mask = undef; 246 } 267 268 if ($dynamicMasks) { 269 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id); 270 $ch_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); 271 } else { 272 $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); 273 } 274 247 275 # XXX: should we censor the sources as well? For now we're leaving them out of the distribution bundles 248 276 # because they confuse people … … 262 290 263 291 if ($inv_streaks) { 264 # create a temporary file containing the contents of the 292 # create a temporary file containing the contents of the 265 293 # two streaks files 266 294 ($allstreaks_fh, $allstreaks_name) = tempfile ("/tmp/all.streaks.XXXX", … … 357 385 my $quality = $file->{quality}; 358 386 if (!$quality) { 359 my $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $path_base, $class_id); 387 my $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $path_base, $class_id); 360 388 if (! $ipprc->file_exists($mask)) { 361 389 # camera mask doesn't exist for this chip. Fall back to the chip mask … … 379 407 &my_die("Unable to perform censorObjects: $error_code", $magic_ds_id, $component, $error_code); 380 408 } 381 my $output = $ipprc->filename("CENSOR.OUTPUT", $backup_path_base); 409 my $output = $ipprc->filename("CENSOR.OUTPUT", $backup_path_base); 382 410 &my_die("expected output file $output not found ", $magic_ds_id, $component, $PS_EXIT_DATA_ERROR) 383 411 unless $ipprc->file_exists($output); … … 481 509 } 482 510 483 close $fout 511 close $fout 484 512 or my_die("failed to close combined streaks file", $magic_ds_id, 485 513 $component, $PS_EXIT_UNKNOWN_ERROR);
Note:
See TracChangeset
for help on using the changeset viewer.
