Index: branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCM_MinimizeChisq.c
===================================================================
--- branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCM_MinimizeChisq.c	(revision 31925)
+++ branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCM_MinimizeChisq.c	(revision 31926)
@@ -45,4 +45,5 @@
 # define USE_FFT 1
 # define PRE_CONVOLVE 1
+# define TESTCOPY 0
 
 bool pmPCM_MinimizeChisq (
@@ -93,5 +94,9 @@
 	psFree (pcm->psfFFT);
     }
-    pcm->psfFFT = psImageConvolveKernelInit(pcm->modelFlux, pcm->psf);
+# if (!TESTCOPY)
+    if (!pcm->use1Dgauss) {
+	pcm->psfFFT = psImageConvolveKernelInit(pcm->modelFlux, pcm->psf);
+    }
+# endif
 # endif    
 
@@ -309,5 +314,20 @@
 # if (PRE_CONVOLVE)
     // convolve model image and derivative images with pre-convolved kernel
-    psImageConvolveKernel (pcm->modelConvFlux, pcm->modelFlux, NULL, 0, pcm->psfFFT);
+
+// XXX for a test, just copy, rather than convolve
+# if (TESTCOPY)
+    psImageCopy (pcm->modelConvFlux, pcm->modelFlux, pcm->modelFlux->type.type);
+# else
+    if (pcm->use1Dgauss) {
+	// do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
+	// * the model flux is not masked
+	// * threading takes place above this level
+	pcm->modelConvFlux = psImageCopy (pcm->modelConvFlux, pcm->modelFlux, pcm->modelFlux->type.type);
+	psImageSmooth (pcm->modelConvFlux, pcm->sigma, pcm->nsigma);
+    } else {
+	psImageConvolveKernel (pcm->modelConvFlux, pcm->modelFlux, NULL, 0, pcm->psfFFT);
+    }
+# endif
+
     for (int n = 0; n < pcm->dmodelsFlux->n; n++) {
         if (pcm->dmodelsFlux->data[n] == NULL) continue;
@@ -315,5 +335,17 @@
         psImage *dmodel = pcm->dmodelsFlux->data[n];
         psImage *dmodelConv = pcm->dmodelsConvFlux->data[n];
-        psImageConvolveKernel (dmodelConv, dmodel, NULL, 0, pcm->psfFFT);
+# if (TESTCOPY)
+	psImageCopy (dmodelConv, dmodel, dmodel->type.type);
+# else
+	if (pcm->use1Dgauss) {
+	    // do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
+	    // * the model flux is not masked
+	    // * threading takes place above this level
+	    dmodelConv = psImageCopy (dmodelConv, dmodel, dmodel->type.type);
+	    psImageSmooth (dmodelConv, pcm->sigma, pcm->nsigma);
+	} else {
+	    psImageConvolveKernel (dmodelConv, dmodel, NULL, 0, pcm->psfFFT);
+	}
+# endif
     }
 # else
@@ -325,5 +357,14 @@
         psImage *dmodel = pcm->dmodelsFlux->data[n];
         psImage *dmodelConv = pcm->dmodelsConvFlux->data[n];
-        psImageConvolveFFT (dmodelConv, dmodel, NULL, 0, pcm->psf);
+
+	if (pcm->use1Dgauss) {
+	    // do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
+	    // * the model flux is not masked
+	    // * threading takes place above this level
+	    dmodelConv = psImageCopy (dmodelConv, dmodel, dmodel->type.type);
+	    psImageSmooth (dmodelConv, pcm->sigma, pcm->nsigma);
+	} else {
+	    psImageConvolveFFT (dmodelConv, dmodel, NULL, 0, pcm->psf);
+	}
     }
 # endif // PRE-CONVOLVE
Index: branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCMdata.c
===================================================================
--- branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCMdata.c	(revision 31925)
+++ branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCMdata.c	(revision 31926)
@@ -41,4 +41,7 @@
 #include "pmPCMdata.h"
 
+# define USE_DELTA_PSF 0
+# define USE_1D_GAUSS 1
+
 static void pmPCMdataFree (pmPCMdata *pcm) {
 
@@ -88,4 +91,10 @@
     pcm->constraint = NULL;
     pcm->nDOF = 0;
+
+    // full convolution with the PSF is expensive.  if we have to save time, we can do a 1D
+    // convolution with a Gaussian approximation to the kernel
+    pcm->use1Dgauss = false;
+    pcm->nsigma = 3.0; 
+    pcm->sigma = 1.0; // this should be set to something sensible when the psf is known
 
     return pcm;
@@ -257,4 +266,24 @@
     pcm->nDOF = nPix - nParams;
 
+# if (USE_1D_GAUSS)
+    pmModel *modelPSF = source->modelPSF;
+    psAssert (modelPSF, "psf model must be defined");
+    
+    psEllipseShape shape;
+    psEllipseAxes axes;
+
+    shape.sx  = modelPSF->params->data.F32[PM_PAR_SXX];
+    shape.sy  = modelPSF->params->data.F32[PM_PAR_SYY];
+    shape.sxy = modelPSF->params->data.F32[PM_PAR_SXY];
+    axes = psEllipseShapeToAxes (shape, 20.0);
+    
+    float FWHM_MAJOR = 2*modelPSF->modelRadius (modelPSF->params, 0.5*modelPSF->params->data.F32[PM_PAR_I0]);
+    float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
+
+    pcm->use1Dgauss = true;
+    pcm->sigma = 0.5 * (FWHM_MAJOR + FWHM_MINOR) / 2.35;
+    pcm->nsigma = 2.0;
+# endif
+
     return pcm;
 }
Index: branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCMdata.h
===================================================================
--- branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCMdata.h	(revision 31925)
+++ branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCMdata.h	(revision 31926)
@@ -35,4 +35,8 @@
     int nPar;
     int nDOF;
+
+    bool use1Dgauss;
+    float sigma;
+    float nsigma;
 } pmPCMdata;
 
Index: branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceFitPCM.c
===================================================================
--- branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceFitPCM.c	(revision 31925)
+++ branches/eam_branches/ipp-20110710/psModules/src/objects/pmSourceFitPCM.c	(revision 31926)
@@ -50,4 +50,6 @@
 bool pmSourceFitPCM (pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal, int psfSize) {
     
+    psTimerStart ("pmSourceFitPCM");
+
     psVector *params  = pcm->modelConv->params;
     psVector *dparams  = pcm->modelConv->dparams;
@@ -64,5 +66,9 @@
     psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F32);
 
+    float t1 = psTimerMark ("pmSourceFitPCM");
+
     bool fitStatus = pmPCM_MinimizeChisq (myMin, covar, params, source, pcm);
+    float t2 = psTimerMark ("pmSourceFitPCM");
+
     for (int i = 0; i < dparams->n; i++) {
         if ((pcm->constraint->paramMask != NULL) && pcm->constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i])
@@ -76,4 +82,5 @@
     }
     psTrace ("psphot", 4, "niter: %d, chisq: %f", myMin->iter, myMin->value);
+    float t3 = psTimerMark ("pmSourceFitPCM");
 
     // renormalize output model image (generated by fitting process)
@@ -97,4 +104,5 @@
 	pmSourceChisqUnsubtracted (source, pcm->modelConv, maskVal);
     }
+    float t4 = psTimerMark ("pmSourceFitPCM");
 
     // set the model success or failure status
@@ -114,4 +122,9 @@
 
     source->mode |= PM_SOURCE_MODE_FITTED; // XXX is this needed?
+    float t5 = psTimerMark ("pmSourceFitPCM");
+
+    if (0) {
+	fprintf (stderr, "nIter: %2d, npix: %5d, t1: %6.4f, t2: %6.4f, t3: %6.4f, t4: %6.4f, t5: %6.4f\n", myMin->iter, pcm->nPix, t1, t2, t3, t4, t5);
+    }
 
     psFree(myMin);
