Index: /branches/pap_branch_20090128/ppSim/src/ppSimInsertStars.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimInsertStars.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimInsertStars.c	(revision 21230)
@@ -39,7 +39,7 @@
     float skyRate = psMetadataLookupF32(NULL, recipe, "SKY.RATE"); // Sky rate
     if (isnan(skyRate)) {
-	float zp      = psMetadataLookupF32(&mdok, recipe, "ZEROPOINT"); assert (mdok);
-	float scale   = psMetadataLookupF32(&mdok, recipe, "PIXEL.SCALE");     assert (mdok);
-	float skyMags = psMetadataLookupF32(&mdok, recipe, "SKY.MAGS");  assert (mdok);
+        float zp      = psMetadataLookupF32(&mdok, recipe, "ZEROPOINT"); assert (mdok);
+        float scale   = psMetadataLookupF32(&mdok, recipe, "PIXEL.SCALE");     assert (mdok);
+        float skyMags = psMetadataLookupF32(&mdok, recipe, "SKY.MAGS");  assert (mdok);
         skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
     }
@@ -75,5 +75,5 @@
     FILE *outfile = fopen (outname, "w");
 
-    // add sources to the readout image & weight
+    // add sources to the readout image & variance
     psTrace("ppSim", 1, "Inserting %ld stars...\n", stars->n);
     for (long i = 0; i < stars->n; i++) {
@@ -118,5 +118,5 @@
         psF64 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
+        // 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;
@@ -132,5 +132,5 @@
         // Blow away the image parts of the source, which makes the memory explode
         RESET(source->pixels);
-        RESET(source->weight);
+        RESET(source->variance);
         RESET(source->maskObj);
         RESET(source->maskView);
Index: /branches/pap_branch_20090128/ppSim/src/ppSimLoadForceSources.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimLoadForceSources.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimLoadForceSources.c	(revision 21230)
@@ -56,17 +56,17 @@
     // Select the spots within range of this readout.  Project the spots to this chip
     for (int i = 0; i < spots->n; i++) {
-	pmAstromObj *obj = spots->data[i];
+        pmAstromObj *obj = spots->data[i];
 
-	psProject (obj->TP, obj->sky, fpa->toSky);
-	psPlaneTransformApply (obj->FP, fpa->fromTPA, obj->TP);
-	psPlaneTransformApply (obj->chip, chip->fromFPA, obj->FP);
+        psProject (obj->TP, obj->sky, fpa->toSky);
+        psPlaneTransformApply (obj->FP, fpa->fromTPA, obj->TP);
+        psPlaneTransformApply (obj->chip, chip->fromFPA, obj->FP);
 
-	// limit the X,Y range of the objs to the selected chip
-	if (obj->chip->x < minX) continue;
-	if (obj->chip->x > maxX) continue;
-	if (obj->chip->y < minY) continue;
-	if (obj->chip->y > maxY) continue;
+        // limit the X,Y range of the objs to the selected chip
+        if (obj->chip->x < minX) continue;
+        if (obj->chip->x > maxX) continue;
+        if (obj->chip->y < minY) continue;
+        if (obj->chip->y > maxY) continue;
 
-	// convert the pmAstromObj to pmSource
+        // convert the pmAstromObj to pmSource
 
         // instantiate a model for the PSF at this location, Io = 1.0
@@ -74,8 +74,8 @@
 
         // XXX let the flux limit be a user-defined number of sky sigmas (not just 1.0)
-	// XXX use a fixed radius??
+        // XXX use a fixed radius??
         // float radius = model->modelRadius (model->params, roughNoise);
         // radius = PS_MAX (radius, 1.0);
-	float radius = 5.0;
+        float radius = 5.0;
 
         // construct a source, with model flux pixels set, based on the model
@@ -87,10 +87,10 @@
         // psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
 
-	// these are not really needed since we will be fitting for them
+        // these are not really needed since we will be fitting for them
         source->psfMag = NAN;
         source->errMag = NAN;
 
         // insert the source flux in the image
-	// XXX not sure the offset is really 0,0
+        // XXX not sure the offset is really 0,0
         pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, 0.0, 0.0);
         pmSourceAddWithOffset (source, PM_MODEL_OP_FULL | PM_MODEL_OP_NOISE, 0xff, 0.0, 0.0);
@@ -98,5 +98,5 @@
         // Blow away the image parts of the source, which makes the memory explode
         RESET(source->pixels);
-        RESET(source->weight);
+        RESET(source->variance);
         RESET(source->maskObj);
         RESET(source->maskView);
@@ -105,5 +105,5 @@
         RESET(source->blends);
 
-	psArrayAdd (sources, 100, source);
+        psArrayAdd (sources, 100, source);
         psFree(source);                 // Drop local reference
     }
Index: /branches/pap_branch_20090128/ppSim/src/ppSimLoop.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimLoop.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimLoop.c	(revision 21230)
@@ -34,14 +34,14 @@
     psArray *galaxies = psArrayAllocEmpty (1);
     if (type == PPSIM_TYPE_OBJECT) {
-	// Load forced-photometry positions (these are placed on fpa->analysis for use in ppSimPhotomReadout)
-	if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
-
-	// Load catalogue stars
+        // Load forced-photometry positions (these are placed on fpa->analysis for use in ppSimPhotomReadout)
+        if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
+
+        // Load catalogue stars
         if (!ppSimLoadStars (stars, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load catalog stars");
 
-	// Add random stars
+        // Add random stars
         if (!ppSimMakeStars (stars, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random stars");
 
-	// Add random galaxies
+        // Add random galaxies
         if (!ppSimMakeGalaxies (galaxies, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random galaxies");
     }
@@ -105,8 +105,8 @@
                 // TO DO: Decide if cell is to be windowed, reduce numCols, numRows appropriately
                 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Signal in pixels
-                readout->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels
+                readout->variance = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels
 
                 psImageInit (readout->image, 0.0);
-                psImageInit (readout->weight, 0.0);
+                psImageInit (readout->variance, 0.0);
 
                 psFree(readout);        // Drop reference
@@ -115,12 +115,12 @@
             psVector *biasCols = ppSimMakeBiassec (cell, config);
 
-	    pmReadout *readout;
-	    while ((readout = pmFPAviewNextReadout (view, fpa, 1))) {
-
-                // if we have not read in a weight or generated a fake image above, we need to
+            pmReadout *readout;
+            while ((readout = pmFPAviewNextReadout (view, fpa, 1))) {
+
+                // if we have not read in a variance or generated a fake image above, we need to
                 // build one here
-                if (!readout->weight) {
-                    if (!pmReadoutGenerateWeight(readout, true)) {
-                        psError (PS_ERR_UNKNOWN, false, "trouble creating weight");
+                if (!readout->variance) {
+                    if (!pmReadoutGenerateVariance(readout, true)) {
+                        psError (PS_ERR_UNKNOWN, false, "trouble creating variance");
                         return false;
                     }
@@ -133,8 +133,8 @@
 
                 psVector *biasRows = ppSimMakeBias (&status, readout, config, rng);
-		if (!status) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
+                if (!status) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
                 if (type == PPSIM_TYPE_BIAS) goto done;
 
-		if (!ppSimMakeDark (readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
+                if (!ppSimMakeDark (readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");
                 if (type == PPSIM_TYPE_DARK) goto done;
 
@@ -153,5 +153,5 @@
 
             done:
-                if (!ppSimAddNoise(readout->image, readout->weight, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise");
+                if (!ppSimAddNoise(readout->image, readout->variance, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise");
                 if (!ppSimSaturate(readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem setting saturation levels");
 
@@ -165,6 +165,6 @@
                 readout->parent->parent->data_exists = true;
 
-		// if there is an input image, merge it with the simulated image
-		if (!ppSimMergeReadouts (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem merging input image with simulated image");
+                // if there is an input image, merge it with the simulated image
+                if (!ppSimMergeReadouts (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem merging input image with simulated image");
             }
             psFree(biasCols);
@@ -173,5 +173,5 @@
 
             if (cell->hdu) {
-		// XXX only do this if there is no INPUT image?
+                // XXX only do this if there is no INPUT image?
                 if (!ppSimInitHeader(config, NULL, NULL, cell)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");
             }
@@ -186,13 +186,13 @@
         }
 
-	// XXX why no UpdateConceptsChip??
+        // XXX why no UpdateConceptsChip??
 
         if (chip->hdu) {
-	    // XXX only do this if there is no INPUT image
+            // XXX only do this if there is no INPUT image
             if (!ppSimInitHeader(config, NULL, chip, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");
         }
 
         // we perform photometry on the readouts of this chip in the output
-	if (!ppSimPhotom (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem performing photometry");
+        if (!ppSimPhotom (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem performing photometry");
 
         if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
Index: /branches/pap_branch_20090128/ppSim/src/ppSimMakeBias.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimMakeBias.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimMakeBias.c	(revision 21230)
@@ -20,15 +20,15 @@
     float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e
     if (isnan(readnoise)) {
-	psWarning("CELL.READNOISE is not set; reverting to recipe value READNOISE.");
-	readnoise = psMetadataLookupF32(&mdok, recipe, "READNOISE");
-	if (!mdok) {
-	    psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find READNOISE in recipe.");
-	    *status = false;
-	    return NULL;
-	}
+        psWarning("CELL.READNOISE is not set; reverting to recipe value READNOISE.");
+        readnoise = psMetadataLookupF32(&mdok, recipe, "READNOISE");
+        if (!mdok) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find READNOISE in recipe.");
+            *status = false;
+            return NULL;
+        }
     }
 
     psImage *signal = readout->image;
-    psImage *variance = readout->weight;
+    psImage *variance = readout->variance;
 
     int numRows = signal->numRows;
@@ -38,5 +38,5 @@
     psPolynomial1D *biasPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, biasOrder);
     for (int j = 0; j < biasOrder + 1; j++) {
-	biasPoly->coeff[j] = biasRange * psRandomGaussian(rng);
+        biasPoly->coeff[j] = biasRange * psRandomGaussian(rng);
     }
 
@@ -45,15 +45,15 @@
 
     for (int y = 0; y < numRows; y++) {
-	// Adjust bias level for this row
-	biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) /
-						  (float)numRows - 0.5) + biasLevel;
+        // Adjust bias level for this row
+        biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) /
+                                                  (float)numRows - 0.5) + biasLevel;
 
-	for (int x = 0; x < numCols; x++) {
+        for (int x = 0; x < numCols; x++) {
 
-	    // Bias level
-	    signal->data.F32[y][x] += biasRows->data.F32[y];
-	    variance->data.F32[y][x] += PS_SQR(readnoise);
+            // Bias level
+            signal->data.F32[y][x] += biasRows->data.F32[y];
+            variance->data.F32[y][x] += PS_SQR(readnoise);
 
-	}
+        }
     }
     psFree(biasPoly);
Index: /branches/pap_branch_20090128/ppSim/src/ppSimMakeDark.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimMakeDark.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimMakeDark.c	(revision 21230)
@@ -7,5 +7,5 @@
 
     psImage *signal = readout->image;
-    psImage *variance = readout->weight;
+    psImage *variance = readout->variance;
 
     psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSIM_RECIPE); // Recipe
@@ -29,11 +29,11 @@
 
     for (int y = 0; y < signal->numRows; y++) {
-	for (int x = 0; x < signal->numCols; x++) {
-			
-	    // Dark current
-	    float darkCurrent = darkRate * expTime; // Dark current accumulated
-	    signal->data.F32[y][x] += darkCurrent;
-	    variance->data.F32[y][x] += darkCurrent;
-	}
+        for (int x = 0; x < signal->numCols; x++) {
+
+            // Dark current
+            float darkCurrent = darkRate * expTime; // Dark current accumulated
+            signal->data.F32[y][x] += darkCurrent;
+            variance->data.F32[y][x] += darkCurrent;
+        }
     }
     return true;
Index: /branches/pap_branch_20090128/ppSim/src/ppSimMakeSky.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimMakeSky.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimMakeSky.c	(revision 21230)
@@ -9,5 +9,5 @@
 
     psImage *signal = readout->image;
-    psImage *variance = readout->weight;
+    psImage *variance = readout->variance;
 
     pmCell *cell = readout->parent;
@@ -19,5 +19,5 @@
     bool sky  = psMetadataLookupBool(&status, recipe, "SKY"); // Generate a SKY flux?
     bool flat = psMetadataLookupBool(&status, recipe, "FLAT"); // Apply flat-field term?
- 
+
     float expTime      = psMetadataLookupF32(&status, recipe, "EXPTIME"); // Exposure time
 
@@ -29,7 +29,7 @@
     float skyMags      = psMetadataLookupF32(&status, recipe, "SKY.MAGS");  assert (status);
     if (!isnan(skyMags)) {
-	float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
-	float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
-	skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
+        float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
+        float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
+        skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
     }
     if (type == PPSIM_TYPE_FLAT) {
@@ -37,11 +37,11 @@
     }
 
-    int x0Chip 	      = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0");
-    int y0Chip 	      = psMetadataLookupS32(&status, chip->concepts, "CHIP.Y0");
+    int x0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0");
+    int y0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.Y0");
     int xParityChip   = psMetadataLookupS32(&status, chip->concepts, "CHIP.XPARITY");
     int yParityChip   = psMetadataLookupS32(&status, chip->concepts, "CHIP.YPARITY");
 
-    int x0Cell 	      = psMetadataLookupS32(&status, cell->concepts, "CELL.X0");
-    int y0Cell 	      = psMetadataLookupS32(&status, cell->concepts, "CELL.Y0");
+    int x0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.X0");
+    int y0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.Y0");
     int xParityCell   = psMetadataLookupS32(&status, cell->concepts, "CELL.XPARITY");
     int yParityCell   = psMetadataLookupS32(&status, cell->concepts, "CELL.YPARITY");
@@ -72,28 +72,28 @@
             // Gaussian flat-field over the FPA with flatValue = 1.0 at the field center
             float flatValue = 1.0;
-	    if (flat) {
-		// we make the flat-field have a response of 1.0 at the field center (like a vignetting)
-		flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA)));
-	    }
+            if (flat) {
+                // we make the flat-field have a response of 1.0 at the field center (like a vignetting)
+                flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA)));
+            }
 
-	    float scatterRate = 0.0;
+            float scatterRate = 0.0;
 
-	    if (sky) {
-	      // add a scattered light term to the flat-field images
-	      if (type == PPSIM_TYPE_FLAT) {
-		  scatterRate = scatterFrac * PS_SQR(xFPA);
-	      }
+            if (sky) {
+              // add a scattered light term to the flat-field images
+              if (type == PPSIM_TYPE_FLAT) {
+                  scatterRate = scatterFrac * PS_SQR(xFPA);
+              }
 
-	      // Sky background
-	      float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
-	      signal->data.F32[y][x] += skyFlux;
-	      variance->data.F32[y][x] += skyFlux;
-	    }
+              // Sky background
+              float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
+              signal->data.F32[y][x] += skyFlux;
+              variance->data.F32[y][x] += skyFlux;
+            }
 
-	    // used later to modify the star and galaxy photometry 
-	    if (expCorr) {
-		// exposure correction is (effective exposure time) * (flatValue)
-	      expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
-	    }
+            // used later to modify the star and galaxy photometry
+            if (expCorr) {
+                // exposure correction is (effective exposure time) * (flatValue)
+              expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
+            }
 
             // TO DO: Add fringes
Index: /branches/pap_branch_20090128/ppSim/src/ppSimMergeReadouts.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimMergeReadouts.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimMergeReadouts.c	(revision 21230)
@@ -14,8 +14,8 @@
     if (!inReadout) return true;
 
-    if (!inReadout->weight) {
-      if (!pmReadoutGenerateWeight(inReadout, true)) {
-	psError (PS_ERR_UNKNOWN, false, "trouble creating weight");
-	return false;
+    if (!inReadout->variance) {
+      if (!pmReadoutGenerateVariance(inReadout, true)) {
+        psError (PS_ERR_UNKNOWN, false, "trouble creating variance");
+        return false;
       }
     }
@@ -30,8 +30,8 @@
 
     psImage *inSignal = inReadout->image;
-    psImage *inVariance = inReadout->weight;
+    psImage *inVariance = inReadout->variance;
 
     psImage *outSignal = outReadout->image;
-    psImage *outVariance = outReadout->weight;
+    psImage *outVariance = outReadout->variance;
 
     assert (inSignal->numRows == outSignal->numRows);
@@ -39,8 +39,8 @@
 
     for (int y = 0; y < inSignal->numRows; y++) {
-	for (int x = 0; x < inSignal->numCols; x++) {
-	    outSignal->data.F32[y][x] += inSignal->data.F32[y][x];
-	    outVariance->data.F32[y][x] += inVariance->data.F32[y][x];
-	}
+        for (int x = 0; x < inSignal->numCols; x++) {
+            outSignal->data.F32[y][x] += inSignal->data.F32[y][x];
+            outVariance->data.F32[y][x] += inVariance->data.F32[y][x];
+        }
     }
     return true;
Index: /branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutFake.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutFake.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutFake.c	(revision 21230)
@@ -12,5 +12,5 @@
     }
 
-# if 0    
+# if 0
     // set the photcode for this image
     if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {
@@ -22,5 +22,5 @@
     // *** in this section, perform the photometry for real + fake sources on PPSIM.FAKE.CHIP ***
 
-    // find the currently selected readout. 
+    // find the currently selected readout.
     // we always perform photometry on the mosaiced chip
     pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PPSIM.FAKE.CHIP");
@@ -35,6 +35,6 @@
     PS_ASSERT_PTR_NON_NULL (injectedSources, false);
 
-    // Generate the mask and weight images, including the user-defined analysis region of interest
-    psphotSetMaskAndWeight (config, readout, recipe);
+    // Generate the mask and variance images, including the user-defined analysis region of interest
+    psphotSetMaskAndVariance (config, readout, recipe);
 
     // XXX need to define the source pixels
@@ -53,13 +53,13 @@
     psArray *realSources = psArrayAlloc (realMeasuredSources->n);
     for (int i = 0; i < realMeasuredSources->n; i++) {
-	realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
+        realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
     }
 
     // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are saved in the recipe
-    // this function uses PSPHOT.PSF.LOAD as the pmFPAfile 
+    // this function uses PSPHOT.PSF.LOAD as the pmFPAfile
     pmPSF *psf = psphotLoadPSF (config, view, recipe);
     assert (psf);
 
-    // remove all sources 
+    // remove all sources
     psphotRemoveAllSources (realSources, recipe);
 
@@ -76,5 +76,5 @@
 
     // XXX fake sources should measure peak->x,y, force sources should not
-    psMaskType maskVal = 0xff; 
+    psMaskType maskVal = 0xff;
     psImage *significance = psphotSignificanceImage (readout, recipe, 1, maskVal);
     ppSimDetections (significance, recipe, fakeSources);
@@ -90,5 +90,5 @@
     psphotGuessModels (config, readout, realSources, psf);
     psphotGuessModels (config, readout, fakeSources, psf);
-    
+
     // linear fit to real + fake sources
     psArray *sources = ppSimMergeSources (realSources, fakeSources);
@@ -98,5 +98,5 @@
 
     // calculate source magnitudes (for which set??)
-    psphotMagnitudes(config, view, fakeSources, recipe, psf);
+    psphotMagnitudes(config, readout, view, fakeSources, psf);
 
     // drop the references to the image pixels held by each source
@@ -113,6 +113,6 @@
     pmReadout *fakeReadout = pmFPAfileThisReadout (config->files, view, "PPSIM.FAKE.SOURCES");
     if (!fakeReadout) {
-	fakeReadout = pmReadoutAlloc (fakeCell);
-	psFree (fakeReadout); // there is a copy on 'cell' as well
+        fakeReadout = pmReadoutAlloc (fakeCell);
+        psFree (fakeReadout); // there is a copy on 'cell' as well
     }
     psAssert (fakeReadout, "no fakeReadout?");
Index: /branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutForce.c
===================================================================
--- /branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutForce.c	(revision 21229)
+++ /branches/pap_branch_20090128/ppSim/src/ppSimPhotomReadoutForce.c	(revision 21230)
@@ -12,5 +12,5 @@
     }
 
-# if 0    
+# if 0
     // set the photcode for this image
     if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {
@@ -22,5 +22,5 @@
     // *** in this section, perform the photometry for real + force sources on PPSIM.FORCE.CHIP ***
 
-    // find the currently selected readout. 
+    // find the currently selected readout.
     // we always perform photometry on the mosaiced chip
     pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PPSIM.FORCE.CHIP");
@@ -35,6 +35,6 @@
     psAssert (forceSources, "failed to load force photometry sources");
 
-    // Generate the mask and weight images, including the user-defined analysis region of interest
-    psphotSetMaskAndWeight (config, readout, recipe);
+    // Generate the mask and variance images, including the user-defined analysis region of interest
+    psphotSetMaskAndVariance (config, readout, recipe);
 
     // XXX need to define the source pixels
@@ -46,13 +46,13 @@
     psArray *realSources = psArrayAlloc (realMeasuredSources->n);
     for (int i = 0; i < realMeasuredSources->n; i++) {
-	realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
+        realSources->data[i] = pmSourceCopy (realMeasuredSources->data[i]);
     }
 
     // load the psf model, if suppled.  FWHM_X,FWHM_Y,etc are saved in the recipe
-    // this function uses PSPHOT.PSF.LOAD as the pmFPAfile 
+    // this function uses PSPHOT.PSF.LOAD as the pmFPAfile
     pmPSF *psf = psphotLoadPSF (config, view, recipe);
     assert (psf);
 
-    // remove all sources 
+    // remove all sources
     psphotRemoveAllSources (realSources, recipe);
 
@@ -69,5 +69,5 @@
 
     // XXX fake sources should measure peak->x,y, force sources should not
-    psMaskType maskVal = 0xff; 
+    psMaskType maskVal = 0xff;
     psImage *significance = psphotSignificanceImage (readout, recipe, 1, maskVal);
     ppSimDetections (significance, recipe, forceSources);
@@ -83,5 +83,5 @@
     psphotGuessModels (config, readout, realSources, psf);
     psphotGuessModels (config, readout, forceSources, psf);
-    
+
     // linear fit to real + force sources
     psArray *sources = ppSimMergeSources (realSources, forceSources);
@@ -91,5 +91,5 @@
 
     // calculate source magnitudes (for which set??)
-    psphotMagnitudes(config, view, forceSources, recipe, psf);
+    psphotMagnitudes(config, readout, view, forceSources, psf);
 
     // drop the references to the image pixels held by each source
@@ -106,6 +106,6 @@
     pmReadout *forceReadout = pmFPAfileThisReadout (config->files, view, "PPSIM.FORCE.SOURCES");
     if (!forceReadout) {
-	forceReadout = pmReadoutAlloc (forceCell);
-	psFree (forceReadout); // there is a copy on 'cell' as well
+        forceReadout = pmReadoutAlloc (forceCell);
+        psFree (forceReadout); // there is a copy on 'cell' as well
     }
     psAssert (forceReadout, "no forceReadout?");
