Index: trunk/psphot/src/psphotChoosePSF.c
===================================================================
--- trunk/psphot/src/psphotChoosePSF.c	(revision 30624)
+++ trunk/psphot/src/psphotChoosePSF.c	(revision 31154)
@@ -70,5 +70,5 @@
 
     // examine PSF sources in S/N order (brightest first)
-    sources = psArraySort (sources, pmSourceSortBySN);
+    sources = psArraySort (sources, pmSourceSortByFlux);
 
     // structure to store user options defining the psf
@@ -160,4 +160,6 @@
     options->fitOptions->weight        = PS_SQR(SKY_SIG);
     options->fitOptions->mode          = PM_SOURCE_FIT_PSF;
+    options->fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
+
     
     psArray *stars = psArrayAllocEmpty (sources->n);
@@ -178,5 +180,5 @@
     psphotCheckStarDistribution (stars, sources, options);
 
-    psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
+    psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected %ld candidate PSF objects\n", stars->n);
 
     if (stars->n < 50) {
@@ -336,4 +338,7 @@
     }
 
+    // XXX does this work here?
+    psphotVisualShowPSFStars (recipe, try->psf, try->sources);
+
     // build the flux-to-magnitude conversion information
     if (!psphotMakeFluxScale (readout->image, recipe, try->psf)) {
@@ -443,4 +448,7 @@
 	    }
             psFree (modelPSF);
+
+	    // float fwhmtest = pmPSFtoFWHM(psf, xc, yc);
+	    // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);
         }
     }
