Index: trunk/psModules/src/camera/Makefile.am
===================================================================
--- trunk/psModules/src/camera/Makefile.am	(revision 13897)
+++ trunk/psModules/src/camera/Makefile.am	(revision 13898)
@@ -26,5 +26,6 @@
 	pmFPALevel.c \
 	pmFPAExtent.c \
-	pmCellSquish.c
+	pmCellSquish.c \
+	pmReadoutStack.c
 
 pkginclude_HEADERS = \
@@ -51,5 +52,6 @@
 	pmFPALevel.h \
 	pmFPAExtent.h \
-	pmCellSquish.h
+	pmCellSquish.h \
+	pmReadoutStack.h
 
 CLEANFILES = *~
Index: trunk/psModules/src/camera/pmFPAMosaic.c
===================================================================
--- trunk/psModules/src/camera/pmFPAMosaic.c	(revision 13897)
+++ trunk/psModules/src/camera/pmFPAMosaic.c	(revision 13898)
@@ -22,4 +22,9 @@
 
 #define CELL_LIST_BUFFER 10             // Buffer size for cell lists
+
+#define BLANK_VALUE 0.0                 // Value for pixels that are blank in the mosaicked image (e.g., //
+                                        // between cells).
+                                        // XXX This should ultimately be set to NAN, but psphot doesn't like
+                                        // that (masking needs to be more thorough).
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -397,5 +402,5 @@
                     for (int x = 0; x < image->numCols; x++) { \
                         int xTarget = xTargetBase + xParity * x; \
-                        mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \
+                        mosaic->data.TYPE[yTarget][xTarget] = image->data.TYPE[y][x]; \
                     } \
                 } \
@@ -416,5 +421,5 @@
                         for (int k = 0; k < xBinSource->data.S32[i]; k++) { \
                             int xTarget = (int)(xTargetBinBase + xParity * (float)k / (float)xBinTarget); \
-                            mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \
+                            mosaic->data.TYPE[yTarget][xTarget] = image->data.TYPE[y][x]; \
                         } \
                     } \
@@ -504,5 +509,5 @@
     psTrace("psModules.camera", 3, "Spliced image will be %dx%d\n", (int)xSize, (int)ySize);
     psImage *mosaic = psImageAlloc((int)xSize, (int)ySize, type); // The mosaic image
-    psImageInit(mosaic, 0);
+    psImageInit(mosaic, unexposed);
 
     // Next pass through the images to do the mosaicking
@@ -524,5 +529,5 @@
             (yFlip->data.U8[i] == 0)) {
             // Let someone else do the hard work
-            psImageOverlaySection(mosaic, image, xTargetBase, yTargetBase, "+");
+            psImageOverlaySection(mosaic, image, xTargetBase, yTargetBase, "=");
             continue;
         }
@@ -723,5 +728,6 @@
                        int *xBinChip, int *yBinChip, // The binning in x and y, to be returned
                        const pmChip *chip, // Chip to mosaic
-                       const pmCell *targetCell // Cell to which to mosaic
+                       const pmCell *targetCell, // Cell to which to mosaic
+                       psMaskType blank // Mask value to give blank pixels
                       )
 {
@@ -804,7 +810,7 @@
     // Mosaic the images together and we're done
     if (allGood) {
-        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, NAN);
-        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, NAN);
-        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, 0xff);
+        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
+        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
+        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, blank);
     }
 
@@ -830,5 +836,6 @@
                       const pmFPA *fpa,  // FPA to mosaic
                       const pmChip *targetChip, // Chip to which to mosaic
-                      const pmCell *targetCell // Cell to which to mosaic
+                      const pmCell *targetCell, // Cell to which to mosaic
+                      psMaskType blank  // Mask value to give blank pixels
                      )
 {
@@ -937,7 +944,7 @@
     // Mosaic the images together and we're done
     if (allGood) {
-        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, NAN);
-        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, NAN);
-        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, 0xff);
+        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
+        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
+        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, blank);
     }
 
@@ -986,5 +993,5 @@
 // the mosaic image.
 
-bool pmChipMosaic(pmChip *target, const pmChip *source, bool deepCopy)
+bool pmChipMosaic(pmChip *target, const pmChip *source, bool deepCopy, psMaskType blank)
 {
     // Target exists, and has only a single cell
@@ -1039,5 +1046,5 @@
         // Case 2 --- we need to mosaic by cut and paste
         psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n");
-        if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source, targetCell)) {
+        if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source, targetCell, blank)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to mosaic cells.\n");
             return false;
@@ -1217,5 +1224,5 @@
 
 
-bool pmFPAMosaic(pmFPA *target, const pmFPA *source, bool deepCopy)
+bool pmFPAMosaic(pmFPA *target, const pmFPA *source, bool deepCopy, psMaskType blank)
 {
     // Target exists, and has only a single chip with single cell
@@ -1260,5 +1267,5 @@
         psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n");
         if (!fpaMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source,
-                       targetChip, targetCell)) {
+                       targetChip, targetCell, blank)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chips.\n");
             return false;
Index: trunk/psModules/src/camera/pmFPAMosaic.h
===================================================================
--- trunk/psModules/src/camera/pmFPAMosaic.h	(revision 13897)
+++ trunk/psModules/src/camera/pmFPAMosaic.h	(revision 13898)
@@ -4,6 +4,6 @@
  * @author Paul Price, IfA
  *
- * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-03-30 21:12:56 $
+ * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-06-20 02:22:26 $
  * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
  */
@@ -22,6 +22,7 @@
 /// the pixels, if possible.
 bool pmChipMosaic(pmChip *target,       ///< Target chip --- may contain only a single cell
-                  const pmChip *source,  ///< Source chip whose cells will be mosaicked
-		  bool deepCopy		///< require a deep copy (disregard 'nice' chip) 
+                  const pmChip *source, ///< Source chip whose cells will be mosaicked
+                  bool deepCopy,        ///< Require a deep copy (disregard 'nice' chip)
+                  psMaskType blank      ///< Mask value to give blank pixels
     );
 
@@ -32,8 +33,9 @@
 /// CELL.X0 and CELL.Y0 offsets.  This is useful for getting an image of the FPA on the sky.  The mosaicking
 /// is done so as to avoid performing a deep copy of the pixels, if possible.
-bool pmFPAMosaic(pmFPA *target,	///< Target FPA --- may contain only a single chip with a single cell
-                 const pmFPA *source,	///< FPA whose chips and cells will be mosaicked
-                 bool deepCopy		///< require a deep copy (disregard 'nice' chip) 
-                );			// 
+bool pmFPAMosaic(pmFPA *target, ///< Target FPA --- may contain only a single chip with a single cell
+                 const pmFPA *source,   ///< FPA whose chips and cells will be mosaicked
+                 bool deepCopy,         ///< Require a deep copy (disregard 'nice' chip)
+                 psMaskType blank       ///< Mask value to give blank pixels
+                );
 /// @}
 #endif
