Index: trunk/ppMerge/src/ppMergeCell.c
===================================================================
--- trunk/ppMerge/src/ppMergeCell.c	(revision 5860)
+++ trunk/ppMerge/src/ppMergeCell.c	(revision 5862)
@@ -1,6 +1,3 @@
 # include "ppMerge.h"
-
-// mask, bias, dark, flat are defined per Cell
-// pedestal is constructed for each readout, which may have different exposure times
 
 pmReadout *ppDetrendSelectFirst (pmCell *cell, char *name, bool doThis) {
@@ -19,27 +16,59 @@
 }
 
-bool ppMergeCell (psArray *cellList, pmCell *maskCell, ppOptions *options, ppConfig *config) {
+bool ppMergeCell (pmCell *outputCell, pmCell *maskCell, psArray *cellList, ppOptions *options, ppConfig *config) {
 
     pmCell *sample = cellList->data[0];
-    pmReadout *mask   = ppDetrendSelectFirst (maskCell, "mask", options->doMask);
+    // pmReadout *mask = ppDetrendSelectFirst (maskCell, "mask", options->doMask);
+
+    // list to carry readouts for processing
+    psArray *inputs = psArrayAlloc (cellList->n);
+    inputs->n = 0;
+
+    psVector *combineZero = psVectorAlloc (128, PS_TYPE_F32);
+    combineZero->n = 0;
+
+    psVector *combineScale = psVectorAlloc (128, PS_TYPE_F32);
+    combineScale->n = 0;
+
+    int nVal = 0;
 
     // push all readouts from each image onto the list
     // not clear that this is the right process -- how to merge readouts?
     // are all readouts from this cell equivalent? (ie, across images?)
-    // XXX need to set / carry the zero,scale values
-
-    readouts = psListAlloc ();
-
+    // XXX need to set the zero,scale values correctly for each readout
     for (int i = 0; i < cellList->n; i++) {
 	pmCell *cell = cellList->data[i];
 	for (int j = 0; j < cell->readouts->n; j++) {
-	    psListAdd (cell->readouts->data[j], PS_LIST_TAIL);
+	    psArrayAdd (inputs, 16, cell->readouts->data[j]);
+
+	    combineZero->data.F32[nVal] = 0.0;
+	    combineScale->data.F32[nVal] = 1.0;
+	    psVectorExtend (combineZero, 100, 1);
+	    psVectorExtend (combineScale, 100, 1);
+	    nVal ++;
 	}
     }
 
-    // XXX : need to consider the output
-    
-    psImage *output = pmReadoutCombine (NULL, readouts, params,...);
+    // XXX : need to assign these correctly
+    float combineGain = 1.0;
+    float combineNoise = 0.0;
 
+    // XXX somehow need to transfer the input cell concepts to the 
+    //     the output cell.  this is weak: are the concepts fixed 
+    //     or not for a collection of images...
+    outputCell->concepts = sample->concepts;
+
+    // XXX where is the output readouts array allocated?
+    pmReadout *outputReadout = pmReadoutAlloc (outputCell);
+    outputReadout->image = pmReadoutCombine (NULL, inputs, 
+					     combineZero, 
+					     combineScale, 
+					     options->combineParams, 
+					     options->applyZeroScale,
+					     combineGain, combineNoise);
     return true;
 }
+
+
+// XXX a psList does not make sense here: we are using the fixed length psVectors
+//     to carry bzero and bscale, a psArray should be used for the images
