Index: /trunk/psphot/src/psphot.h
===================================================================
--- /trunk/psphot/src/psphot.h	(revision 36753)
+++ /trunk/psphot/src/psphot.h	(revision 36754)
@@ -547,5 +547,5 @@
 bool psphotGalaxyShapeSource (pmPCMdata *pcm, pmSource *source, pmSourceGalaxyFits *galaxyFits, psImageMaskType maskVal, int psfSize, bool saveResults);
 psphotGalaxyShapeOptions *psphotGalaxyShapeOptionsAlloc();
-void psphotGalaxyShapeOptionsSet(pmSource *source, pmSourceGalaxyFits *galaxyFits, psphotGalaxyShapeOptions *defaultOptions);
+bool psphotGalaxyShapeOptionsSet(pmSource *source, pmSourceGalaxyFits *galaxyFits, psphotGalaxyShapeOptions *defaultOptions);
 
 bool psphotRadialProfileWings (pmConfig *config, const pmFPAview *view, const char *filerule);
Index: /trunk/psphot/src/psphotGalaxyShape.c
===================================================================
--- /trunk/psphot/src/psphotGalaxyShape.c	(revision 36753)
+++ /trunk/psphot/src/psphotGalaxyShape.c	(revision 36754)
@@ -259,14 +259,19 @@
         psF32 *PAR = pcm->modelConv->params->data.F32;
 
-        // double check that the guess is carried along...
+        pmSourceGalaxyFits *galaxyFits = pmSourceGalaxyFitsAlloc();
+
+        // set the options for this source
+        if (!psphotGalaxyShapeOptionsSet(source, galaxyFits, opt)) {
+            // this source won't work
+            psFree(pcm);
+            psFree(galaxyFits);
+            continue;
+        }
+
         if (!source->galaxyFits) {
             source->galaxyFits = psArrayAllocEmpty(1);
         }
-        pmSourceGalaxyFits *galaxyFits = pmSourceGalaxyFitsAlloc();
         psArrayAdd(source->galaxyFits, 1, galaxyFits);
         psFree(galaxyFits);
-
-        // set the options for this source
-        psphotGalaxyShapeOptionsSet(source, galaxyFits, opt);
 
         // I have some source guess (e0, e1, e2)
@@ -414,19 +419,8 @@
     psMemSetDeallocator(opt, (psFreeFunc) psphotGalaxyShapeOptionsFree);
     
-#ifdef notdef
-    opt->fRmajorMin = 0.5;
-    opt->fRmajorMax = 2.0;
-    opt->fRmajorDel = 0.1;
-    opt->fRminorMin = 0.5;
-    opt->fRminorMax = 2.0;
-    opt->fRminorDel = 0.1;
-    opt->snMinAllTrials = 20;      // for sources with cff SN < 20 ...
-    opt->reduceTrialsFactor = 2; // cut the number of trials in half (double the deltas)
-#endif
-
     return opt;
 }
 
-void psphotGalaxyShapeOptionsSet(pmSource *source, pmSourceGalaxyFits *galaxyFits, psphotGalaxyShapeOptions *options)
+bool psphotGalaxyShapeOptionsSet(pmSource *source, pmSourceGalaxyFits *galaxyFits, psphotGalaxyShapeOptions *options)
 {
     // XXX: put these in recipe
@@ -437,4 +431,7 @@
     float f_min = 1 - options->NSigma * f_del;
     float f_max = 1 + options->NSigma * f_del;
+
+    // if f_min goes negative skip this object
+    if (f_min < 0) return false;
 
     galaxyFits->fRmajorMin = f_min;
@@ -444,4 +441,6 @@
     galaxyFits->fRminorMax = f_max;
     galaxyFits->fRminorDel = f_del;
-}
-
+
+    return true;
+}
+
