Index: /branches/rel10_ifa/psModules/src/objects/pmSourceFitModel.c
===================================================================
--- /branches/rel10_ifa/psModules/src/objects/pmSourceFitModel.c	(revision 6819)
+++ /branches/rel10_ifa/psModules/src/objects/pmSourceFitModel.c	(revision 6820)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-04-01 02:47:20 $
+ *  @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-04-09 18:45:42 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -66,4 +66,5 @@
 
     int nParams = PSF ? 4 : params->n;
+    psF32 dSky = source->moments->dSky;
 
     // maximum number of valid pixels
@@ -95,5 +96,12 @@
             y->data.F32[nPix] = source->pixels->data.F32[i][j];
             // psMinimizeLMChi2 takes wt = 1/dY^2
-            yErr->data.F32[nPix] = 1.0 / source->weight->data.F32[i][j];
+            if (POISSON_WEIGHT) {
+                yErr->data.F32[nPix] = 1.0 / source->weight->data.F32[i][j];
+            } else {
+                yErr->data.F32[nPix] = 1.0 / dSky;
+            }
+            // XXX EAM : suggestion from RHL is to use the local sky as weight
+            // to avoid the bias from systematic errors
+            // here we would just use the source sky variance
             nPix++;
         }
@@ -113,4 +121,7 @@
 
     // XXX EAM : the new minimization API supplies the constraints as a struct
+    // XXX the chisq if a fcn of source flux. the minimization criterion should
+    // probably  be scaled somehow by flux.  measure the trend?  it depends on
+    // the about of systematic error in the models themselves...
     psMinimization *myMin = psMinimizationAlloc(PM_SOURCE_FIT_MODEL_NUM_ITERATIONS,
                             PM_SOURCE_FIT_MODEL_TOLERANCE);
