Index: /trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- /trunk/ippScripts/scripts/diff_skycell.pl	(revision 38069)
+++ /trunk/ippScripts/scripts/diff_skycell.pl	(revision 38070)
@@ -128,4 +128,21 @@
 #     $use_convolved = 1; ## This is a hack to do a test for mops, and should not be committed.
 # }
+
+# Re-implement prescan to decide if this is a warp-stack or warp-warp.  Or stack-stack, but that's what we don't care about now.
+my $diff_type = '';
+
+if ((${ $files }[0]->{warp_id} != 0)&&(${ $files }[1]->{warp_id} != 0)) {
+    $diff_type = "WW";
+}
+elsif ((${ $files }[0]->{stack_id} != 0)&&(${ $files }[1]->{stack_id} != 0)) {
+    $diff_type = "SS";
+}
+elsif (((${ $files }[0]->{stack_id} != 0)&&(${ $files }[1]->{stack_id} != 0))||
+       ((${ $files }[0]->{stack_id} != 0)&&(${ $files }[1]->{stack_id} != 0))) {
+    $diff_type = "WS";
+}
+else {  # Something has gone horribly wrong.
+    $diff_type = "WW"; # just pretend it never happened, and let it fail elsewhere.
+}
 
 # ppSub does (input) - (template) after PSF-match convolution.  
@@ -254,5 +271,19 @@
 &my_die("Couldn't find input: $templateMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateMask);
 &my_die("Couldn't find input: $templateVariance", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateVariance);
-&my_die("Couldn't find input: $templateSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateSources);
+#&my_die("Couldn't find input: $templateSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateSources);
+
+if ($diff_type eq 'WS') {
+    # LANL processed stack images do not have a set of sources transferred back, so we need to choose a different source list.
+    unless($ipprc->file_exists($templateSources)) {
+	if ($ipprc->file_exists($inputSources)) {
+	    $templateSources = $inputSources;
+	    print "CHANGED:templateSources: $templateSources\n";
+	}
+    }
+    &my_die("Couldn't find input: $templateSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateSources);
+}
+else {
+    &my_die("Couldn't find input: $templateSources", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($templateSources);
+}
 &my_die("Couldn't find input: $input", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input);
 &my_die("Couldn't find input: $inputMask", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputMask);
