Index: /trunk/PStamp/lib/PStamp/Job.pm
===================================================================
--- /trunk/PStamp/lib/PStamp/Job.pm	(revision 21413)
+++ /trunk/PStamp/lib/PStamp/Job.pm	(revision 21414)
@@ -56,5 +56,6 @@
             return undef;
         }
-        if ($img_type eq "diff") {
+        if (($img_type eq "warp") or ($img_type eq "diff")) {
+            # lookup_bydiff has done all of the work
             return [$results];
         } elsif (($img_type eq "raw") or ($img_type eq "chip")) {
@@ -63,10 +64,10 @@
             return undef if !$id;
             # fall through and lookup byexp
-        } elsif ($img_type eq "warp") {
-            $req_type = "byid";
-            $id = $results->{warp_id};
-            $component = $results->{skycell_id};
-            return undef if !$id;
-            # fall through and lookup by warp_id 
+#        } elsif ($img_type eq "warp") {
+#            $req_type = "byid";
+#            $id = $results->{warp_id};
+#            $component = $results->{skycell_id};
+#            return undef if !$id;
+#            # fall through and lookup by warp_id 
         } elsif ($img_type eq "stack") {
             $req_type = "byid";
@@ -333,10 +334,14 @@
         my $warp = $warps->[0];
 
-        $image->{exp_id} = $warp->{exp_id};
-        $image->{exp_name} = $warp->{exp_name};
-        $image->{camera} = $warp->{camera};
-    }
-
-    if ($img_type eq "diff") {
+        if ($img_type eq "warp") {
+            $image = $warp;
+        } else {
+            $image->{exp_id} = $warp->{exp_id};
+            $image->{exp_name} = $warp->{exp_name};
+            $image->{camera} = $warp->{camera};
+        }
+    }
+
+    if (($img_type eq "diff") or ($img_type eq "warp")) {
         # the $image is going to be returned directly in this case so we need to duplicate
         # some of processing that lookup does for other img_types
@@ -344,6 +349,11 @@
         if ($image->{camera}) {
             $ipprc->define_camera($image->{camera});
-            $image->{mask}   = $ipprc->filename("PPSUB.OUTPUT.MASK", $image->{path_base});
-            $image->{weight} = $ipprc->filename("PPSUB.OUTPUT.WEIGHT", $image->{path_base});
+            if ($img_type eq "diff") {
+                $image->{mask}   = $ipprc->filename("PPSUB.OUTPUT.MASK", $image->{path_base});
+                $image->{weight} = $ipprc->filename("PPSUB.OUTPUT.WEIGHT", $image->{path_base});
+            } else {
+                $image->{mask}   = $ipprc->filename("PSWARP.OUTPUT.MASK",   $image->{path_base});
+                $image->{weight} = $ipprc->filename("PSWARP.OUTPUT.WEIGHT", $image->{path_base});
+            }
         } else {
             # XXX this will only happen if the minuend is not a warp
