IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 16, 2010, 12:39:45 PM (16 years ago)
Author:
Paul Price
Message:

Make destreaking care about whether we used dynamic masking (so that we need to care about the camera mask or only use the chip mask). This we get from the (current) recipe, which is not ideal, but better than simply looking whether the file exists (it may not be available over NFS or Nebulous). Though I have discussed these fixes with Bill, I have not yet tested the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/magic_destreak_revert.pl

    r27092 r27301  
    3030my $magicdstool   = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1);
    3131my $isdestreaked = can_run('isdestreaked') or (warn "Can't find isdestreaked" and $missing_tools = 1);
     32my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    3233if ($missing_tools) {
    3334    warn("Can't find required tools.");
     
    3637
    3738# Parse the command-line arguments
    38 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base);
     39my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $bothways, $cam_path_base, $cam_reduction);
    3940my ($outroot, $recoveryroot, $replace, $release, $bytes, $md5sum);
    4041my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile);
     
    4849           'path_base=s'    => \$path_base,  # path_base of the input
    4950           'cam_path_base=s'=> \$cam_path_base,  # path_base of the associated camera run
     51           'cam_reduction=s'=> \$cam_reduction,  # reduction class of the associated camera run
    5052           'outroot=s'      => \$outroot,     # "directory" for temporary images (may be nebulous)
    5153           'recoveryroot=s' => \$recoveryroot,# "directory" for saving the images of excised pixels
     
    7880
    7981$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR ) if $logfile;
     82my $recipe_psastro = $ipprc->reduction($cam_reduction, 'PSASTRO'); # Recipe to use
     83&my_die("Unrecognised PSASTRO recipe", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro;
    8084
    8185my $nebulousServer = metadataLookupStr( $ipprc->{_siteConfig}, 'NEB_SERVER' );
     
    112116}
    113117
    114 &my_die("replace not allowed for non-nebulous files", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) 
     118&my_die("replace not allowed for non-nebulous files", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR)
    115119    if ($replace eq "T") and !$nebulousInput;
    116120
     
    156160    $bimage = $backup_path_base . ".fits";
    157161} elsif ($stage eq "chip") {
     162    # Check to see if we're using dynamic masks
     163    my $dynamicMasks;               # Use dynamic masks?
     164    {
     165        # Get the PSASTRO recipe
     166        my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -";
     167        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     168            run(command => $command, verbose => $verbose);
     169        unless ($success) {
     170            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     171            &my_die("Unable to perform ppConfigDump: $error_code", $magic_ds_id, $component,
     172                    $PS_EXIT_CONFIG_ERROR);
     173        }
     174        my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
     175            &my_die("Unable to parse metadata config doc", $magic_ds_id, $component,
     176                    $PS_EXIT_CONFIG_ERROR);
     177
     178        $dynamicMasks = metadataLookupBool($recipeData, 'REFSTAR_MASK');
     179    }
     180
    158181    # we use the mask output from the camera stage for input and replace
    159182    # the output of the chip stage with that mask as well.
    160183    $image  = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id);
    161     $mask   = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id);
    162     $ch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id);
    163184    $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $path_base, $class_id);
     185
     186    if ($dynamicMasks) {
     187        $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id);
     188        $ch_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id);
     189    } else {
     190        $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id);
     191    }
    164192
    165193    $bimage  = $ipprc->filename("PPIMAGE.CHIP", $backup_path_base, $class_id);
     
    261289            &my_die("failed to restore chip mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR);
    262290        }
    263     } 
     291    }
    264292
    265293
Note: See TracChangeset for help on using the changeset viewer.