Index: trunk/psModules/src/objects/pmPSFtry.c
===================================================================
--- trunk/psModules/src/objects/pmPSFtry.c	(revision 19103)
+++ trunk/psModules/src/objects/pmPSFtry.c	(revision 19474)
@@ -5,6 +5,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-08-18 00:40:47 $
+ *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-09-11 00:38:23 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -802,7 +802,4 @@
     int nBin = PS_MAX (mag->n / nGroup, 1);
 
-    // output vectors for ApResid trend
-    psVector *dSo = psVectorAlloc (nBin, PS_TYPE_F32);
-
     // use mag to group parameters in sequence
     psVector *index = psVectorSortIndex (NULL, mag);
@@ -815,5 +812,6 @@
 
     int n = 0;
-    for (int i = 0; i < dSo->n; i++) {
+    float min = INFINITY;               // Minimum error
+    for (int i = 0; i < nBin; i++) {
         int j;
         for (j = 0; (j < nGroup) && (n < mag->n); j++, n++) {
@@ -844,5 +842,10 @@
         dEsquare += PS_SQR(psStatsGetValue(statsS, stdevOpt));
 
-        dSo->data.F32[i] = sqrt(dEsquare);
+        if (isfinite(dEsquare)) {
+            float err = sqrtf(dEsquare);
+            if (err < min) {
+                min = err;
+            }
+        }
     }
     psFree (dE0subset);
@@ -851,13 +854,7 @@
     psFree (mkSubset);
 
-    psStats *minStats = psStatsAlloc(PS_STAT_MIN);
-    psVectorStats(minStats, dSo, NULL, NULL, 0);
-    *errorFloor = minStats->min;
-    psFree(minStats);
-
     psFree(index);
-    psFree (dSo);
-
-    psFree (statsS);
+
+    psFree(statsS);
 
     return true;
