Index: trunk/ppSim/src/ppSimMakeSky.c
===================================================================
--- trunk/ppSim/src/ppSimMakeSky.c	(revision 20366)
+++ trunk/ppSim/src/ppSimMakeSky.c	(revision 21365)
@@ -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
