Index: trunk/psphot/src/psphotChoosePSF.c
===================================================================
--- trunk/psphot/src/psphotChoosePSF.c	(revision 15017)
+++ trunk/psphot/src/psphotChoosePSF.c	(revision 15023)
@@ -62,8 +62,4 @@
 
     pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), options->poissonErrorsPhotLMM);
-
-    // check that the identified psf stars sufficiently cover the region; if not, extend the
-    // limits somewhat
-    // psphotCheckStarDistribution (sources, options);
 
     psArray *stars = psArrayAllocEmpty (sources->n);
@@ -81,11 +77,9 @@
         }
     }
+    // check that the identified psf stars sufficiently cover the region; if not, extend the
+    // limits somewhat
+    psphotCheckStarDistribution (stars, sources, options);
+
     psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
-
-    if (stars->n == 0) {
-        psLogMsg ("psphot.choosePSF", PS_LOG_WARN, "Failed to find any PSF candidates");
-        psFree (stars);
-        return NULL;
-    }
 
     // get the list pointers for the PSF_MODEL entries
@@ -100,4 +94,36 @@
         if (item->type != PS_DATA_METADATA_MULTI) psAbort("missing PSF_MODEL selection");
 	modelNames = psListToArray (item->data.list);
+    }
+
+    // generate a psf model using the first selection
+    if (stars->n == 0) {
+	// XXX optionally give up here
+	psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF");
+	psErrorStackPrint (stderr, "Using guess PSF model");
+	psErrorClear ();
+	
+	// unset the PSFSTAR flags (none are used):
+	for (int i = 0; i < sources->n; i++) {
+	    pmSource *source = sources->data[i];
+	    source->mode &= ~PM_SOURCE_MODE_PSFSTAR;
+	}
+
+	// XXX set sxx, etc from FWHM in recipe
+	pmPSF *psf = pmPSFBuildSimple (modelNames->data[0], 1.0, 1.0, 0.0, 1.0);
+	psf->fieldNx = readout->image->numCols;
+	psf->fieldNy = readout->image->numRows;
+	psFree (modelNames);
+
+	bool status = true;
+	status &= psphotMakeFluxScale (readout->image, recipe, psf);
+	status &= psphotPSFstats (readout, recipe, psf);
+	if (!status) {
+	    psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF");
+	    psFree (psf);
+	    return NULL;
+	}
+
+	// XXX set DSX_MEAN, etc?
+        return psf;
     }
 
