Index: branches/pap/ppSub/src/ppSubCamera.c
===================================================================
--- branches/pap/ppSub/src/ppSubCamera.c	(revision 23704)
+++ branches/pap/ppSub/src/ppSubCamera.c	(revision 23711)
@@ -167,5 +167,5 @@
         return false;
     }
-    data->invert = psMetadataLookupBool(NULL, recipe, "INVERSE");
+    data->inverse = psMetadataLookupBool(NULL, recipe, "INVERSE");
     data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY");
 
@@ -192,21 +192,21 @@
     if (data->inverse) {
         // Inverse output image
-        pmFPAfile *outinv = defineOutputFile(config, input, true, "PPSUB.OUTINV", PM_FPA_FILE_IMAGE);
-        pmFPAfile *outinvMask = defineOutputFile(config, outinv, false, "PPSUB.OUTINV.MASK",
-                                                 PM_FPA_FILE_MASK);
-        if (!outinv || !outinvMask) {
+        pmFPAfile *inverse = defineOutputFile(config, input, true, "PPSUB.INV", PM_FPA_FILE_IMAGE);
+        pmFPAfile *invMask = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.MASK",
+                                              PM_FPA_FILE_MASK);
+        if (!inv || !invMask) {
             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
             return false;
         }
-        outinv->save = true;
-        outinvMask->save = true;
+        inverse->save = true;
+        invMask->save = true;
         if (inVar && refVar) {
-            pmFPAfile *outinvVar = defineOutputFile(config, outinv, false, "PPSUB.OUTINV.VARIANCE",
-                                                    PM_FPA_FILE_VARIANCE);
-            if (!outinvVar) {
+            pmFPAfile *invVar = defineOutputFile(config, inverse, false, "PPSUB.INVERSE.VARIANCE",
+                                                 PM_FPA_FILE_VARIANCE);
+            if (!invVar) {
                 psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
                 return false;
             }
-            outinvVar->save = true;
+            invVar->save = true;
         }
     }
@@ -312,4 +312,26 @@
             return false;
         }
+
+        // Deactivate psphot output sources --- we want to define output source files of our own
+        pmFPAfile *psphotOutput = pmFPAfileSelectSingle(config->files, "PSPHOT.OUTPUT", 0);
+        psphotOutput->save = false;
+
+        pmFPAfile *outSources = defineOutputFile(config, output, false, "PPSUB.OUTPUT.SOURCES",
+                                                 PM_FPA_FILE_CMF);
+        if (!outSources) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to set up output source file.");
+            return false;
+        }
+        outSources->save = true;
+
+        if (data->inverse) {
+            pmFPAfile *invSources = defineOutputFile(config, inverse, false, "PPSUB.OUTPUT.SOURCES",
+                                                     PM_FPA_FILE_CMF);
+            if (!invSources) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to set up inverse source file.");
+                return false;
+            }
+        }
+        invSources->save = true;
     }
 
