Index: trunk/psphot/src/pmSourceFitFixed.c
===================================================================
--- trunk/psphot/src/pmSourceFitFixed.c	(revision 5629)
+++ trunk/psphot/src/pmSourceFitFixed.c	(revision 5643)
@@ -1,7 +1,7 @@
 # include "psphot.h"
+# define USECLIP 0
 
-bool pmSourceFitFixed (pmSource *source,
-		       pmModel *model)
-{
+bool pmSourceFitFixed (pmSource *source, pmModel *model) {
+
     PS_ASSERT_PTR_NON_NULL(source, false);
     PS_ASSERT_PTR_NON_NULL(source->peak, false);
@@ -11,15 +11,8 @@
     PS_ASSERT_PTR_NON_NULL(source->weight, false);
 
-    // XXX EAM : is it necessary for the mask & weight to exist?  the
-    //           tests below could be conditions (!NULL)
-
-    psBool fitStatus = true;
-    psBool onPic     = true;
-    psBool rc        = true;
-    psF32  Ro, ymodel;
+    psF32 Ro, ymodel;
 
     psVector *params = model->params;
     psVector *dparams = model->dparams;
-    psVector *paramMask = NULL;
 
     pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
@@ -52,7 +45,7 @@
 	    yErr->data.F32[count] = sqrt (source->weight->data.F32[i][j] * Ro);
 
-	    psVectorExtend (x, 1, 100);
-	    psVectorExtend (y, 1, 100);
-	    psVectorExtend (yErr, 1, 100);
+	    psVectorExtend (x,    100, 1);
+	    psVectorExtend (y,    100, 1);
+	    psVectorExtend (yErr, 100, 1);
 	    count++;
         }
@@ -61,12 +54,17 @@
     psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD);
 
-    // psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
-    // stats->clipIter = 3;
-    // poly = psVectorClipFitPolynomial1D (poly, stats, NULL, 0, y, yErr, x);
+# if (USECLIP) 
+    psVector *mask = psVectorAlloc (count, PS_TYPE_U8);
+    psVectorInit (mask, 0);
+    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
+    stats->clipIter = 3;
+    poly = psVectorClipFitPolynomial1D (poly, stats, mask, 0, y, yErr, x);
+# else
+    poly = psVectorFitPolynomial1D (poly, NULL, 0, y, yErr, x);
+# endif
 
-    poly = psVectorFitPolynomial1D (poly, stats, NULL, 0, y, yErr, x);
-
-    params->data.F32[0] = poly->coeff[0];
-    params->data.F32[1] = poly->coeff[1];
+    // fitted values are variations from current values
+    params->data.F32[0] += poly->coeff[0];
+    params->data.F32[1] *= poly->coeff[1];
 
     // XXX need to get errors back from psVectorClipFit...
@@ -82,5 +80,9 @@
     psFree(y);
     psFree(yErr);
+
+# if (USECLIP)
     psFree(stats);
+    psFree(mask);
+# endif
 
     return true;
