Index: /trunk/ppSub/src/ppSubArguments.c
===================================================================
--- /trunk/ppSub/src/ppSubArguments.c	(revision 17812)
+++ /trunk/ppSub/src/ppSubArguments.c	(revision 17813)
@@ -174,7 +174,4 @@
     assert(config);
 
-    psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PHOTOMETRY", 0, "Do photometry?",
-                      psArgumentGet(argc, argv, "-psf") ? true : false);
-    pmConfigFileSetsMD(config->arguments, &argc, argv, "PSPHOT.PSF", "-psf", NULL);
     pmConfigFileSetsMD(config->arguments, &argc, argv, "PPSUB.SOURCES", "-sources", NULL);
 
@@ -214,4 +211,5 @@
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-renorm", 0, "Renormalise weights?", false);
     psMetadataAddS32(arguments, PS_LIST_TAIL, "-renorm-width", 0, "Renormalisation width", 0);
+    psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Perform photometry?", false);
 
     if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 4) {
@@ -298,4 +296,9 @@
     }
 
+    if (psMetadataLookupBool(NULL, arguments, "-photometry") ||
+        psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {
+        psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PHOTOMETRY", 0, "Perform photometry?", true);
+    }
+
     // Translate the kernel type
     psString type = psMetadataLookupStr(NULL, arguments, "-type"); // Name of kernel type
Index: /trunk/ppSub/src/ppSubCamera.c
===================================================================
--- /trunk/ppSub/src/ppSubCamera.c	(revision 17812)
+++ /trunk/ppSub/src/ppSubCamera.c	(revision 17813)
@@ -135,5 +135,5 @@
 
     // psPhot input
-    if (psMetadataLookup(config->arguments, "PSPHOT.PSF")) {
+    if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) {
         psphotModelClassInit ();        // load implementation-specific models
         pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
Index: /trunk/ppSub/src/ppSubReadout.c
===================================================================
--- /trunk/ppSub/src/ppSubReadout.c	(revision 17812)
+++ /trunk/ppSub/src/ppSubReadout.c	(revision 17813)
@@ -184,4 +184,47 @@
 #endif
 
+    // "Subtract" the mask and weight map
+    outRO->mask = (psImage*)psBinaryOp(outRO->mask, inConv->mask, "|", refConv->mask);
+    if (inConv->weight && refConv->weight) {
+        outRO->weight = (psImage*)psBinaryOp(outRO->weight, inConv->weight, "+", refConv->weight);
+    }
+    outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true;
+
+    // Photometry is to be performed in two stages:
+    // 1. Measure the PSF using the PSF-matched images
+    // 2. Find and measure sources on the subtracted image
+
+    // Photometry stage 1: measure the PSF
+    if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) {
+        // We use a summed image as the basis for the PSF: this will have the maximum S/N.
+        outRO->image = (psImage*)psBinaryOp(outRO->image, inConv->image, "+", refConv->image);
+
+        pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");
+        pmFPACopy(photFile->fpa, outRO->parent->parent->parent);
+
+        // We have a list of sources, so we could use those to redetermine the PSF model.
+        // Until Gene makes the necessary adaptations to psphot, we will simply redetermine the PSF model from
+        // scratch.
+
+        // Need to ensure aperture residual is not calculated
+        psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PSPHOT_RECIPE); // Recipe
+        if (!recipe) {
+            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
+            return false;
+        }
+        const char *breakpoint = psMetadataLookupStr(NULL, recipe, "BREAK_POINT"); // Current break point
+        psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
+                         "ALTERED break point for psphot operations", "PSFMODEL");
+
+        if (!psphotReadout(config, view)) {
+            psWarning("Unable to perform photometry on subtracted image.");
+            psErrorStackPrint(stderr, "Error stack from photometry:");
+            psErrorClear();
+        }
+
+        psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
+                         "RESTORED break point for psphot operations", breakpoint);
+    }
+
     // Do the subtraction
     {
@@ -197,9 +240,4 @@
 
         outRO->image = (psImage*)psBinaryOp(outRO->image, minuend->image, "-", subtrahend->image);
-        outRO->mask = (psImage*)psBinaryOp(outRO->mask, minuend->mask, "|", subtrahend->mask);
-        if (minuend->weight && subtrahend->weight) {
-            outRO->weight = (psImage*)psBinaryOp(outRO->weight, minuend->weight, "+", subtrahend->weight);
-        }
-        outRO->data_exists = outCell->data_exists = outCell->parent->data_exists = true;
 
 #ifdef TESTING
@@ -249,7 +287,8 @@
     }
 
+    // Photometry stage 2: find and measure sources on the subtracted image
     if (psMetadataLookupBool(NULL, config->arguments, "PHOTOMETRY")) {
+        // The PSF should already be stored for the readout
         pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");
-        pmFPACopy(photFile->fpa, outRO->parent->parent->parent);
 
         // Need to ensure aperture residual is not calculated
