Index: trunk/ppMerge/src/ppMergeCombine.c
===================================================================
--- trunk/ppMerge/src/ppMergeCombine.c	(revision 9824)
+++ trunk/ppMerge/src/ppMergeCombine.c	(revision 9832)
@@ -214,10 +214,13 @@
                             }
                             numRead++;
+                        } else {
+                            psTrace("ppMerge", 3, "Unable to read from file %d for chip %d, "
+                                    "cell %d, scan %d\n", i, view->chip, view->cell, numScan);
                         }
                     }
 
+                    psTrace("ppMerge", 5, "Chip %d, cell %d, scan %d\n", view->chip, view->cell, numScan);
                     if (numRead > 0) {
                         pmReadoutCombine(readout, stack, cellZeros, cellScales, options->combine);
-                        psTrace("ppMerge", 5, "Chip %d, cell %d, scan %d\n", view->chip, view->cell, numScan);
                     }
                     numScan++;
@@ -259,5 +262,4 @@
             }
 
-            psFree(readout);            // Drop reference
             psFree(stack);
 
@@ -270,4 +272,37 @@
             }
 
+            // Measure the fringes for this cell
+            //
+            // XXX Need to deal with multiple components: we will do this by building up the components
+            // Read the existing fringe measurements
+            // Use existing regions to measure fringe statistics
+            // Add the new fringe measurements to the existing fringe measurements.
+            // Write the appended fringe measurements.
+            // Read in the "output" file to get the existing components.
+            // Put the new readout into the cell after the existing readouts.
+            if (options->fringe && readout->image) {
+                pmFringeRegions *regions = pmFringeRegionsAlloc(options->fringeNum, options->fringeSize,
+                                                                options->fringeSize, options->fringeSmoothX,
+                                                                options->fringeSmoothY); // Fringe regions
+                pmFringeStats *fringe = pmFringeStatsMeasure(regions, readout, options->combine->maskVal);
+                psFree(regions);
+
+                psArray *fringes = psArrayAlloc(1); // Array of fringes
+                fringes->data[0] = fringe;
+
+                const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of chip
+                const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell
+                psString extname = NULL;
+                psStringAppend(&extname, "FRINGE_%s_%s", chipName, cellName);
+
+                if (!pmFringesWriteFits(data->outFile, NULL, fringes, extname)) {
+                    psWarning("Unable to write fringe data to extension %s\n", extname);
+                }
+
+                psFree(fringes);
+                psFree(extname);
+            }
+
+            psFree(readout);            // Drop reference
 
             // Statistics on the merged cell
