Index: trunk/ppSim/src/ppSimInsertGalaxies.c
===================================================================
--- trunk/ppSim/src/ppSimInsertGalaxies.c	(revision 14667)
+++ trunk/ppSim/src/ppSimInsertGalaxies.c	(revision 14670)
@@ -137,4 +137,38 @@
 	// XXX add the sources to a source array
 
+# if (0)	
+	if (CONVOLVED_FIT) {
+
+	    // select the PSF (XXX : move out of loop)
+	    pmPSF *psfModel = psMetadataLookupPtr (&mdok, chip->analysis, "PSPHOT.PSF");
+	    assert (psf);
+	    
+	    // supply the psf to the source (normalized?)
+	    source->modelPSF = pmModelFromPSFforXY (psfModel, xChip, yChip, 1.0);
+
+	    // instantiate the psf flux
+	    pmSourceCachePSF (source, maskVal);
+
+	    // convert the cached cached psf model for this source to a psKernel
+	    // XXX for the moment, hard-wire the kernel to be 5x5 (2 pix radius)
+	    // XXX for the moment, hard-wire the kernel to be 9x9 (4 pix radius)
+	    psKernel *psf = psphotKernelFromPSF (source, psfSize);
+
+	    // instantiate the source model flux
+	    // XXX this may need to handle the offset?
+	    pmSourceCacheModel (source, maskVal);
+
+	    // make a storage buffer for the output image
+	    psImage *buffer = psImageCopy (source->modelFlux, PS_TYPE_F32);
+
+	    // convolve the psf image with the model image
+	    psImageConvolveDirect (buffer, source->modelFlux, psf);
+
+	    // save the result back in the source
+	    psFree (source->modelFlux);
+	    source->modelFlux = buffer;
+	}
+# endif
+
 	// insert the source flux in the image
 	pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
