Index: trunk/psModules/src/imcombine/pmStack.c
===================================================================
--- trunk/psModules/src/imcombine/pmStack.c	(revision 14624)
+++ trunk/psModules/src/imcombine/pmStack.c	(revision 14625)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-08-10 00:34:04 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-08-23 02:24:58 $
  *
  *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
@@ -73,6 +73,5 @@
 static void stackDataFree(pmStackData *data)
 {
-    psFree(data->detector);
-    psFree(data->sky);
+    psFree(data->readout);
     psFree(data->pixels);
     return;
@@ -222,7 +221,7 @@
     for (int i = 0; i < num; i++) {
         pmStackData *data = inputs->data[i]; // Stack data of interest
-        psImage *image = data->sky->image; // Image of interest
-        psImage *weight = data->sky->weight; // Weight map of interest
-        psImage *mask = data->sky->mask; // Mask of interest
+        psImage *image = data->readout->image; // Image of interest
+        psImage *weight = data->readout->weight; // Weight map of interest
+        psImage *mask = data->readout->mask; // Mask of interest
         pixelData->data.F32[i] = image->data.F32[y][x];
         if (weight) {
@@ -306,7 +305,5 @@
 
 // Ensure the input array of pmStackData is valid, and get some details out of it
-static bool validateInputData(bool *haveDetector, // Do we have the detector images?
-                              bool *haveSky, // Do we have the sky images?
-                              bool *haveSkyWeights, // Do we have weights in the sky images?
+static bool validateInputData(bool *haveWeights, // Do we have weights in the sky images?
                               bool *havePixels, // Do we have lists of pixels?
                               int *num,    // Number of inputs
@@ -317,45 +314,31 @@
     PS_ASSERT_ARRAY_NON_NULL(input, false);
     *num = input->n;
-    {
-        pmStackData *data = input->data[0]; // First image off the rank
-        PS_ASSERT_PTR_NON_NULL(data, false);
-        assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
-        *haveDetector = (data->detector != NULL);
-        if (*haveDetector) {
-            PS_ASSERT_IMAGE_NON_NULL(data->detector->image, false);
-            PS_ASSERT_IMAGE_NON_NULL(data->detector->mask, false);
-            PS_ASSERT_IMAGES_SIZE_EQUAL(data->detector->image, data->detector->mask, false);
-            PS_ASSERT_IMAGE_TYPE(data->detector->image, PS_TYPE_F32, false);
-            PS_ASSERT_IMAGE_TYPE(data->detector->mask, PS_TYPE_MASK, false);
-        }
-        *haveSky = (data->sky != NULL);
-        *haveSkyWeights = false;
-        if (*haveSky) {
-            PS_ASSERT_IMAGE_NON_NULL(data->sky->image, false);
-            PS_ASSERT_IMAGE_TYPE(data->sky->image, PS_TYPE_F32, false);
-            PS_ASSERT_IMAGE_NON_NULL(data->sky->mask, false);
-            PS_ASSERT_IMAGE_TYPE(data->sky->mask, PS_TYPE_MASK, false);
-            PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->mask, false);
-            *numCols = data->sky->image->numCols;
-            *numRows = data->sky->image->numRows;
-            if (data->sky->weight) {
-                *haveSkyWeights = true;
-                PS_ASSERT_IMAGE_NON_NULL(data->sky->weight, false);
-                PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->weight, false);
-                PS_ASSERT_IMAGE_TYPE(data->sky->weight, PS_TYPE_F32, false);
-            }
-        }
-        *havePixels = (data->pixels != NULL);
-    }
+
+    // The first is a template
+    pmStackData *data = input->data[0]; // First image off the rank
+    PS_ASSERT_PTR_NON_NULL(data, false);
+    assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
+    *haveWeights = false;
+    PS_ASSERT_IMAGE_NON_NULL(data->readout->image, false);
+    PS_ASSERT_IMAGE_TYPE(data->readout->image, PS_TYPE_F32, false);
+    PS_ASSERT_IMAGE_NON_NULL(data->readout->mask, false);
+    PS_ASSERT_IMAGE_TYPE(data->readout->mask, PS_TYPE_MASK, false);
+    PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->mask, false);
+    *numCols = data->readout->image->numCols;
+    *numRows = data->readout->image->numRows;
+    if (data->readout->weight) {
+        *haveWeights = true;
+        PS_ASSERT_IMAGE_NON_NULL(data->readout->weight, false);
+        PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->weight, false);
+        PS_ASSERT_IMAGE_TYPE(data->readout->weight, PS_TYPE_F32, false);
+    }
+    *havePixels = (data->pixels != NULL);
+
+    // Make sure the rest correspond with the first
     for (int i = 1; i < *num; i++) {
         pmStackData *data = input->data[i]; // Stack data for this input
         assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
-        if ((*haveDetector && !data->detector) || (data->detector && !*haveDetector)) {
-            psError(PS_ERR_UNEXPECTED_NULL, true,
-                    "The detector readout is specified in some but not all inputs.");
-            return false;
-        }
-        if ((*haveSky && !data->sky) || (data->sky && !*haveSky)) {
-            psError(PS_ERR_UNEXPECTED_NULL, true, "The sky cell is specified in some but not all inputs.");
+        if (!data->readout) {
+            psError(PS_ERR_UNEXPECTED_NULL, true, "The readout is specified in some but not all inputs.");
             return false;
         }
@@ -364,23 +347,14 @@
             return false;
         }
-        if (*haveDetector) {
-            PS_ASSERT_IMAGE_NON_NULL(data->detector->image, false);
-            PS_ASSERT_IMAGE_NON_NULL(data->detector->mask, false);
-            PS_ASSERT_IMAGE_TYPE(data->detector->image, PS_TYPE_F32, false);
-            PS_ASSERT_IMAGE_TYPE(data->detector->mask, PS_TYPE_MASK, false);
-            PS_ASSERT_IMAGES_SIZE_EQUAL(data->detector->image, data->detector->mask, false);
-        }
-        if (*haveSky) {
-            PS_ASSERT_IMAGE_NON_NULL(data->sky->image, false);
-            PS_ASSERT_IMAGE_NON_NULL(data->sky->mask, false);
-            PS_ASSERT_IMAGE_TYPE(data->sky->image, PS_TYPE_F32, false);
-            PS_ASSERT_IMAGE_TYPE(data->sky->mask, PS_TYPE_MASK, false);
-            PS_ASSERT_IMAGE_SIZE(data->sky->image, *numCols, *numRows, false);
-            PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->mask, false);
-            if (*haveSkyWeights) {
-                PS_ASSERT_IMAGE_NON_NULL(data->sky->weight, false);
-                PS_ASSERT_IMAGES_SIZE_EQUAL(data->sky->image, data->sky->weight, false);
-                PS_ASSERT_IMAGE_TYPE(data->sky->weight, PS_TYPE_F32, false);
-            }
+        PS_ASSERT_IMAGE_NON_NULL(data->readout->image, false);
+        PS_ASSERT_IMAGE_NON_NULL(data->readout->mask, false);
+        PS_ASSERT_IMAGE_TYPE(data->readout->image, PS_TYPE_F32, false);
+        PS_ASSERT_IMAGE_TYPE(data->readout->mask, PS_TYPE_MASK, false);
+        PS_ASSERT_IMAGE_SIZE(data->readout->image, *numCols, *numRows, false);
+        PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->mask, false);
+        if (*haveWeights) {
+            PS_ASSERT_IMAGE_NON_NULL(data->readout->weight, false);
+            PS_ASSERT_IMAGES_SIZE_EQUAL(data->readout->image, data->readout->weight, false);
+            PS_ASSERT_IMAGE_TYPE(data->readout->weight, PS_TYPE_F32, false);
         }
     }
@@ -390,5 +364,5 @@
 
 
-
+#if 0
 // Examine a pixel carefully to see if it should be rejected in the stack by convolving all the input images
 // to the same seeing, and clipping there.
@@ -416,6 +390,6 @@
         pmStackData *data = input->data[i]; // Stacking data
         int radius = extent * seeing->data.F32[i]; // How much to convolve
-        psImage *image = data->sky->image; // Image to convolve
-        psImage *mask = data->sky->mask; // Image mask
+        psImage *image = data->readout->image; // Image to convolve
+        psImage *mask = data->readout->mask; // Image mask
 
         int xMin = PS_MAX(xPix - radius, 0);
@@ -476,5 +450,5 @@
     return true;
 }
-
+#endif
 
 
@@ -530,14 +504,11 @@
 
 /// Constructor
-pmStackData *pmStackDataAlloc(pmReadout *sky, float seeing, float weight)
+pmStackData *pmStackDataAlloc(pmReadout *readout, float weight)
 {
     pmStackData *data = psAlloc(sizeof(pmStackData)); // Stack data, to return
     psMemSetDeallocator(data, (psFreeFunc)stackDataFree);
 
-    data->detector = NULL;
-
-    data->sky = psMemIncrRefCounter(sky);
+    data->readout = psMemIncrRefCounter(readout);
     data->pixels = NULL;
-    data->seeing = seeing;
     data->weight = weight;
 
@@ -550,12 +521,9 @@
 {
     PS_ASSERT_PTR_NON_NULL(combined, false);
-    bool haveDetector;                  // Do we have the detector images?
-    bool haveSky;                       // Do we have the sky images?
-    bool haveSkyWeights;                // Do we have the sky weight maps?
+    bool haveWeights;                   // Do we have the weight maps?
     bool havePixels;                    // Do we have lists of pixels?
     int num;                            // Number of inputs
     int numCols, numRows;               // Size of (sky) images
-    if (!validateInputData(&haveDetector, &haveSky, &haveSkyWeights, &havePixels, &num,
-                           &numCols, &numRows, input)) {
+    if (!validateInputData(&haveWeights, &havePixels, &num, &numCols, &numRows, input)) {
         return false;
     }
@@ -571,20 +539,4 @@
         PS_ASSERT_IMAGES_SIZE_EQUAL(combined->image, combined->mask, false);
     }
-    if (!haveDetector && !haveSky) {
-        psError(PS_ERR_UNEXPECTED_NULL, true, "Nothing to combine!");
-        return false;
-    }
-
-
-    if (!haveSky) {
-        // Need to generate the sky cell images
-
-        // ...
-
-#if 0
-        numCols = data->sky->image->numCols;
-        numRows = data->sky->image->numRows;
-#endif
-    }
 
     // Pull out the weightings
@@ -635,5 +587,5 @@
 
         psImage *combinedWeights = combined->weight; // Combined weight map
-        if (haveSkyWeights && !combinedWeights) {
+        if (haveWeights && !combinedWeights) {
             combined->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
             combinedWeights = combined->weight;
@@ -668,29 +620,15 @@
     psFree(buffer);
 
-    psList *cells = psListAlloc(NULL);  // List of cells, for concept update
-    for (int i = 0; i < num; i++) {
-        pmStackData *data = input->data[i]; // Stacking data; contains the list of pixels
-        psListAdd(cells, PS_LIST_TAIL, data->sky->parent);
-    }
-    if (!pmConceptsAverageCells(combined->parent, cells, NULL, NULL, false)) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to average concepts for input sky readouts.");
-        psFree(cells);
-        return false;
-    }
-    psFree(cells);
-
     return true;
 }
 
+#if 0
 bool pmStackReject(psArray *input, psMaskType maskVal, float extent, float threshold)
 {
-    bool haveDetector;                  // Do we have the detector images?
-    bool haveSky;                       // Do we have the sky images?
-    bool haveSkyWeights;                // Do we have the sky weight maps?
+    bool haveWeights;                   // Do we have the sky weight maps?
     bool havePixels;                    // Do we have lists of pixels?
     int num;                            // Number of inputs
     int numCols, numRows;               // Size of (sky) images
-    if (!validateInputData(&haveDetector, &haveSky, &haveSkyWeights, &havePixels,
-                           &num, &numCols, &numRows, input)) {
+    if (!validateInputData(&haveWeights, &havePixels, &num, &numCols, &numRows, input)) {
         return false;
     }
@@ -768,3 +706,3 @@
     return true;
 }
-
+#endif
Index: trunk/psModules/src/imcombine/pmStack.h
===================================================================
--- trunk/psModules/src/imcombine/pmStack.h	(revision 14624)
+++ trunk/psModules/src/imcombine/pmStack.h	(revision 14625)
@@ -8,6 +8,6 @@
  * @author GLG, MHPCC
  *
- * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-05-22 03:59:32 $
+ * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-08-23 02:24:58 $
  * Copyright 2004-2007 Institute for Astronomy, University of Hawaii
  */
@@ -26,14 +26,11 @@
 /// Container for input image
 typedef struct {
-    pmReadout *detector;                ///< Original (unwarped) readout from the detector
-    pmReadout *sky;                     ///< Warped readout (sky cell)
+    pmReadout *readout;                 ///< Warped readout (sky cell)
     psPixels *pixels;                   ///< Pixels to inspect or reject
-    float seeing;                       ///< Seeing FWHM (pixels)
     float weight;                       ///< Weight to apply
 } pmStackData;
 
 /// Constructor
-pmStackData *pmStackDataAlloc(pmReadout *sky, ///< Warped readout (sky cell)
-                              float seeing, ///< Seeing FWHM (pixels)
+pmStackData *pmStackDataAlloc(pmReadout *readout, ///< Warped readout (sky cell)
                               float weight ///< Weight to apply
     );
