IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 12, 2013, 4:24:02 PM (13 years ago)
Author:
bills
Message:

Further changes to background spur in the pipeline.

  1. Add chipBackgroundRun.cam_id
  2. Use camera stage mask instead of chip stage mask
  3. Drop warpBackgroundRun.alt_cam_label use chipBackgroundRun.cam_id to find the astrometry
  4. Fix broken processing of chipBackground stats output
Location:
trunk/ippScripts/scripts
Files:
2 edited

Legend:

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

    r35118 r35154  
    4343# Parse the command-line arguments
    4444my ( $chip_bg_id, $class_id, $camera, $outroot, $dbname, $reduction, $verbose,
    45      $threads, $no_update, $save_temps, $no_op, $redirect, $chip_path_base, $magicked );
     45     $threads, $no_update, $save_temps, $no_op, $redirect, $chip_path_base, $cam_path_base, $magicked );
    4646GetOptions(
    4747    'chip_bg_id=s'      => \$chip_bg_id,    # chipBackgroundRun identifier
     
    5353    'threads=s'         => \$threads,   # Number of threads to use
    5454    'chip_path_base=s'  => \$chip_path_base, # optional chip_path_base
     55    'cam_path_base=s'   => \$cam_path_base, # optional camera stage path_base
    5556    'magicked=s'        => \$magicked,  # magicked status of input
    5657    'verbose'           => \$verbose,   # Print to stdout
     
    9495my $dump_config;
    9596if ($chip_path_base and $no_update) {
     97    # XXX: this path through the code has not been excercized in awhile and probably does not work
     98
    9699    # we are running outside of a chip_bg_run (perhaps by the postage stamp server) don't dump config
    97100    # or do stats. Get path to input from command line.
     
    119122    my $input = $$inputs[0];    # Input of interest
    120123    $in_path = $input->{path_base};
     124    $cam_path_base = $input->{cam_path_base};
    121125    $magicked = $input->{magicked};
    122126}
    123127
    124128my $in_image = $ipprc->filename("PPIMAGE.CHIP", $in_path, $class_id);
    125 my $in_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $in_path, $class_id);
     129my $in_mask;
     130if ($cam_path_base) {
     131    $in_mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id);
     132} else {
     133    $in_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $in_path, $class_id);
     134}
    126135my $in_wt = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $in_path, $class_id);
    127136my $in_bg = $ipprc->filename("PSPHOT.BACKMDL", $in_path, $class_id);
     
    177186
    178187my $apply_auxiliary_mask = 1;
     188# XXX Temporary lookup of auxiliary mask file from static location.
     189# At some point I'll convert this to register the masks in the database and use detselect
    179190if ($apply_auxiliary_mask) {
    180191    my @auxmask_start_date = qw(
     
    238249    print "Auxililary mask file is $auxmask\n";
    239250}
    240    
    241251
    242252
     
    272282    &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_stats);
    273283
    274     my $command = "$ppStatsFromMetadata $out_stats - BACKGROUND_CHIP";
     284    my $resolved_stats = $ipprc->file_resolve($out_stats);
     285    my $command = "$ppStatsFromMetadata $resolved_stats - BACKGROUND_CHIP";
    275286    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    276287        run(command => $command, verbose => $verbose);
  • trunk/ippScripts/scripts/background_warp.pl

    r35134 r35154  
    3939
    4040my ($warp_bg_id, $skycell_id, $tess_dir, $reduction, $camera, $dbname, $outroot, $threads, $verbose, $no_update, $no_op, $redirect, $save_temps);
    41 my ($astrometry, $imageName, $maskName, $weightName, $magicked, $exp_tag, $alternate_astrometry_label);
     41my ($astrometry, $imageName, $maskName, $weightName, $magicked);
    4242GetOptions(
    4343    'warp_bg_id|i=s'      => \$warp_bg_id, # Warp identifier
    4444    'skycell_id|s=s'      => \$skycell_id, # Skycell identifier
    4545    'tess_dir|s=s'        => \$tess_dir, # Tesselation identifier
    46     'exp_tag|=s'          => \$exp_tag, # exposure tag
    4746    'camera|c=s'          => \$camera, # Camera name
    4847    'dbname|d=s'          => \$dbname, # Database name
     
    5251    'mask-list=s'         => \$maskName, # list of input mask files
    5352    'astrometry=s'        => \$astrometry,
    54     'alt_cam_label=s'     => \$alternate_astrometry_label,  # camRun.label for alternate astrometry
    5553    'magicked=s'          => \$magicked,
    5654    'threads=s'           => \$threads,   # Number of threads to use for pswarp
     
    8684}
    8785
    88 if ($alternate_astrometry_label) {
    89     my_die( "--exp_tag is required when using alternate astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR )
    90         unless defined $exp_tag;
    91 }
    92 
    9386my $ipprc = PS::IPP::Config->new( $camera ) or
    9487my_die( "Unable to set up", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     
    128121if (!defined $imageName) {
    129122    # go find our inputs
    130     my $astrom_path_base;
    131     if (defined $alternate_astrometry_label) {
    132         my $command = "$camtool -processedexp -exp_tag $exp_tag -label $alternate_astrometry_label";
    133         $command .= " -dbname $dbname" if $dbname;
    134         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    135             run(command => $command, verbose => $verbose);
    136         unless ($success) {
    137             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    138             &my_die("Unable to perform camtool -processedexp: $error_code", $warp_bg_id, $error_code);
    139         }
    140         my $entries = $mdcParser->parse_list(join "", @$stdout_buf) or
    141             &my_die("Unable to parse metadata config doc", $warp_bg_id, $PS_EXIT_PROG_ERROR);
    142         my $entry = $entries->[0];
    143         $astrom_path_base = $entry->{path_base};
    144     }
    145 
    146123    my ($imageFile, $maskFile, $weightFile);
    147124    ($imageFile, $imageName) = tempfile( "$tempOutRoot.image.list.XXXX",  UNLINK => !$save_temps);
     
    176153        $magicked = $file->{magicked};
    177154
    178         if (!$astrom_path_base) {
    179             my $cam_path = $file->{cam_path_base};
    180             my $astrom = $ipprc->filename($astromSource, $cam_path);
    181             &my_die("Astrometry files don't match: $astrom vs $astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR) if defined $astrometry and $astrom ne $astrometry;
    182             $astrometry = $astrom;
    183         } elsif (!$astrometry) {
    184             # using alternate astrometry
    185             $astrometry = $ipprc->filename($astromSource, $astrom_path_base);
    186         }
     155        my $cam_path = $file->{cam_path_base};
     156        my $astrom = $ipprc->filename($astromSource, $cam_path);
     157        &my_die("Astrometry files don't match: $astrom vs $astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR) if defined $astrometry and $astrom ne $astrometry;
     158        $astrometry = $astrom;
    187159    }
    188160    close $imageFile;
Note: See TracChangeset for help on using the changeset viewer.