Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 27210)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 27211)
@@ -38,5 +38,5 @@
     my $tess_id  = shift;
     my $component= shift;   # class_id or skycell_id
-    my $inverse  = shift;
+    my $option_mask  = shift;
     my $need_magic = shift;
     my $x        = shift;
@@ -48,5 +48,4 @@
     my $verbose  = shift;
 
-
     # we die in response to bad data in request files
     # The wrapper script is responsible for updating the database
@@ -58,4 +57,5 @@
            ($req_type ne "byskycell");
 
+
     my $dateobs_begin;
     my $dateobs_end;
@@ -77,5 +77,5 @@
 
     if ($req_type eq "bycoord") {
-        my $results = lookup_bycoord($ipprc, $image_db, $img_type, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose);
+        my $results = lookup_bycoord($ipprc, $image_db, $img_type, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose);
         return $results;
     }
@@ -86,10 +86,10 @@
         # in one place
         $req_type = "bydiff";
-        my $results = lookup_diff($ipprc, $image_db, $id, $component, 1, $inverse, $img_type, $verbose);
+        my $results = lookup_diff($ipprc, $image_db, $id, $component, 1, $option_mask, $img_type, $verbose);
         return $results;
     }
 
     if ($req_type eq "bydiff") {
-        my $results = lookup_diff($ipprc, $image_db, $id, $component, 0, $inverse, $img_type, $verbose);
+        my $results = lookup_diff($ipprc, $image_db, $id, $component, 0, $option_mask, $img_type, $verbose);
         if (!$results) {
             return undef;
@@ -139,5 +139,5 @@
 
     my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $tess_id, $component, $need_magic,
-        $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose);
+        $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose);
 
     return $results;
@@ -158,5 +158,9 @@
     my $filter = shift;
     my $data_group = shift;
+    my $option_mask = shift;
     my $verbose  = shift;
+
+    my $inverse = $option_mask & $PSTAMP_SELECT_INVERSE;
+    my $unconvolved = $option_mask & $PSTAMP_SELECT_UNCONV;
 
     my $missing_tools;
@@ -244,7 +248,13 @@
         $component_args = " -skycell_id $skycell_id" if $skycell_id;
 
-        $image_name  = "PPSTACK.OUTPUT";
-        $mask_name   = "PPSTACK.OUTPUT.MASK";
-        $weight_name = "PPSTACK.OUTPUT.VARIANCE";
+        if (!$unconvolved) {
+            $image_name  = "PPSTACK.OUTPUT";
+            $mask_name   = "PPSTACK.OUTPUT.MASK";
+            $weight_name = "PPSTACK.OUTPUT.VARIANCE";
+        } else {
+            $image_name  = "PPSTACK.UNCONV";
+            $mask_name   = "PPSTACK.UNCONV.MASK";
+            $weight_name = "PPSTACK.UNCONV.VARIANCE";
+        }
         # this is wrong but gets the right answer. Need to figure out how to find the
         # rule properly
@@ -351,4 +361,10 @@
         } elsif ($img_type eq "diff") {
             $stage_id = $image->{diff_id};
+            if ($inverse && $image->{bothways}) {
+                $image_name  = "PPSUB.INVERSE";
+                $mask_name   = "PPSUB.INVERSE.MASK";
+                $weight_name = "PPSUB.INVERSE.VARIANCE";
+                $cmf_name    = "PPSUB.INVERSE.SOURCES";
+            }
         } elsif ($img_type eq "stack") {
             $stage_id = $image->{stack_id};
@@ -379,7 +395,9 @@
     my $skycell_id = shift;
     my $byid     = shift;
-    my $inverse  = shift;
+    my $option_mask  = shift;
     my $img_type = shift;
     my $verbose = shift;
+
+    my $inverse = $option_mask & $PSTAMP_SELECT_INVERSE;
 
     my $missing_tools;
@@ -503,4 +521,10 @@
                 $image->{mask}   = $ipprc->filename($filerule_base . ".MASK", $image->{path_base});
                 $image->{weight} = $ipprc->filename($filerule_base . ".VARIANCE", $image->{path_base});
+                $image->{cmf}    = $ipprc->filename($filerule_base . ".SOURCES", $image->{path_base});
+                $image->{psf}    = $ipprc->filename("PSPHOT.PSF.SKY.SAVE", $image->{path_base});
+                $image->{stage_id} = $image->{diff_id};
+                $image->{stage}    = "diff";
+                $image->{image_db} = $image_db;
+                $image->{component} = $image->{skycell_id};
             } else {
                 # XXX this will only happen if the minuend is not a warp. See hack above
@@ -527,4 +551,5 @@
     my $filter     = shift;
     my $data_group = shift;
+    my $option_mask = shift;
     my $verbose    = shift;
 
@@ -549,5 +574,5 @@
             my $these_results = lookup($ipprc, $image_db, "byid", $img_type, $run->{id},
                 $tess_id, $run->{component}, $need_magic, 
-                $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose);
+                $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose);
 
             next if !$these_results;
@@ -565,5 +590,5 @@
             my $these_results = lookup($ipprc, $image_db, "byskycell", $img_type, undef,
                 $skycell->{tess_id}, $skycell->{component}, $need_magic, 
-                $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose);
+                $dateobs_begin, $dateobs_end, $filter, $data_group, $option_mask, $verbose);
 
             next if !$these_results;
Index: trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
===================================================================
--- trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm	(revision 27210)
+++ trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm	(revision 27211)
@@ -21,4 +21,5 @@
                     $PSTAMP_SELECT_IMAGE
                     $PSTAMP_SELECT_MASK
+                    $PSTAMP_SELECT_VARIANCE
                     $PSTAMP_SELECT_WEIGHT
                     $PSTAMP_SELECT_CMF
@@ -26,4 +27,5 @@
                     $PSTAMP_SELECT_BACKMDL
                     $PSTAMP_SELECT_INVERSE
+                    $PSTAMP_SELECT_UNCONV
                     $PSTAMP_WAIT_FOR_UPDATE
                     $PSTAMP_SUCCESS
@@ -50,4 +52,5 @@
 our $PSTAMP_SELECT_IMAGE     = 1;
 our $PSTAMP_SELECT_MASK      = 2;
+our $PSTAMP_SELECT_VARIANCE  = 4;
 our $PSTAMP_SELECT_WEIGHT    = 4;
 our $PSTAMP_SELECT_CMF       = 8;
@@ -55,6 +58,7 @@
 our $PSTAMP_SELECT_BACKMDL   = 32;
 our $PSTAMP_SELECT_INVERSE   = 1024;
+our $PSTAMP_SELECT_UNCONV    = 2048;
 
-our $PSTAMP_WAIT_FOR_UPDATE  = 2048;
+our $PSTAMP_WAIT_FOR_UPDATE  = 32768;
 
 # job and result codes
Index: trunk/pstamp/scripts/pstamp_insert_request.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_insert_request.pl	(revision 27210)
+++ trunk/pstamp/scripts/pstamp_insert_request.pl	(revision 27211)
@@ -95,4 +95,5 @@
     $command .= " -dbname $dbname" if $dbname;
     $command .= " -dbserver $dbserver" if $dbserver;
+    $command .= " -label WEB.UP";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
Index: trunk/pstamp/scripts/pstamp_server_status
===================================================================
--- trunk/pstamp/scripts/pstamp_server_status	(revision 27210)
+++ trunk/pstamp/scripts/pstamp_server_status	(revision 27211)
@@ -88,5 +88,5 @@
         my ($task_state, $task, $nrun, $njobs, $ngood, $nfail, $ntime, $cmd) = split " ", $line;
 #        print "$task $task_state\n";
-        my %this_task = ( name => $task, njobs => $njobs, ngood => $ngood, nfail => $nfail, ntime => $ntime, cmd => $cmd ); 
+        my %this_task = ( name => $task, nrun=> $nrun, njobs => $njobs, ngood => $ngood, nfail => $nfail, ntime => $ntime, cmd => $cmd ); 
 
         # change '.' in task name to '_' so we have a valid hash key
@@ -116,5 +116,5 @@
 
 if ($request_run) {
-    print "$request_run->{ngood} of $request_run->{njobs} Requests parsed successfully.";
+    print "<b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully.&nbsp; $request_run->{nfail} failed to parse.";
     if ($request_fin) {
         print "  $request_fin->{ngood} Requests finished.";
@@ -125,5 +125,5 @@
     print "\n";
     if ($job_run) {
-        print "$job_run->{ngood} of $job_run->{njobs} Jobs run successfully.";
+        print "<b>Job Status:</b> &nbsp;&nbsp; $job_run->{nrun} running. &nbsp; $job_run->{ngood} completed successfully. &nbsp; $job_run->{nfail} failed";
         print "\n";
     } else {
Index: trunk/pstamp/scripts/pstampparse.pl
===================================================================
--- trunk/pstamp/scripts/pstampparse.pl	(revision 27210)
+++ trunk/pstamp/scripts/pstampparse.pl	(revision 27211)
@@ -191,4 +191,10 @@
 
     my $filter  = $row->{REQFILT};
+    if ($filter) {
+        if (length($filter) == 1) {
+            # allow single character filter cuts to work
+            $filter .= '%';
+        }
+    }
     my $mjd_min = $row->{MJD_MIN};
     my $mjd_max = $row->{MJD_MAX};
@@ -198,4 +204,5 @@
         $data_group = $row->{LABEL};
         $data_group = "null" if !defined $data_group;
+        $row->{DATA_GROUP} = $data_group;
     }
         
@@ -206,4 +213,6 @@
     my $inverse = ($option_mask & $PSTAMP_SELECT_INVERSE) ? 1 : 0;
     $row->{inverse} = $inverse;
+    my $unconvolved = ($option_mask & $PSTAMP_SELECT_UNCONV) ? 1 : 0;
+    $row->{unconvolved} = $unconvolved;
 
     my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS);
@@ -228,4 +237,11 @@
     }
 
+    if (($req_type eq "byexp") and ($stage eq "stack")) {
+        print STDERR "byexp not implemented for stack stage. row: $rownum\n" if $verbose;
+        insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED);
+        $num_jobs++;
+        next;
+    }
+
     
     # $mode list_uri is a debugging mode (it may used by the http interface)
@@ -273,5 +289,5 @@
     # request specification. An array reference is returned.
     $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component,
-                $inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
+                $option_mask, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
 
     if (!$imageList or !@$imageList) {
@@ -385,5 +401,10 @@
         }
 
-        my $base = basename($image->{path_base});
+        my $base = basename($image->{image});
+        if (! $base =~ /.fits$/ ) {
+            my_die("unexpected image file name found $image->{image}", $PS_EXIT_PROG_ERROR);
+        }
+        $base =~ s/.fits$//;
+            
         # XXX: TODO use filerule for this. I don't have a camera defined here
         if (($stage eq 'chip') and ($image->{camera} eq 'GPC1')) {
@@ -815,4 +836,5 @@
     return 0 if ($r1->{MJD_MAX}  ne $r2->{MJD_MAX});
     return 0 if ($r1->{inverse}  ne $r2->{inverse});
+    return 0 if ($r1->{unconvolved}  ne $r2->{unconvolved});
 
     if (defined($r1->{COMPONENT})) {
