Index: trunk/psphot/src/psphotModelTest.c
===================================================================
--- trunk/psphot/src/psphotModelTest.c	(revision 13900)
+++ trunk/psphot/src/psphotModelTest.c	(revision 14326)
@@ -25,5 +25,5 @@
     // what fitting mode to use?
     char *fitModeWord = psMetadataLookupStr (&status, recipe, "TEST_FIT_MODE");
-    if (!status) {
+    if (!status || !strcasecmp (fitModeWord, "DEFAULT")) {
         fitModeWord = DEFAULT_MODE;
     }
@@ -33,4 +33,5 @@
     // in fitMode, psf sets the model type
     if (fitMode == PM_SOURCE_FIT_PSF) {
+	// XXX load psf using psphotLoadPSF
         char *psfFile = psMetadataLookupStr (&status, recipe, "PSF_INPUT_FILE");
         if (!status) psAbort("PSF_INPUT_FILE not supplied");
@@ -41,5 +42,5 @@
         // find the model: supplied by user or first in the PSF_MODEL list
         char *modelName  = psMetadataLookupStr (&status, recipe, "TEST_FIT_MODEL");
-        if (modelName == NULL) {
+        if (!status || !strcasecmp (modelName, "DEFAULT")) {
             // get the list pointers for the PSF_MODEL entries
 
@@ -65,20 +66,20 @@
     // find the fitting parameters (try test values first)
     float INNER = psMetadataLookupF32 (&status, recipe, "TEST_FIT_INNER_RADIUS");
-    if (!status) {
+    if (!status || !isfinite(INNER)) {
         INNER = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");
     }
 
     float OUTER = psMetadataLookupF32 (&status, recipe, "TEST_FIT_OUTER_RADIUS");
-    if (!status) {
+    if (!status || !isfinite(OUTER)) {
         OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS");
     }
 
     float RADIUS = psMetadataLookupF32 (&status, recipe, "TEST_FIT_RADIUS");
-    if (!status) {
+    if (!status || !isfinite(RADIUS)) {
         RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");
     }
 
     float mRADIUS = psMetadataLookupF32 (&status, recipe, "TEST_MOMENTS_RADIUS");
-    if (!status) {
+    if (!status || !isfinite(mRADIUS)) {
         mRADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");
     }
@@ -103,4 +104,5 @@
 
     fprintf (stderr, "sum: %f @ (%f, %f)\n", source->moments->Sum, source->moments->x, source->moments->y);
+    fprintf (stderr, "moments: %f, %f - %f\n", source->moments->Sx, source->moments->Sy, source->moments->Sxy);
 
     psEllipseMoments moments;
@@ -128,5 +130,5 @@
         sprintf (name, "TEST_FIT_PAR%d", i);
         value = psMetadataLookupF32 (&status, recipe, name);
-        if (status) {
+        if (status && isfinite (value)) {
             params[i] = value;
         }
@@ -172,5 +174,5 @@
     pmSourcePhotometryModel (&fitMag, model);
     pmSourcePhotometryAper  (&obsMag, model, source->pixels, source->maskObj, maskVal);
-    fprintf (stderr, "ap: %f, fit: %f, apmifit: %f\n", obsMag, fitMag, obsMag - fitMag);
+    fprintf (stderr, "ap: %f, fit: %f, apmifit: %f, nIter: %d\n", obsMag, fitMag, obsMag - fitMag, model->nIter);
 
     // write out positive object
