Index: /tags/ipp-20101215/ppImage/src/ppImageAddNoise.c
===================================================================
--- /tags/ipp-20101215/ppImage/src/ppImageAddNoise.c	(revision 30626)
+++ /tags/ipp-20101215/ppImage/src/ppImageAddNoise.c	(revision 30627)
@@ -22,5 +22,5 @@
   static float add_sigmas[] = {NAN, 13.39, 23.79, 75.25, 110.19, 128.84};
   
-  // Exposure times for 3pi in grizy
+  // Target Exposure times for 3pi in grizy
   static float expTimes3Pi[] = {NAN, 43.0, 40.0, 45.0, 30.0, 30.0}; 
   float expTime   = psMetadataLookupF32(NULL, fpa->concepts, "FPA.EXPOSURE"); // Exposure time for image
@@ -54,4 +54,5 @@
   // find the currently selected readout
   psImage *image = inReadout->image;
+  psImage *variance = inReadout->variance;
   
   // Warning, just in case this is left on accidently!
@@ -68,9 +69,11 @@
       image->data.F32[iy][ix] += ppImageRandomGaussian(rng, 0.0, add_sigmas[band]);
       image->data.F32[iy][ix] /= expTimeScaling;
+      variance->data.F32[iy][ix] += PS_SQR(add_sigmas[band]);
+      variance->data.F32[iy][ix] /= expTimeScaling;
     }
   }
 	  
   // Update the metadata about exposure time
-  psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]);
+  psMetadataAddF32(inReadout->parent->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]);
   psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "EXPTIME", PS_META_REPLACE, "the modified exposure time", expTimes3Pi[band]);
   ppImageRandomGaussianFree();
Index: /tags/ipp-20101215/ppImage/src/ppImageLoop.c
===================================================================
--- /tags/ipp-20101215/ppImage/src/ppImageLoop.c	(revision 30626)
+++ /tags/ipp-20101215/ppImage/src/ppImageLoop.c	(revision 30627)
@@ -110,23 +110,24 @@
                     ESCAPE("Unable to set bit masks");
                 }
+
+                // perform the detrend analysis
+                if (!ppImageDetrendReadout(config, options, view)) {
+                    ESCAPE("Unable to detrend readout");
+                }
+
+                // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT
+                if (!ppImageDetrendFree (config, view)) {
+                    ESCAPE("Unable to free detrend images");
+                }
+
+                // optionally measure CTE by examining the variance in a box
+                if (!ppImageCheckCTE (config, options, view)) {
+                    ESCAPE("Unable to measure CTE");
+                }
+
 		// optionally degrade a MD image to 3pi exposure times
 		if (!ppImageAddNoise(config, options, view, input->fpa)){
                     ESCAPE("Unable to degrade MD image to 3pi");
 		}
-
-                // perform the detrend analysis
-                if (!ppImageDetrendReadout(config, options, view)) {
-                    ESCAPE("Unable to detrend readout");
-                }
-
-                // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT
-                if (!ppImageDetrendFree (config, view)) {
-                    ESCAPE("Unable to free detrend images");
-                }
-
-                // optionally measure CTE by examining the variance in a box
-                if (!ppImageCheckCTE (config, options, view)) {
-                    ESCAPE("Unable to measure CTE");
-                }
             }
 
