Index: /branches/eam_branches/ipp-20211108/ppStack/src/ppStack.h
===================================================================
--- /branches/eam_branches/ipp-20211108/ppStack/src/ppStack.h	(revision 41909)
+++ /branches/eam_branches/ipp-20211108/ppStack/src/ppStack.h	(revision 41910)
@@ -121,4 +121,5 @@
 bool ppStackReadoutPercent(const pmConfig *config,
 			   pmReadout *outRO,
+			   pmReadout *expRO,
 			   const psArray *readouts,
 			   const psVector *mask,
Index: /branches/eam_branches/ipp-20211108/ppStack/src/ppStackReadout.c
===================================================================
--- /branches/eam_branches/ipp-20211108/ppStack/src/ppStackReadout.c	(revision 41909)
+++ /branches/eam_branches/ipp-20211108/ppStack/src/ppStackReadout.c	(revision 41910)
@@ -69,4 +69,5 @@
 
     pmReadout *outRO = options->outRO;  // Output readout
+    pmReadout *expRO = options->expRO;  // Expmap readout
     psVector *mask = options->inputMask; // Mask for inputs
     psVector *weightings = options->weightings; // Weightings (1/noise^2) for each image
@@ -76,5 +77,5 @@
     // fprintf (stderr, "start thread %d : scan range %d - %d\n", thread->entry, thread->firstScan, thread->lastScan);
 
-    bool status = ppStackReadoutPercent(config, outRO, thread->readouts, mask, weightings, exposures, addVariance);
+    bool status = ppStackReadoutPercent(config, outRO, expRO, thread->readouts, mask, weightings, exposures, addVariance);
 
     thread->busy = false;
@@ -361,5 +362,5 @@
 }
 
-bool ppStackReadoutPercent(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
+bool ppStackReadoutPercent(const pmConfig *config, pmReadout *outRO, pmReadout *expRO, const psArray *readouts,
 			       const psVector *mask, const psVector *weightings, const psVector *exposures,
 			       const psVector *addVariance)
@@ -367,4 +368,5 @@
     assert(config);
     assert(outRO);
+    assert(expRO);
     assert(readouts);
     assert(mask && mask->n == readouts->n && mask->type.type == PS_TYPE_VECTOR_MASK);
@@ -420,5 +422,5 @@
     // XXX rename minRange to rejectFraction
     // XXX add expmaps
-    if (!pmStackCombineByPercentile(outRO, NULL, stackData, minRange, maskBad, maskSuspect, maskBlank)) {
+    if (!pmStackCombineByPercentile(outRO, expRO, stackData, minRange, maskBad, maskSuspect, maskBlank)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
         psFree(stackData);
@@ -426,15 +428,11 @@
     }
 
-    outRO->data_exists = true; // output readout
-    outRO->parent->data_exists = true; // output cell
+    outRO->data_exists = true;		       // output readout
+    outRO->parent->data_exists = true;	       // output cell
     outRO->parent->parent->data_exists = true; // output chip
 
-# if 0
-      pmCell *expCell = expRO->parent;    // Exposure cell
-      pmChip *expChip = expCell->parent;  // Exposure chip
-      expRO->data_exists = true;
-      expCell->data_exists = true;
-      expChip->data_exists = true;
-# endif
+    expRO->data_exists = true;                 // expmap readout 
+    expRO->parent->data_exists = true;	       // expmap cell	
+    expRO->parent->parent->data_exists = true; // expmap chip	
 
     psFree(stackData);
