Index: trunk/pswarp/src/pswarpLoop.c
===================================================================
--- trunk/pswarp/src/pswarpLoop.c	(revision 14768)
+++ trunk/pswarp/src/pswarpLoop.c	(revision 14874)
@@ -198,33 +198,38 @@
     }
 
+    // We need a new PSF model for the warped frame
+    // It would be good to generate this analytically, but that's going to be tricky.
+    // 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.
+    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
+        psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes,
+                                                       PSPHOT_RECIPE); // Recipe for psphot
+        if (!psphotRecipe) {
+            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
+            return false;
+        }
+
+        psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE,
+                         "Break point for psphot operations", "PSFMODEL");
+
+        pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");
+        pmFPACopy(photFile->fpa, outFPA);
+
+        pmFPAview *view = pmFPAviewAlloc(0); // View into skycell
+        if (!psphotReadout(config, view)) {
+            psError(psErrorCodeLast(), false, "Unable to determine PSF for warped image.\n");
+            psFree(view);
+            return false;
+        }
+        psFree(view);
+
+        pmFPAfileActivate(config->files, false, "PSPHOT.INPUT");
+    }
+
     output->data_exists = true;
     outCell->data_exists = true;
     outChip->data_exists = true;
 
-#if 0
-    float gain = 0.0, readnoise = 0.0, saturation = INFINITY, exposure = 0.0, darktime = 0.0;
-    double mjd = 0.0;
-#endif
-
-#if 0
-    // XXX Hack so that INSTRUME header keyword and the like are not updated properly
-    // If INSTRUME (etc) is updated, then the FITS file with the warped image will be often
-    // recognised as coming from the old camera, not the new, warped camera.
-    // The proper solution to this, I believe, would be to define a skycell derivative of the
-    // old camera, so that the skycell can be recognised as coming from the old camera (and would
-    // also therefore inherit all its recipes, which would be good), rather than having a completely
-    // different camera.  That will take some work; the below solution should be good enough for now.
-    {
-        psMetadataItem *item;           // Concepts item to update
-
-        item = psMetadataLookup(outFPA->concepts, "FPA.INSTRUMENT");
-        psFree(item->data.V);
-        item->data.V = NULL;
-
-        item = psMetadataLookup(outFPA->concepts, "FPA.DETECTOR");
-        psFree(item->data.V);
-        item->data.V = NULL;
-    }
-#endif
 
     // Perform statistics on the output image
