Index: trunk/psphot/src/psphotChoosePSF.c
===================================================================
--- trunk/psphot/src/psphotChoosePSF.c	(revision 20004)
+++ trunk/psphot/src/psphotChoosePSF.c	(revision 20035)
@@ -441,4 +441,6 @@
 bool psphotPSFstats (pmReadout *readout, psMetadata *recipe, pmPSF *psf) {
 
+    double FWHM_X, FWHM_Y;
+
     psEllipseShape shape;
     psEllipseAxes axes;
@@ -451,13 +453,25 @@
     PS_ASSERT_PTR_NON_NULL(image, false);
 
-    // construct a normalized PSF model at this coordinate (Io = 1.0)
-    pmModel *modelPSF = pmModelFromPSFforXY (psf, 0.5*image->numCols, 0.5*image->numRows, 1.0);
-    if (modelPSF == NULL) {
-        psError(PSPHOT_ERR_PSF, false, "Failed to estimate PSF model at image centre");
-        return false;
-    }
-
+    // XXXX A Serious hack: the psf might not be determined in the field center.
+    // for the moment, just try a few locations until it is defined!
+
+    pmModel *modelPSF = NULL;
+    for (int ix = -1; ix <= +1; ix ++) {
+	for (int iy = -1; iy <= +1; iy ++) {
+
+	    // use the center of the center pixel of the image
+	    float xc = (0.5 + 0.3*ix)*image->numCols + image->col0 + 0.5;
+	    float yc = (0.5 + 0.3*ix)*image->numRows + image->row0 + 0.5;
+
+	    // create modelPSF from this model
+	    modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0);
+	    if (modelPSF) goto got_model;
+	}
+    }
+    psAssert (modelPSF, "Failed to estimate PSF model at image center (psf is invalid everywhere?)");
+
+got_model:
     // get the model full-width at half-max
-    double FWHM_X = 2*modelPSF->modelRadius (modelPSF->params, 0.5);
+    FWHM_X = 2*modelPSF->modelRadius (modelPSF->params, 0.5);
 
     // XXX make sure this is consistent with the re-definition of PM_PAR_SXX
@@ -467,5 +481,5 @@
     axes = psEllipseShapeToAxes (shape, 20.0);
 
-    double FWHM_Y = FWHM_X * (axes.minor / axes.major);
+    FWHM_Y = FWHM_X * (axes.minor / axes.major);
 
     psMetadataAddF32 (recipe, PS_LIST_TAIL, "FWHM_X",   PS_META_REPLACE, "PSF FWHM Major axis", FWHM_X);
