Index: /branches/eam_branches/ipp-20191011/psModules/test/objects/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20191011/psModules/test/objects/Makefile.am	(revision 40940)
+++ /branches/eam_branches/ipp-20191011/psModules/test/objects/Makefile.am	(revision 40941)
@@ -12,28 +12,30 @@
 
 TEST_PROGS = \
-	tap_pmPeaks \
-	tap_pmGrowthCurve \
-	tap_pmMoments \
-	tap_pmSource \
-	tap_pmModel \
-	tap_pmModelUtils \
-	tap_pmModelClass \
-	tap_pmModel_CentralPixel \
-	tap_pmModel_CentralPixel_v2 \
-	tap_pmModel_SET_FWHM \
-	tap_pmPSF \
-	tap_pmTrend2D \
-	tap_pmResiduals \
-	tap_pmSourceExtendedPars \
-	tap_pmSourceSky \
-	tap_pmSourceMoments \
-	tap_pmSourceIO_PS1_DEV_0 \
-	tap_pmSourceIO_PS1_DEV_1 \
-	tap_pmSourceIO_SMPDATA \
-	tap_pmSourceContour \
-	tap_pmSourceUtils \
-	tap_pmSourceFitSet \
-	tap_pmPSF_IO \
-	tap_pmSourceIO_SMPDATA
+	tap_pmSourceFitModel
+
+#	tap_pmPeaks \
+#	tap_pmGrowthCurve \
+#	tap_pmMoments \
+#	tap_pmSource \
+#	tap_pmModel \
+#	tap_pmModelUtils \
+#	tap_pmModelClass \
+#	tap_pmModel_CentralPixel \
+#	tap_pmModel_CentralPixel_v2 \
+#	tap_pmModel_SET_FWHM \
+#	tap_pmPSF \
+#	tap_pmTrend2D \
+#	tap_pmResiduals \
+#	tap_pmSourceExtendedPars \
+#	tap_pmSourceSky \
+#	tap_pmSourceMoments \
+#	tap_pmSourceIO_PS1_DEV_0 \
+#	tap_pmSourceIO_PS1_DEV_1 \
+#	tap_pmSourceIO_SMPDATA \
+#	tap_pmSourceContour \
+#	tap_pmSourceUtils \
+#	tap_pmSourceFitSet \
+#	tap_pmPSF_IO \
+#	tap_pmSourceIO_SMPDATA
 
 if BUILD_TESTS
Index: /branches/eam_branches/ipp-20191011/psModules/test/objects/tap_pmSourceFitModel.c
===================================================================
--- /branches/eam_branches/ipp-20191011/psModules/test/objects/tap_pmSourceFitModel.c	(revision 40940)
+++ /branches/eam_branches/ipp-20191011/psModules/test/objects/tap_pmSourceFitModel.c	(revision 40941)
@@ -18,6 +18,6 @@
 int main (void)
 {
-    pmModelGroupInit ();
-    pmSourceFitModelInit (15, 0.01, 1.0, true);
+    pmModelClassInit ();
+    // pmSourceFitModelInit (15, 0.01, 1.0, true);
 
     // psTraceSetLevel ("psModules.objects.pmSourceFitModel", 10);
@@ -108,4 +108,6 @@
 {
 
+  psImageMaskType maskVal = 0x01;
+
     psVector *rnd = psVectorAlloc (1000, PS_TYPE_F32);
     for (int i = 0; i < rnd->n; i++) {
@@ -128,13 +130,13 @@
     source->modelEXT->params->data.F32[6] = 0;
 
-    source->pixels = psImageAlloc (100, 100, PS_TYPE_F32);
-    source->weight = psImageAlloc (100, 100, PS_TYPE_F32);
-    source->mask   = psImageAlloc (100, 100, PS_TYPE_U8);
+    source->pixels   = psImageAlloc (100, 100, PS_TYPE_F32);
+    source->variance = psImageAlloc (100, 100, PS_TYPE_F32);
+    source->maskObj  = psImageAlloc (100, 100, PS_TYPE_IMAGE_MASK);
     psImageInit (source->pixels, 0.0);
-    psImageInit (source->weight, 0.0);
-    psImageInit (source->mask, 0);
+    psImageInit (source->variance, 0.0);
+    psImageInit (source->maskObj, 0);
 
     // create an image with the model, and add noise: gain is 1, subtracted sky is 100, readnoise is 5
-    pmModelAdd (source->pixels, source->mask, source->modelEXT, PM_MODEL_OP_FULL);
+    pmModelAdd (source->pixels, source->maskObj, source->modelEXT, PM_MODEL_OP_FULL, maskVal);
     int npix = 0;
     for (int j = 0; j < source->pixels->numRows; j++) {
@@ -143,5 +145,5 @@
             float var = flux + 100 + PS_SQR(5);
             source->pixels->data.F32[j][i] += rnd->data.F32[npix]*sqrt(var);
-            source->weight->data.F32[j][i] = var;
+            source->variance->data.F32[j][i] = var;
             npix ++;
             if (npix == rnd->n)
@@ -162,6 +164,12 @@
     guess->params->data.F32[5] *= 0.9;
 
-    psImageKeepCircle (source->mask, 50, 50, radius, "OR", PM_MASK_MARK);
-    bool status = pmSourceFitModel (source, guess, PM_SOURCE_FIT_EXT);
+    pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc();
+    fitOptions->mode          = PM_SOURCE_FIT_EXT;
+    fitOptions->covarFactor   = 1.0;
+
+    // use maskVal to exclude pixels outside the circle
+    psImageKeepCircle (source->maskObj, 50, 50, radius, "OR", maskVal);
+
+    bool status = pmSourceFitModel (source, guess, fitOptions, maskVal);
     if (!status) {
         psFree (rnd);
@@ -170,5 +178,5 @@
         return false;
     }
-    psImageKeepCircle (source->mask, 50, 50, radius, "AND", PS_NOT_U8(PM_MASK_MARK));
+    psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(maskVal));
 
     par1->data.F32[par1->n] = (source->modelEXT->params->data.F32[1] / guess->params->data.F32[1]);
