Index: trunk/ppSim/src/ppSimInsertStars.c
===================================================================
--- trunk/ppSim/src/ppSimInsertStars.c	(revision 28127)
+++ trunk/ppSim/src/ppSimInsertStars.c	(revision 29002)
@@ -105,11 +105,4 @@
         float flux = star->flux * expCorr->data.F32[(int)yCell][(int)xCell];
 
-	// if psfConvolve is TRUE, we will (elsewhere) convolve the image we a PSF
-	// in this case, simply place delta functions in the image
-	if (psfConvolve) {
-	    readout->image->data.F32[(int)(yCell)][(int)(xCell)] += flux;
-	    continue;
-	}
-
 	// instantiate a model for the PSF at this location, set desired flux
 	pmModel *model = pmModelFromPSFforXY (psf, xChip, yChip, 1.0);
@@ -125,26 +118,35 @@
 	// XXX i should be applying the gain and the correct effective area
 	psEllipseAxes axes = pmPSF_ModelToAxes (model->params->data.F32, 20.0);
-	psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
+	float Area = 2.0 * M_PI * axes.major * axes.minor;
 
-	// this value is the pure (input) flux, and is saved in the output source cmf files
 	source->psfMag = -2.5*log10(star->flux);
 	source->errMag = sqrt(Area*PS_SQR(roughNoise) + flux) / flux;
+	
+	// set the expected model errors
+	model->dparams->data.F32[PM_PAR_I0] = source->errMag * model->params->data.F32[PM_PAR_I0];
 
-	fprintf (outfile, "%8.3f %8.3f  %10.2f  %7.3f %5.3f\n", star->x, star->y, star->flux, source->psfMag, source->errMag);
+	float par8 = (model->params->n == 8) ? model->params->data.F32[7] : 0.0;
+	fprintf (outfile, "%8.3f %8.3f %10.2f  %2d  %7.3f %5.3f  %5.3f %5.3f %5.3f %5.3f\n", star->x, star->y, star->flux, 0, source->psfMag, source->errMag, axes.major, axes.minor, axes.theta, par8);
 
-	// insert the source flux in the image
-	pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
-
-	// insert the source flux in the noise image
-	pmSourceAddWithOffset (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, 0xff, dX, dY);
-
-	// Blow away the image parts of the source, which makes the memory explode
-	RESET(source->pixels);
-	RESET(source->variance);
-	RESET(source->maskObj);
-	RESET(source->maskView);
-	RESET(source->modelFlux);
-	RESET(source->psfImage);
-	RESET(source->blends);
+	// if psfConvolve is TRUE, we will (elsewhere) convolve the image we a PSF
+	// in this case, simply place delta functions in the image
+	if (psfConvolve) {
+	    readout->image->data.F32[(int)(yCell)][(int)(xCell)] += flux;
+	} else {
+	    // insert the source flux in the image
+	    pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
+	    
+	    // insert the source flux in the noise image
+	    pmSourceAddWithOffset (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, 0xff, dX, dY);
+	    
+	    // Blow away the image parts of the source, which makes the memory explode
+	    RESET(source->pixels);
+	    RESET(source->variance);
+	    RESET(source->maskObj);
+	    RESET(source->maskView);
+	    RESET(source->modelFlux);
+	    RESET(source->psfImage);
+	    RESET(source->blends);
+	}
 
 	// add the sources to the source array
