Index: /trunk/ippScripts/scripts/diffphot.pl
===================================================================
--- /trunk/ippScripts/scripts/diffphot.pl	(revision 28361)
+++ /trunk/ippScripts/scripts/diffphot.pl	(revision 28362)
@@ -125,5 +125,5 @@
     $command .= " -variance $inputVariance";
     $command .= " -psf $inputPSF";
-    $command .= " -stats $outputStats";
+#    $command .= " -stats $outputStats";
     $command .= " -threads $threads" if defined $threads;
     $command .= " -recipe PSPHOT $recipe_psphot";
@@ -140,7 +140,8 @@
         unless ($success) {
             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-            &my_die("Unable to perform ppSub: $error_code", $diff_phot_id, $skycell_id, $error_code);
-        }
-
+            &my_die("Unable to perform psphot: $error_code", $diff_phot_id, $skycell_id, $error_code);
+        }
+
+        if (0) {                # psphot doesn't produce a stats file
         my $outputStatsReal = $ipprc->file_resolve($outputStats);
         &my_die("Couldn't find expected output file: $outputStats", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
@@ -161,4 +162,5 @@
             $quality = $1;
         }
+        }
 
         if (!$quality) {
@@ -171,5 +173,5 @@
 
 # Do reverse photometry
-{
+if ($bothways) {
     my ($tempFile, $tempName) = tempfile( "/tmp/diffphot.$diff_phot_id.$skycell_id.XXXX",
                                           UNLINK => !$save_temps, SUFFIX => '.fits' );
@@ -182,5 +184,5 @@
             unless ($success) {
                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-                &my_die("Unable to perform ppSub: $error_code", $diff_phot_id, $skycell_id, $error_code);
+                &my_die("Unable to perform ppArith: $error_code", $diff_phot_id, $skycell_id, $error_code);
             }
             &my_die("Couldn't find expected output file: $tempName", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($tempName);
@@ -200,5 +202,5 @@
     $command .= " -variance $inputVariance";
     $command .= " -psf $inputPSF";
-    $command .= " -stats $outputStats";
+#    $command .= " -stats $outputStats";
     $command .= " -threads $threads" if defined $threads;
     $command .= " -recipe PSPHOT $recipe_psphot";
@@ -215,7 +217,8 @@
         unless ($success) {
             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-            &my_die("Unable to perform ppSub: $error_code", $diff_phot_id, $skycell_id, $error_code);
-        }
-
+            &my_die("Unable to perform psphot: $error_code", $diff_phot_id, $skycell_id, $error_code);
+        }
+
+        if (0) {                # psphot doesn't produce a stats file
         my $outputStatsReal = $ipprc->file_resolve($outputStats);
         &my_die("Couldn't find expected output file: $outputStats", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
@@ -235,4 +238,5 @@
         if ($cmdflags =~ /-quality (\d+)/) {
             $quality = $1;
+        }
         }
 
