Index: /trunk/psModules/src/camera/pmFPARead.c
===================================================================
--- /trunk/psModules/src/camera/pmFPARead.c	(revision 9598)
+++ /trunk/psModules/src/camera/pmFPARead.c	(revision 9599)
@@ -16,7 +16,4 @@
 
 #include "pmFPARead.h"
-
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -45,8 +42,8 @@
         return false;
     }
-    psRegion region = psRegionSet(MAX(trimsec->x0 - readout->col0, 0), // x0
-                                  MIN(trimsec->x1 - readout->col0, image->numCols), // x1
-                                  MAX(trimsec->y0 - readout->row0, 0), // y0
-                                  MIN(trimsec->y1 - readout->row0, image->numRows) // y1
+    psRegion region = psRegionSet(PS_MAX(trimsec->x0 - readout->col0, 0), // x0
+                                  PS_MIN(trimsec->x1 - readout->col0, image->numCols), // x1
+                                  PS_MAX(trimsec->y0 - readout->row0, 0), // y0
+                                  PS_MIN(trimsec->y1 - readout->row0, image->numRows) // y1
                                  );
     if (readout->image) {
@@ -71,8 +68,8 @@
             return false;
         }
-        psRegion region = psRegionSet(MAX(biassec->x0 - readout->col0, 0), // x0
-                                      MIN(biassec->x1 - readout->col0, image->numCols), // x1
-                                      MAX(biassec->y0 - readout->row0, 0), // y0
-                                      MIN(biassec->y1 - readout->row0, image->numRows) // y1
+        psRegion region = psRegionSet(PS_MAX(biassec->x0 - readout->col0, 0), // x0
+                                      PS_MIN(biassec->x1 - readout->col0, image->numCols), // x1
+                                      PS_MAX(biassec->y0 - readout->row0, 0), // y0
+                                      PS_MIN(biassec->y1 - readout->row0, image->numRows) // y1
                                      );
         psImage *overscan = psMemIncrRefCounter(psImageSubset(image, region));
@@ -162,14 +159,5 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-// Read the next readout; return true if we read pixels in.
-//
-// Note that this doesn't put pixels in the HDU.  It is therefore NOT COMPATIBLE with pmCellWrite,
-// pmChipWrite, and pmFPAWrite (or any function that uses or creates an HDU for that matter).
-// Use pmReadoutWriteNext to write the data that's read by this function.
-bool pmReadoutReadNext(pmReadout *readout, // Readout into which to read
-                       psFits *fits,    // FITS file from which to read
-                       int z,           // Readout number/plane; zero-offset indexing
-                       int numScans     // The number of scans to read
-                      )
+bool pmReadoutReadNext(pmReadout *readout, psFits *fits, int z, int numScans)
 {
     PS_ASSERT_PTR_NON_NULL(readout, false);
@@ -284,8 +272,6 @@
     // Blow away existing data.
     // Do this before returning, so that we're not returning data from a previous read
-    #if 1
     psFree(readout->image);
     readout->image = NULL;
-    #endif
 
     while (readout->bias->n > 0) {
@@ -321,9 +307,5 @@
 
 
-// Read in the cell, and allocate the readouts
-bool pmCellRead(pmCell *cell,           // Cell to read into
-                psFits *fits,           // FITS file from which to read
-                psDB *db                // Database handle, for "concepts" ingest
-               )
+bool pmCellRead(pmCell *cell, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(cell, false);
@@ -383,9 +365,5 @@
 }
 
-// Read in the component cells
-bool pmChipRead(pmChip *chip,           // Chip to read into
-                psFits *fits,           // FITS file from which to read
-                psDB *db                // Database handle, for "concepts" ingest
-               )
+bool pmChipRead(pmChip *chip, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(chip, false);
@@ -410,9 +388,5 @@
 }
 
-// Read in the component chips
-bool pmFPARead(pmFPA *fpa,              // FPA to read into
-               psFits *fits,            // FITS file from which to read
-               psDB *db                 // Database handle, for "concepts" ingest
-              )
+bool pmFPARead(pmFPA *fpa, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(fpa, false);
@@ -442,9 +416,5 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-// Read the mask into the cell, and allocate the readouts
-bool pmCellReadMask(pmCell *cell,           // Cell to read into
-                    psFits *fits,           // FITS file from which to read
-                    psDB *db                // Database handle, for "concepts" ingest
-                   )
+bool pmCellReadMask(pmCell *cell, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(cell, false);
@@ -497,9 +467,5 @@
 }
 
-// Read the mask into the component cells
-bool pmChipReadMask(pmChip *chip,           // Chip to read into
-                    psFits *fits,           // FITS file from which to read
-                    psDB *db                // Database handle, for "concepts" ingest
-                   )
+bool pmChipReadMask(pmChip *chip, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(chip, false);
@@ -524,9 +490,5 @@
 }
 
-// Read the mask into the component chips
-bool pmFPAReadMask(pmFPA *fpa,              // FPA to read into
-                   psFits *fits,            // FITS file from which to read
-                   psDB *db                 // Database handle, for "concepts" ingest
-                  )
+bool pmFPAReadMask(pmFPA *fpa, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(fpa, false);
@@ -555,9 +517,5 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-// Read the weight map into the cell, and allocate the readouts
-bool pmCellReadWeight(pmCell *cell,           // Cell to read into
-                      psFits *fits,           // FITS file from which to read
-                      psDB *db                // Database handle, for "concepts" ingest
-                     )
+bool pmCellReadWeight(pmCell *cell, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(cell, false);
@@ -610,9 +568,5 @@
 }
 
-// Read the weight map into the component cells
-bool pmChipReadWeight(pmChip *chip,           // Chip to read into
-                      psFits *fits,           // FITS file from which to read
-                      psDB *db                // Database handle, for "concepts" ingest
-                     )
+bool pmChipReadWeight(pmChip *chip, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(chip, false);
@@ -637,9 +591,5 @@
 }
 
-// Read the weight map into the component chips
-bool pmFPAReadWeight(pmFPA *fpa,              // FPA to read into
-                     psFits *fits,            // FITS file from which to read
-                     psDB *db                 // Database handle, for "concepts" ingest
-                    )
+bool pmFPAReadWeight(pmFPA *fpa, psFits *fits, psDB *db)
 {
     PS_ASSERT_PTR_NON_NULL(fpa, false);
Index: /trunk/psModules/src/camera/pmFPARead.h
===================================================================
--- /trunk/psModules/src/camera/pmFPARead.h	(revision 9598)
+++ /trunk/psModules/src/camera/pmFPARead.h	(revision 9599)
@@ -1,8 +1,32 @@
+/// @file pmFPAMosaic.h
+///
+/// @brief Functions to mosaic FPA components into a single entity
+///
+/// @ingroup Camera
+///
+/// @author Paul Price, IfA
+///
+/// @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+/// @date $Date: 2006-10-17 03:00:30 $
+///
+/// Copyright 2005-2006 Institute for Astronomy, University of Hawaii
+///
+
 #ifndef PM_FPA_READ_H
 #define PM_FPA_READ_H
 
-#include "pslib.h"
+#include <pslib.h>
 #include "pmFPA.h"
 
+/// Read a readout incrementally
+///
+/// Multiple calls to this function moves through a readout within a cell incrementally.  It is required to
+/// pass the readout previously acquired (or a newly-allocated one) in order to preserve state information
+/// (where the read is at).  Only a maximum of numRows rows are read at a time.  Returns true if pixels are
+/// read, and false otherwise.  To facilitate looping, no error is generated for reading a plane that doesn't
+/// exist.  Note that this function doesn't put pixels in the HDU.  It is therefore NOT COMPATIBLE with
+/// pmCellWrite, pmChipWrite, and pmFPAWrite (or any function that uses or creates an HDU for that matter).
+/// Use pmReadoutWriteNext to write the data that's read by this function.  This function is intended for
+/// reading in many readouts into memory at once (e.g., for stacking) where the input is not written out.
 bool pmReadoutReadNext(pmReadout *readout, // Readout into which to read
                        psFits *fits,    // FITS file from which to read
@@ -11,4 +35,8 @@
                       );
 
+/// Read an entire cell
+///
+/// Reads the appropriate HDU, ingests concepts from the header, and portions pixels into readouts.  Pixels
+/// are converted to F32.
 bool pmCellRead(pmCell *cell,           // Cell to read into
                 psFits *fits,           // FITS file from which to read
@@ -16,4 +44,7 @@
                );
 
+/// Read a chip
+///
+/// Iterates over component cells, reading each with pmCellRead.
 bool pmChipRead(pmChip *chip,           // Chip to read into
                 psFits *fits,           // FITS file from which to read
@@ -21,4 +52,7 @@
                );
 
+/// Read an FPA
+///
+/// Iterates over component chips, reading each with pmChipRead.
 bool pmFPARead(pmFPA *fpa,              // FPA to read into
                psFits *fits,            // FITS file from which to read
@@ -26,4 +60,7 @@
               );
 
+/// Read an entire cell into the mask
+///
+/// Same as pmCellRead, but reads into the mask element of the readouts.
 bool pmCellReadMask(pmCell *cell,           // Cell to read into
                     psFits *fits,           // FITS file from which to read
@@ -31,4 +68,7 @@
                    );
 
+/// Read an entire chip into the mask
+///
+/// Same as pmChipRead, but reads into the mask element of the readouts.
 bool pmChipReadMask(pmChip *chip,           // Chip to read into
                     psFits *fits,           // FITS file from which to read
@@ -36,4 +76,7 @@
                    );
 
+/// Read an entire FPA into the mask
+///
+/// Same as pmFPARead, but reads into the mask element of the readouts.
 bool pmFPAReadMask(pmFPA *fpa,              // FPA to read into
                    psFits *fits,            // FITS file from which to read
@@ -41,4 +84,7 @@
                   );
 
+/// Read an entire cell into the weight
+///
+/// Same as pmCellRead, but reads into the weight element of the readouts.
 bool pmCellReadWeight(pmCell *cell,           // Cell to read into
                       psFits *fits,           // FITS file from which to read
@@ -46,4 +92,7 @@
                      );
 
+/// Read an entire chip into the weight
+///
+/// Same as pmChipRead, but reads into the weight element of the readouts.
 bool pmChipReadWeight(pmChip *chip,           // Chip to read into
                       psFits *fits,           // FITS file from which to read
@@ -51,4 +100,7 @@
                      );
 
+/// Read an entire FPA into the weight
+///
+/// Same as pmFPARead, but reads into the weight element of the readouts.
 bool pmFPAReadWeight(pmFPA *fpa,              // FPA to read into
                      psFits *fits,            // FITS file from which to read
@@ -56,41 +108,3 @@
                     );
 
-bool pmCellReadPHU(pmCell *cell,        // Cell to read into
-                   psFits *fits         // FITS file from which to read
-                  );
-
-bool pmChipReadPHU(pmChip *chip,        // Chip to read into
-                   psFits *fits         // FITS file from which to read
-                  );
-
-bool pmFPAReadPHU(pmFPA *fpa,           // FPA to read into
-                  psFits *fits          // FITS file from which to read
-                 );
-
-
-#if 0
-bool pmFPARead(pmFPA *fpa,              // FPA to read into
-               psFits *fits,            // FITS file from which to read
-               psMetadata *phu,         // Primary header
-               psDB *db                 // Database handle, for concept ingest
-              );
-
-psString p_pmFPATranslateName(const psString name, // The name to translate
-                              const pmCell *cell // The cell for which to translate
-                             );
-
-psString p_pmFPATranslateFileExt(psString *extName, // Extension name, to be returned
-                                 const psString filenameExt, // The string to parse into filename and ext
-                                 const pmCell *cell // The cell
-                                );
-
-bool pmFPAReadMask(pmFPA *fpa,          // FPA to read into
-                   psFits *source       // Source FITS file (for the original data)
-                  );
-
-bool pmFPAReadWeight(pmFPA *fpa,        // FPA to read into
-                     psFits *source     // Source FITS file (for the original data)
-                    );
 #endif
-
-#endif
