Index: trunk/psModules/src/objects/pmSourceFitSet.c
===================================================================
--- trunk/psModules/src/objects/pmSourceFitSet.c	(revision 21183)
+++ trunk/psModules/src/objects/pmSourceFitSet.c	(revision 21363)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2009-01-27 06:39:38 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2009-02-06 02:31:25 $
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  *
@@ -55,12 +55,12 @@
 
     if (!fitSets) {
-	fitSets = psArrayAlloc (PS_MAX (1, nThreads));
-    }
-
-    // the allocated elements should be NULL on psArrayAlloc, 
-    // and a previously allocated array of fitSets should have been cleared 
+        fitSets = psArrayAlloc (PS_MAX (1, nThreads));
+    }
+
+    // the allocated elements should be NULL on psArrayAlloc,
+    // and a previously allocated array of fitSets should have been cleared
     // before pmSourceFitSetInit is called
     for (int i = 0; i < fitSets->n; i++) {
-	psAssert (fitSets->data[i] == NULL, "failure to init or clear fitSets?");
+        psAssert (fitSets->data[i] == NULL, "failure to init or clear fitSets?");
     }
     return true;
@@ -125,10 +125,10 @@
     // we do not need to lock to do this....
     for (int i = 0; i < fitSets->n; i++) {
-	thisSet = fitSets->data[i];
-	if (!thisSet) continue;
-	if (thisSet->thread == id) {
-	    break;
-	}
-	thisSet = NULL;
+        thisSet = fitSets->data[i];
+        if (!thisSet) continue;
+        if (thisSet->thread == id) {
+            break;
+        }
+        thisSet = NULL;
     }
     psAssert (thisSet == NULL, "pmSourceFitSetDataSet() called but previous entry not cleared");
@@ -137,11 +137,11 @@
 
     pthread_mutex_lock (&fitSetInitMutex);
-	  
+
     // find an entry that is NULL and place it there
     for (int i = 0; i < fitSets->n; i++) {
-	if (fitSets->data[i]) continue;
-	fitSets->data[i] = thisSet;
-	pthread_mutex_unlock (&fitSetInitMutex);
-	return thisSet;
+        if (fitSets->data[i]) continue;
+        fitSets->data[i] = thisSet;
+        pthread_mutex_unlock (&fitSetInitMutex);
+        return thisSet;
     }
     pthread_mutex_unlock (&fitSetInitMutex);
@@ -160,10 +160,10 @@
     pmSourceFitSetData *thisSet = NULL;
     for (int i = 0; i < fitSets->n; i++) {
-	thisSet = fitSets->data[i];
-	if (!thisSet) continue;
-	if (thisSet->thread == id) {
-	    break;
-	}
-	thisSet = NULL;
+        thisSet = fitSets->data[i];
+        if (!thisSet) continue;
+        if (thisSet->thread == id) {
+            break;
+        }
+        thisSet = NULL;
     }
     psAssert (thisSet != NULL, "pmSourceFitSetDataGet() called, but no entry found");
@@ -184,10 +184,10 @@
     pmSourceFitSetData *thisSet = NULL;
     for (i = 0; i < fitSets->n; i++) {
-	thisSet = fitSets->data[i];
-	if (!thisSet) continue;
-	if (thisSet->thread == id) {
-	    break;
-	}
-	thisSet = NULL;
+        thisSet = fitSets->data[i];
+        if (!thisSet) continue;
+        if (thisSet->thread == id) {
+            break;
+        }
+        thisSet = NULL;
     }
     psAssert (thisSet != NULL, "pmSourceFitSetDataClear() called, but no entry found");
@@ -256,14 +256,14 @@
         psVector *derivOne = set->derivSet->data[i];
 
-	// one or the other (param or deriv) must be set
-	assert ((deriv != NULL) || (param != NULL));
-
-	// if we are setting derive, derivOne and paramOne must be same length
+        // one or the other (param or deriv) must be set
+        assert ((deriv != NULL) || (param != NULL));
+
+        // if we are setting derive, derivOne and paramOne must be same length
         assert ((deriv == NULL) || (paramOne->n == derivOne->n));
-	
+
         for (int j = 0; j < paramOne->n; j++, n++) {
-	    if (param) {
-		param->data.F32[n] = paramOne->data.F32[j];
-	    }
+            if (param) {
+                param->data.F32[n] = paramOne->data.F32[j];
+            }
             if (deriv) {
                 deriv->data.F32[n] = derivOne->data.F32[j];
@@ -275,5 +275,5 @@
 
 // distribute parameters from single param and deriv vectors into FitSet models
-bool pmSourceFitSetSplit (pmSourceFitSetData *set, const psVector *deriv, const psVector *param) 
+bool pmSourceFitSetSplit (pmSourceFitSetData *set, const psVector *deriv, const psVector *param)
 {
     PS_ASSERT_VECTOR_NON_NULL(param, false);
@@ -301,5 +301,5 @@
 
 // set the model parameters for this fit set
-bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, 
+bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam,
                            const psVector *param, pmSource *source,
                            psMinimization *myMin, int nPix, bool fitStatus)
@@ -420,9 +420,9 @@
 
     for (int i = 0; i < modelSet->n; i++) {
-	pmModel *model = modelSet->data[i];
-	int nParams = pmModelClassParameterCount (model->type);
-	for (int j = 0; j < nParams; j++) {
-	    fprintf (file, "%d %d  : %f %f\n", i, j, model->params->data.F32[j], model->dparams->data.F32[j]);
-	}
+        pmModel *model = modelSet->data[i];
+        int nParams = pmModelClassParameterCount (model->type);
+        for (int j = 0; j < nParams; j++) {
+            fprintf (file, "%d %d  : %f %f\n", i, j, model->params->data.F32[j], model->dparams->data.F32[j]);
+        }
     }
     return true;
@@ -435,5 +435,5 @@
         psVector *derivOne = set->derivSet->data[i];
         for (int j = 0; j < paramOne->n; j++) {
-	    fprintf (file, "%d %d  : %f %f\n", i, j, paramOne->data.F32[j], derivOne->data.F32[j]);
+            fprintf (file, "%d %d  : %f %f\n", i, j, paramOne->data.F32[j], derivOne->data.F32[j]);
         }
     }
@@ -450,5 +450,5 @@
     PS_ASSERT_PTR_NON_NULL(source->pixels, false);
     PS_ASSERT_PTR_NON_NULL(source->maskObj, false);
-    PS_ASSERT_PTR_NON_NULL(source->weight, false);
+    PS_ASSERT_PTR_NON_NULL(source->variance, false);
 
     bool fitStatus = true;
@@ -471,6 +471,6 @@
                 continue;
             }
-            // skip zero-weight points
-            if (source->weight->data.F32[i][j] == 0) {
+            // skip zero-variance points
+            if (source->variance->data.F32[i][j] == 0) {
                 continue;
             }
@@ -489,8 +489,8 @@
 
             // psMinimizeLMChi2 takes wt = 1/dY^2.  suggestion from RHL is to use the local sky
-            // as weight to avoid the bias from systematic errors here we would just use the
+            // as variance to avoid the bias from systematic errors here we would just use the
             // source sky variance
             if (PM_SOURCE_FIT_MODEL_PIX_WEIGHTS) {
-                yErr->data.F32[nPix] = 1.0 / source->weight->data.F32[i][j];
+                yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j];
             } else {
                 yErr->data.F32[nPix] = 1.0 / PM_SOURCE_FIT_MODEL_WEIGHT;
@@ -543,5 +543,5 @@
         psFree (params);
         psFree(constraint);
-	pmSourceFitSetDataClear(); // frees thisSet and removes if from the array of fitSets
+        pmSourceFitSetDataClear(); // frees thisSet and removes if from the array of fitSets
         return(false);
     }
