Index: trunk/ippScripts/scripts/diffphot.pl
===================================================================
--- trunk/ippScripts/scripts/diffphot.pl	(revision 28490)
+++ trunk/ippScripts/scripts/diffphot.pl	(revision 28575)
@@ -31,5 +31,4 @@
 my $diffphottool = can_run('diffphottool') or (warn "Can't find diffphottool" and $missing_tools = 1);
 my $psphot = can_run('psphot') or (warn "Can't find psphot" and $missing_tools = 1);
-my $ppArith = can_run('ppArith') or (warn "Can't find ppArith" and $missing_tools = 1);
 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
 if ($missing_tools) {
@@ -177,21 +176,10 @@
 # Do reverse photometry
 if ($bothways) {
-    my ($tempFile, $tempName) = tempfile( "/tmp/diffphot.$diff_phot_id.$skycell_id.XXXX",
-                                          UNLINK => !$save_temps, SUFFIX => '.fits' );
-    {
-        my ($tempRoot) = $tempName =~ /^(.*).fits/;
-        my $command = "$ppArith $tempRoot -file1 $inputImage -op \\* -const2 -1";
-        unless ($no_op) {
-            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-                run(command => $command, verbose => $verbose);
-            unless ($success) {
-                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-                &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);
-        } else {
-            print "Skipping command: $command\n";
-        }
-    }
+    my $inputImage = $ipprc->filename("PPSUB.INVERSE", $inputPath);
+    my $inputMask = $ipprc->filename("PPSUB.INVERSE.MASK", $inputPath);
+    my $inputVariance = $ipprc->filename("PPSUB.INVERSE.VARIANCE", $inputPath);
+    &my_die("Couldn't find input: $inputImage", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputImage);
+    &my_die("Couldn't find input: $inputMask", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputMask);
+    &my_die("Couldn't find input: $inputVariance", $diff_phot_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($inputVariance);
 
     # Get the output filenames
@@ -201,5 +189,5 @@
 
     my $command = "$psphot $outroot.neg";
-    $command .= " -file $tempName";
+    $command .= " -file $inputImage";
     $command .= " -mask $inputMask";
     $command .= " -variance $inputVariance";
