Index: trunk/psModules/src/objects/pmPSF.c
===================================================================
--- trunk/psModules/src/objects/pmPSF.c	(revision 13803)
+++ trunk/psModules/src/objects/pmPSF.c	(revision 13898)
@@ -6,6 +6,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-06-13 23:41:51 $
+ *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-06-20 02:22:26 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -81,9 +81,9 @@
 /*****************************************************************************
  pmPSFAlloc (type): allocate a pmPSF.
- 
+
  NOTE: PSF model parameters which are not modeled on an image are set to NULL in psf->params.
- 
+
  These are normally:
- 
+
  X-center
  Y-center
@@ -180,7 +180,7 @@
     // set model parameters for this source based on PSF information
     if (!modelFromPSFFunc (modelPSF, modelEXT, psf)) {
-	psError(PM_ERR_PSF, false, "Failed to set model params from PSF");
-	psFree(modelPSF);
-	return NULL;
+        psError(PM_ERR_PSF, false, "Failed to set model params from PSF");
+        psFree(modelPSF);
+        return NULL;
     }
     // XXX note that model->residuals is just a reference
@@ -245,5 +245,5 @@
 // New Concept: the PSF modelling function fits the polarization terms e0, e1, e2:
 
-// convert the parameters used in the fitted source model 
+// convert the parameters used in the fitted source model
 // to the parameters used in the 2D PSF model
 bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis)
@@ -257,7 +257,7 @@
     psEllipseAxes axes;
     if (psEllipsePolToAxes (pol, minMinorAxis, &axes) != PS_ERR_NONE) {
-	psError(PM_ERR_PSF, false, "Failed to convert e[012] (%g,%g,%g) to axes",
-		pol.e0, pol.e1, pol.e2);
-	return false;
+        psError(PM_ERR_PSF, false, "Failed to convert e[012] (%g,%g,%g) to axes",
+                pol.e0, pol.e1, pol.e2);
+        return false;
     }
     psEllipseShape shape = psEllipseAxesToShape (axes);
@@ -279,7 +279,7 @@
     shape.sy  = modelPar[PM_PAR_SYY] / M_SQRT2;
     shape.sxy = modelPar[PM_PAR_SXY];
-    
+
     psEllipsePol pol = psEllipseShapeToPol (shape);
-    
+
     return pol;
 }
@@ -297,12 +297,12 @@
 
     if ((shape.sx == 0) || (shape.sy == 0)) {
-	axes.major = 0.0;
-	axes.minor = 0.0;
-	axes.theta = 0.0;
+        axes.major = 0.0;
+        axes.minor = 0.0;
+        axes.theta = 0.0;
     } else {
-	// XXX this is not really consistent with the model fit range above
-	axes = psEllipseShapeToAxes (shape, maxAR);
-    }
-    
+        // XXX this is not really consistent with the model fit range above
+        axes = psEllipseShapeToAxes (shape, maxAR);
+    }
+
     return axes;
 }
@@ -313,10 +313,10 @@
 {
     if ((axes.major <= 0) || (axes.minor <= 0)) {
-	modelPar[PM_PAR_SXX] = 0.0;
-	modelPar[PM_PAR_SYY] = 0.0;
-	modelPar[PM_PAR_SXY] = 0.0;
-	return true;
-    }	
-    
+        modelPar[PM_PAR_SXX] = 0.0;
+        modelPar[PM_PAR_SYY] = 0.0;
+        modelPar[PM_PAR_SXY] = 0.0;
+        return true;
+    }
+
     psEllipseShape shape = psEllipseAxesToShape (axes);
 
@@ -478,5 +478,5 @@
 
 // we generate the growth curve for the center of the image with the specified psf model
-bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore)
+bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark)
 {
 
@@ -526,10 +526,10 @@
     // no need to mask the source here
     // XXX should we measure this for the analytical model only or the full model?
-    pmModelAdd (image, NULL, model, PM_MODEL_OP_FULL);
+    pmModelAdd (image, NULL, model, PM_MODEL_OP_FULL, maskVal);
 
     // loop over a range of source fluxes
     // no need to interpolate since we have forced the object center
     // to 0.5, 0.5 above
-    bool completeGrowthCurve = true;		// do we have a complete curve of growth?
+    bool completeGrowthCurve = true;            // do we have a complete curve of growth?
     for (int i = 0; i < psf->growth->radius->n; i++) {
 
@@ -537,13 +537,13 @@
 
         // mask the given aperture and measure the apMag
-        psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK);
-        if (!pmSourcePhotometryAper (&apMag, model, image, mask)) {
-	    psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius);
-	    completeGrowthCurve = false;
-	    break;
-	}
-
-	// XXX since we re-mask on each pass, this could be dropped.
-        psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(PM_MASK_MARK));
+        psImageKeepCircle (mask, xc, yc, radius, "OR", mark);
+        if (!pmSourcePhotometryAper (&apMag, model, image, mask, maskVal)) {
+            psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius);
+            completeGrowthCurve = false;
+            break;
+        }
+
+        // XXX since we re-mask on each pass, this could be dropped.
+        psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(mark));
 
         // the 'ignore' mode is for testing
@@ -556,9 +556,9 @@
 
     if (completeGrowthCurve) {
-	psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);
-	psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;
+        psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);
+        psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;
     } else {
-	psf->growth->apRef = NAN;
-	psf->growth->apLoss = 0;
+        psf->growth->apRef = NAN;
+        psf->growth->apLoss = 0;
     }
 
