Index: trunk/ippScripts/scripts/background_chip.pl
===================================================================
--- trunk/ippScripts/scripts/background_chip.pl	(revision 35150)
+++ trunk/ippScripts/scripts/background_chip.pl	(revision 35154)
@@ -43,5 +43,5 @@
 # Parse the command-line arguments
 my ( $chip_bg_id, $class_id, $camera, $outroot, $dbname, $reduction, $verbose,
-     $threads, $no_update, $save_temps, $no_op, $redirect, $chip_path_base, $magicked );
+     $threads, $no_update, $save_temps, $no_op, $redirect, $chip_path_base, $cam_path_base, $magicked );
 GetOptions(
     'chip_bg_id=s'      => \$chip_bg_id,    # chipBackgroundRun identifier
@@ -53,4 +53,5 @@
     'threads=s'         => \$threads,   # Number of threads to use
     'chip_path_base=s'  => \$chip_path_base, # optional chip_path_base
+    'cam_path_base=s'   => \$cam_path_base, # optional camera stage path_base
     'magicked=s'        => \$magicked,  # magicked status of input
     'verbose'           => \$verbose,   # Print to stdout
@@ -94,4 +95,6 @@
 my $dump_config;
 if ($chip_path_base and $no_update) {
+    # XXX: this path through the code has not been excercized in awhile and probably does not work
+
     # we are running outside of a chip_bg_run (perhaps by the postage stamp server) don't dump config
     # or do stats. Get path to input from command line.
@@ -119,9 +122,15 @@
     my $input = $$inputs[0];    # Input of interest
     $in_path = $input->{path_base};
+    $cam_path_base = $input->{cam_path_base};
     $magicked = $input->{magicked};
 }
 
 my $in_image = $ipprc->filename("PPIMAGE.CHIP", $in_path, $class_id);
-my $in_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $in_path, $class_id);
+my $in_mask;
+if ($cam_path_base) {
+    $in_mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id);
+} else {
+    $in_mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $in_path, $class_id);
+}
 my $in_wt = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $in_path, $class_id);
 my $in_bg = $ipprc->filename("PSPHOT.BACKMDL", $in_path, $class_id);
@@ -177,4 +186,6 @@
 
 my $apply_auxiliary_mask = 1;
+# XXX Temporary lookup of auxiliary mask file from static location.
+# At some point I'll convert this to register the masks in the database and use detselect
 if ($apply_auxiliary_mask) {
     my @auxmask_start_date = qw(
@@ -238,5 +249,4 @@
     print "Auxililary mask file is $auxmask\n";
 }
-    
 
 
@@ -272,5 +282,6 @@
     &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);
 
-    my $command = "$ppStatsFromMetadata $out_stats - BACKGROUND_CHIP";
+    my $resolved_stats = $ipprc->file_resolve($out_stats);
+    my $command = "$ppStatsFromMetadata $resolved_stats - BACKGROUND_CHIP";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
Index: trunk/ippScripts/scripts/background_warp.pl
===================================================================
--- trunk/ippScripts/scripts/background_warp.pl	(revision 35150)
+++ trunk/ippScripts/scripts/background_warp.pl	(revision 35154)
@@ -39,10 +39,9 @@
 
 my ($warp_bg_id, $skycell_id, $tess_dir, $reduction, $camera, $dbname, $outroot, $threads, $verbose, $no_update, $no_op, $redirect, $save_temps);
-my ($astrometry, $imageName, $maskName, $weightName, $magicked, $exp_tag, $alternate_astrometry_label);
+my ($astrometry, $imageName, $maskName, $weightName, $magicked);
 GetOptions(
     'warp_bg_id|i=s'      => \$warp_bg_id, # Warp identifier
     'skycell_id|s=s'      => \$skycell_id, # Skycell identifier
     'tess_dir|s=s'        => \$tess_dir, # Tesselation identifier
-    'exp_tag|=s'          => \$exp_tag, # exposure tag
     'camera|c=s'          => \$camera, # Camera name
     'dbname|d=s'          => \$dbname, # Database name
@@ -52,5 +51,4 @@
     'mask-list=s'         => \$maskName, # list of input mask files
     'astrometry=s'        => \$astrometry,
-    'alt_cam_label=s'     => \$alternate_astrometry_label,  # camRun.label for alternate astrometry
     'magicked=s'          => \$magicked,
     'threads=s'           => \$threads,   # Number of threads to use for pswarp
@@ -86,9 +84,4 @@
 }
 
-if ($alternate_astrometry_label) {
-    my_die( "--exp_tag is required when using alternate astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR )
-        unless defined $exp_tag;
-}
-
 my $ipprc = PS::IPP::Config->new( $camera ) or 
 my_die( "Unable to set up", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
@@ -128,20 +121,4 @@
 if (!defined $imageName) {
     # go find our inputs
-    my $astrom_path_base;
-    if (defined $alternate_astrometry_label) {
-        my $command = "$camtool -processedexp -exp_tag $exp_tag -label $alternate_astrometry_label";
-        $command .= " -dbname $dbname" if $dbname;
-        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-            run(command => $command, verbose => $verbose);
-        unless ($success) {
-            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-            &my_die("Unable to perform camtool -processedexp: $error_code", $warp_bg_id, $error_code);
-        }
-        my $entries = $mdcParser->parse_list(join "", @$stdout_buf) or
-            &my_die("Unable to parse metadata config doc", $warp_bg_id, $PS_EXIT_PROG_ERROR);
-        my $entry = $entries->[0];
-        $astrom_path_base = $entry->{path_base};
-    }
-
     my ($imageFile, $maskFile, $weightFile);
     ($imageFile, $imageName) = tempfile( "$tempOutRoot.image.list.XXXX",  UNLINK => !$save_temps);
@@ -176,13 +153,8 @@
         $magicked = $file->{magicked};
 
-        if (!$astrom_path_base) {
-            my $cam_path = $file->{cam_path_base};
-            my $astrom = $ipprc->filename($astromSource, $cam_path);
-            &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;
-            $astrometry = $astrom;
-        } elsif (!$astrometry) {
-            # using alternate astrometry
-            $astrometry = $ipprc->filename($astromSource, $astrom_path_base);
-        }
+        my $cam_path = $file->{cam_path_base};
+        my $astrom = $ipprc->filename($astromSource, $cam_path);
+        &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;
+        $astrometry = $astrom;
     }
     close $imageFile;
