Index: /branches/eam_branches/20091113/psphot/src/psphotChoosePSF.c
===================================================================
--- /branches/eam_branches/20091113/psphot/src/psphotChoosePSF.c	(revision 26234)
+++ /branches/eam_branches/20091113/psphot/src/psphotChoosePSF.c	(revision 26235)
@@ -72,8 +72,4 @@
     psMetadataAddF32(recipe, PS_LIST_TAIL, "PSF_FIT_RADIUS", PS_META_REPLACE, "fit radius", options->fitRadius);
     psMetadataAddF32(recipe, PS_LIST_TAIL, "PSF_APERTURE", PS_META_REPLACE, "psf aperture", options->apRadius);
-
-    // XXX ROBUST seems to be too agressive given the small numbers.
-    // options->stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
-    options->stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
 
     // dimensions of the field for which the PSF is defined
@@ -116,4 +112,11 @@
     psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
 
+    if (stars->n < 50) {
+	// ROBUST is too agressive if we only have a small number of PSF stars
+	options->stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
+    } else {
+	options->stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
+    }
+
     // get the list pointers for the PSF_MODEL entries
     psArray *modelNames = NULL;
