Index: /trunk/pstamp/scripts/pstamp_job_run.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_job_run.pl	(revision 27897)
+++ /trunk/pstamp/scripts/pstamp_job_run.pl	(revision 27898)
@@ -84,12 +84,19 @@
 my $jobStatus;
 if ($jobType eq "stamp") {
-    my $argslist = "$outputBase.args";
-    open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR);
-    my $argString = <ARGSLIST>;
-    close ARGSLIST;
-    chomp $argString;
+    my $params = read_params_file($outputBase);
+
+    my $argString;
+    $argString = $params->{job_args};
+
+    $argString .= " -file $params->{image}";
+    if ($options & $PSTAMP_SELECT_MASK) {
+        $argString .= " -mask $params->{mask}";
+    }
+    if ($options & $PSTAMP_SELECT_VARIANCE) {
+        $argString .= " -variance $params->{weight}";
+    }
 
     # XXX: should we do any other sanity checking?
-    my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;
+    my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;
 
     my $command = "$ppstamp $outputBase $argString";
@@ -120,7 +127,7 @@
         my %extensions = ( $PSTAMP_SELECT_IMAGE  => "fits", 
                            $PSTAMP_SELECT_MASK   => "mk.fits",
-                           $PSTAMP_SELECT_WEIGHT => "wt.fits");
-
-        my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_WEIGHT);
+                           $PSTAMP_SELECT_VARIANCE => "wt.fits");
+
+        my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE);
 
         foreach my $key (keys (%extensions)) {
@@ -140,5 +147,5 @@
         }
 
-        get_other_outputs($F, $outputBase, $options);
+        get_other_outputs($F, $outputBase, $options, $params);
 
         close $F;
@@ -238,9 +245,12 @@
     my $output_base = shift;
     my $options = shift;
+    my $params = shift;
 
     if ($options & ( $PSTAMP_SELECT_CMF | $PSTAMP_SELECT_PSF | $PSTAMP_SELECT_BACKMDL)) {
-        my $comp = read_params_file($output_base);
-
-        my $stage = $comp->{stage};
+        if (!$params) {
+            $params = read_params_file($output_base);
+        }
+
+        my $stage = $params->{stage};
 
         # raw files don't have any other data products
@@ -251,8 +261,8 @@
         # detected in pstampparse so that the user can be notified with 
         # a message in parse_error.txt ("warp do not have a background model")
-        my $cmf_file = $comp->{cmf} if ($options & $PSTAMP_SELECT_CMF);
-        my $psf_file = $comp->{psf} if ($options & $PSTAMP_SELECT_PSF);
-        my $backmdl_file = $comp->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL);
-        my $pattern_file = $comp->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL);
+        my $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF);
+        my $psf_file = $params->{psf} if ($options & $PSTAMP_SELECT_PSF);
+        my $backmdl_file = $params->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL);
+        my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL);
 
         my $outdir = dirname($output_base);
