Index: trunk/psModules/src/camera/pmChipMosaic.c
===================================================================
--- trunk/psModules/src/camera/pmChipMosaic.c	(revision 7276)
+++ trunk/psModules/src/camera/pmChipMosaic.c	(revision 7278)
@@ -41,4 +41,7 @@
                           )
 {
+    assert(bounds);
+    assert(chip);
+
     if (primary) {
         *bounds = psRegionSet(INFINITY, 0, INFINITY, 0);
@@ -104,4 +107,8 @@
                          )
 {
+    assert(xBinChip);
+    assert(yBinChip);
+    assert(chip);
+
     // Check that we've got the HDU in the chip or the FPA
     if ((!chip->hdu || !chip->hdu->images) && (!chip->parent->hdu || !chip->parent->hdu->images)) {
@@ -358,4 +365,9 @@
                         )
 {
+    assert(target);
+    assert(sources);
+    assert(xBin > 0 && yBin > 0);
+    assert(trimsec);
+
     bool success = true;                // Result of setting everything
     float gain       = 0.0;             // Gain
@@ -433,5 +445,4 @@
     }
 
-
     return success;
 }
@@ -446,4 +457,9 @@
                )
 {
+    assert(mosaicImage);
+    assert(mosaicMask);
+    assert(mosaicWeights);
+    assert(chip);
+
     psArray *cells = chip->cells;       // The array of cells
     int numCells = cells->n;            // Number of cells
@@ -587,4 +603,6 @@
                  )
 {
+    PS_ASSERT_PTR_NON_NULL(chip, false);
+
     psImage *mosaicImage   = NULL;      // The mosaic image
     psImage *mosaicMask    = NULL;      // The mosaic mask
Index: trunk/psModules/src/camera/pmFPA.c
===================================================================
--- trunk/psModules/src/camera/pmFPA.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPA.c	(revision 7278)
@@ -12,6 +12,6 @@
 * XXX: Should we implement non-linear cell->chip transforms?
 *
-*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-06-01 22:43:26 $
+*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-06-02 00:55:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -399,5 +399,5 @@
 }
 
-bool pmChipSetFileStatus pmChip *chip, bool status)
+bool pmChipSetFileStatus(pmChip *chip, bool status)
 {
     PS_ASSERT_PTR_NON_NULL(chip, false);
Index: trunk/psModules/src/camera/pmFPAConstruct.c
===================================================================
--- trunk/psModules/src/camera/pmFPAConstruct.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPAConstruct.c	(revision 7278)
@@ -21,4 +21,7 @@
                               )
 {
+    assert(format);
+    assert(cellName && strlen(cellName) > 0);
+
     bool status = true;                 // Result of MD lookup
     psMetadata *cells = psMetadataLookupMD(&status, format, "CELLS"); // The CELLS
@@ -43,4 +46,9 @@
                         )
 {
+    assert(first);
+    assert(second);
+    assert(third);
+    assert(string && strlen(string) > 0);
+
     bool allOK = true;                  // Everything was OK?
     psList *values = psStringSplit(string, " ,;", true); // List of the parts
@@ -96,4 +104,8 @@
                                  )
 {
+    assert(name && strlen(name) > 0);
+    assert(fileInfo);
+    assert(header);
+
     bool mdok = true;                   // Result of MD lookup
     psString keyword = psMetadataLookupStr(&mdok, fileInfo, name);
@@ -188,4 +200,8 @@
                              )
 {
+    assert(fileInfo);
+    assert(contents);
+    assert(header);
+
     bool mdok = true;                   // Status of MD lookup
     const char *contentHeaders = psMetadataLookupStr(&mdok, fileInfo, "CONTENT"); // Headers for content
@@ -237,4 +253,5 @@
     assert(contents && strlen(contents) > 0);
     assert(!cell || (cell && chip));    // Need both chip and cell if given a cell
+    assert(format);
 
     if (hdu && level == PM_FPA_LEVEL_FPA) {
@@ -329,4 +346,6 @@
                           )
 {
+    assert(format);
+
     bool mdok = true;                   // Status of MD lookup
     psMetadata *file = psMetadataLookupMD(&mdok, format, "FILE"); // File information
@@ -363,4 +382,6 @@
                      )
 {
+    PS_ASSERT_PTR_NON_NULL(camera, NULL);
+
     pmFPA *fpa = pmFPAAlloc(camera);    // The FPA to fill out
 
@@ -400,7 +421,7 @@
                            )
 {
-    assert(fpa);
-    assert(phuView);
-    assert(format);
+    PS_ASSERT_PTR_NON_NULL(fpa, false);
+    PS_ASSERT_PTR_NON_NULL(phuView, false);
+    PS_ASSERT_PTR_NON_NULL(format, false);
 
     // Where does the PHU go?
@@ -495,7 +516,7 @@
                                    )
 {
-    assert(fpa);
-    assert(phu);
-    assert(format);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
+    PS_ASSERT_PTR_NON_NULL(phu, NULL);
+    PS_ASSERT_PTR_NON_NULL(format, NULL);
 
     bool mdok = true;                   // Status from metadata lookups
@@ -689,4 +710,6 @@
                )
 {
+    PS_ASSERT_PTR_NON_NULL(fpa,);
+
     psTrace(__func__, 1, "FPA:\n");
     if (fpa->hdu) {
Index: trunk/psModules/src/camera/pmFPACopy.c
===================================================================
--- trunk/psModules/src/camera/pmFPACopy.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPACopy.c	(revision 7278)
@@ -24,4 +24,6 @@
                           )
 {
+    assert(source);
+
     psImage *copy = psMemIncrRefCounter(source);
     bool copied = false;                // Have the pixels been copied?
@@ -51,4 +53,8 @@
                      )
 {
+    assert(region);
+    assert(xBin > 0);
+    assert(yBin > 0);
+
     // Want to include the lower bound: 1 binned by 4 --> 0; 3 binned by 4 --> 0; 4 binned by 4 --> 1
     region->x0 = (int)(region->x0 / xBin);
@@ -62,4 +68,6 @@
                      )
 {
+    assert(cell);
+
     if (cell->hdu && cell->hdu->phu) {
         return cell->hdu;
@@ -274,4 +282,6 @@
     assert(target);
     assert(source);
+    assert(xBin > 0);
+    assert(yBin > 0);
 
     psArray *targetCells = target->cells; // The target cells
@@ -300,12 +310,14 @@
 }
 
-static int fpaCopy(pmFPA *target,            // The target FPA
-                   pmFPA *source,            // The source FPA, to be copied
-                   bool pixels,              // Copy the pixels?
-                   int xBin, int yBin        // (Relative) binning factors in x and y
-                  )
+static bool fpaCopy(pmFPA *target,            // The target FPA
+                    pmFPA *source,            // The source FPA, to be copied
+                    bool pixels,              // Copy the pixels?
+                    int xBin, int yBin        // (Relative) binning factors in x and y
+                   )
 {
     assert(target);
     assert(source);
+    assert(xBin > 0);
+    assert(yBin > 0);
 
     psArray *targetChips = target->chips; // The target chips
@@ -338,47 +350,65 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-int pmFPACopy(pmFPA *target,            // The target FPA
-              pmFPA *source             // The source FPA, to be copied
-             )
-{
+bool pmFPACopy(pmFPA *target,            // The target FPA
+               pmFPA *source             // The source FPA, to be copied
+              )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
     return fpaCopy(target, source, true, 1, 1);
 }
 
-int pmChipCopy(pmChip *target,          // The target chip
-               pmChip *source           // The source chip, to be copied
-              )
-{
+bool pmChipCopy(pmChip *target,          // The target chip
+                pmChip *source           // The source chip, to be copied
+               )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
     return chipCopy(target, source, true, 1, 1);
 }
 
-int pmCellCopy(pmCell *target,          // The target cell
-               pmCell *source           // The source cell, to be copied
-              )
-{
+bool pmCellCopy(pmCell *target,          // The target cell
+                pmCell *source           // The source cell, to be copied
+               )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
     return cellCopy(target, source, true, 1, 1);
 }
 
 
-int pmFPACopyStructure(pmFPA *target,   // The target FPA
-                       pmFPA *source,   // The source FPA, to be copied
-                       int xBin, int yBin // Binning factors in x and y
-                      )
-{
-    return fpaCopy(target, source, false, xBin, yBin);
-}
-
-int pmChipCopyStructure(pmChip *target, // The target chip
-                        pmChip *source, // The source chip, to be copied
+bool pmFPACopyStructure(pmFPA *target,   // The target FPA
+                        pmFPA *source,   // The source FPA, to be copied
                         int xBin, int yBin // Binning factors in x and y
                        )
 {
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_INT_POSITIVE(xBin, false);
+    PS_ASSERT_INT_POSITIVE(yBin, false);
+    return fpaCopy(target, source, false, xBin, yBin);
+}
+
+bool pmChipCopyStructure(pmChip *target, // The target chip
+                         pmChip *source, // The source chip, to be copied
+                         int xBin, int yBin // Binning factors in x and y
+                        )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_INT_POSITIVE(xBin, false);
+    PS_ASSERT_INT_POSITIVE(yBin, false);
     return chipCopy(target, source, false, xBin, yBin);
 }
 
-int pmCellCopyStructure(pmCell *target, // The target cell
-                        pmCell *source, // The source cell, to be copied
-                        int xBin, int yBin // Binning factors in x and y
-                       )
-{
+bool pmCellCopyStructure(pmCell *target, // The target cell
+                         pmCell *source, // The source cell, to be copied
+                         int xBin, int yBin // Binning factors in x and y
+                        )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_INT_POSITIVE(xBin, false);
+    PS_ASSERT_INT_POSITIVE(yBin, false);
     return cellCopy(target, source, false, xBin, yBin);
 }
Index: trunk/psModules/src/camera/pmFPACopy.h
===================================================================
--- trunk/psModules/src/camera/pmFPACopy.h	(revision 7276)
+++ trunk/psModules/src/camera/pmFPACopy.h	(revision 7278)
@@ -3,27 +3,27 @@
 
 // Copy the FPA components, including the pixels
-int pmFPACopy(pmFPA *target,            // The target FPA
-              pmFPA *source             // The source FPA, to be copied
-             );
-int pmChipCopy(pmChip *target,          // The target chip
-               pmChip *source           // The source chip, to be copied
+bool pmFPACopy(pmFPA *target,            // The target FPA
+               pmFPA *source             // The source FPA, to be copied
               );
-int pmCellCopy(pmCell *target,          // The target cell
-               pmCell *source           // The source cell, to be copied
-              );
+bool pmChipCopy(pmChip *target,          // The target chip
+                pmChip *source           // The source chip, to be copied
+               );
+bool pmCellCopy(pmCell *target,          // The target cell
+                pmCell *source           // The source cell, to be copied
+               );
 
 // Versions that copy the structure and not the pixels; they also allow binning
-int pmFPACopyStructure(pmFPA *target,   // The target FPA
-                       pmFPA *source,   // The source FPA, to be copied
-                       int xBin, int yBin     // Binning factors in x and y
-                      );
-int pmChipCopyStructure(pmChip *target, // The target chip
-                        pmChip *source, // The source chip, to be copied
-                        int xBin, int yBin   // Binning factors in x and y
+bool pmFPACopyStructure(pmFPA *target,   // The target FPA
+                        pmFPA *source,   // The source FPA, to be copied
+                        int xBin, int yBin     // Binning factors in x and y
                        );
-int pmCellCopyStructure(pmCell *target, // The target cell
-                        pmCell *source, // The source cell, to be copied
-                        int xBin, int yBin // Binning factors in x and y
-                       );
+bool pmChipCopyStructure(pmChip *target, // The target chip
+                         pmChip *source, // The source chip, to be copied
+                         int xBin, int yBin   // Binning factors in x and y
+                        );
+bool pmCellCopyStructure(pmCell *target, // The target cell
+                         pmCell *source, // The source cell, to be copied
+                         int xBin, int yBin // Binning factors in x and y
+                        );
 
 
Index: trunk/psModules/src/camera/pmFPAHeader.c
===================================================================
--- trunk/psModules/src/camera/pmFPAHeader.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPAHeader.c	(revision 7278)
@@ -15,4 +15,6 @@
                         )
 {
+    assert(chip);
+
     bool status = true;                 // Status of concept reading
     status |= pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, false, NULL);
@@ -33,4 +35,6 @@
                        )
 {
+    assert(fpa);
+
     bool status = true;                 // Status of concept reading
     status |= pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL);
Index: trunk/psModules/src/camera/pmFPARead.c
===================================================================
--- trunk/psModules/src/camera/pmFPARead.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPARead.c	(revision 7278)
@@ -27,4 +27,9 @@
                         )
 {
+    assert(readout);
+    assert(image);
+    assert(trimsec);
+    assert(biassecs);
+
     // The image corresponding to the trim region
     if (psRegionIsBad(*trimsec)) {
@@ -85,4 +90,7 @@
                              )
 {
+    assert(fits);
+    assert(region);
+
     bool resize = false;                // Do we need to resize the image once read?
     psRegion toRead = psRegionSet(region->x0, region->x1, region->y0, region->y1); // Region to read
@@ -158,4 +166,9 @@
                       )
 {
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+    PS_ASSERT_INT_NONNEGATIVE(z, false);
+    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
+
     // Get the HDU and read the header
     pmCell *cell = readout->parent;     // The parent cell
@@ -298,4 +311,7 @@
                )
 {
+    PS_ASSERT_PTR_NON_NULL(cell, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     pmHDU *hdu = pmHDUFromCell(cell);   // The HDU
     if (!hdu) {
@@ -345,4 +361,7 @@
                )
 {
+    PS_ASSERT_PTR_NON_NULL(chip, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     bool success = false;               // Were we able to read at least one HDU?
     psArray *cells = chip->cells;       // Array of cells
@@ -366,4 +385,7 @@
               )
 {
+    PS_ASSERT_PTR_NON_NULL(fpa, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     bool success = false;               // Were we able to read at least one HDU?
     psArray *chips = fpa->chips;        // Array of chips
Index: trunk/psModules/src/camera/pmFPAUtils.c
===================================================================
--- trunk/psModules/src/camera/pmFPAUtils.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPAUtils.c	(revision 7278)
@@ -9,5 +9,11 @@
                  )
 {
-    psArray *chips = fpa->chips;    // Array of chips
+    PS_ASSERT_PTR_NON_NULL(fpa, -1);
+    PS_ASSERT_PTR_NON_NULL(name, -1);
+    if (strlen(name) == 0) {
+        return -1;
+    }
+
+    psArray *chips = fpa->chips;        // Array of chips
     for (int i = 0; i < chips->n; i++) {
         pmChip *chip = chips->data[i]; // The chip of interest
@@ -27,4 +33,10 @@
                   )
 {
+    PS_ASSERT_PTR_NON_NULL(chip, -1);
+    PS_ASSERT_PTR_NON_NULL(name, -1);
+    if (strlen(name) == 0) {
+        return -1;
+    }
+
     psArray *cells = chip->cells;    // Array of cells
     for (int i = 0; i < cells->n; i++) {
Index: trunk/psModules/src/camera/pmFPAWrite.c
===================================================================
--- trunk/psModules/src/camera/pmFPAWrite.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPAWrite.c	(revision 7278)
@@ -16,4 +16,7 @@
                        )
 {
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     pmHDU *hdu = pmHDUFromReadout(readout); // The HDU to which to write
     if (!hdu) {
@@ -87,4 +90,7 @@
                 )
 {
+    PS_ASSERT_PTR_NON_NULL(cell, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     pmHDU *hdu = cell->hdu;             // The HDU
     if (!hdu) {
@@ -118,4 +124,7 @@
                 )
 {
+    PS_ASSERT_PTR_NON_NULL(chip, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     pmHDU *hdu = chip->hdu;             // The HDU
     if (!hdu) {
@@ -156,4 +165,7 @@
                )
 {
+    PS_ASSERT_PTR_NON_NULL(fpa, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
+
     pmHDU *hdu = fpa->hdu;              // The HDU
     if (!hdu) {
Index: trunk/psModules/src/camera/pmFPA_JPEG.c
===================================================================
--- trunk/psModules/src/camera/pmFPA_JPEG.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPA_JPEG.c	(revision 7278)
@@ -5,6 +5,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-05-01 01:55:43 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-06-02 00:55:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,6 +28,8 @@
 
 
-bool pmFPAviewWriteJPEG (const pmFPAview *view, pmFPAfile *file)
+bool pmFPAviewWriteJPEG(const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
 
     pmFPA *fpa = file->fpa;
@@ -70,4 +72,7 @@
 bool pmFPAWriteJPEG (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(fpa, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
 
     for (int i = 0; i < fpa->chips->n; i++) {
@@ -82,4 +87,7 @@
 bool pmChipWriteJPEG (pmChip *chip, const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(chip, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
 
     for (int i = 0; i < chip->cells->n; i++) {
@@ -94,4 +102,7 @@
 bool pmCellWriteJPEG (pmCell *cell, const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(cell, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
 
     for (int i = 0; i < cell->readouts->n; i++) {
@@ -106,4 +117,8 @@
 bool pmReadoutWriteJPEG (pmReadout *readout, const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
+
     char *name, *mode, *word, *mapname;
     psArray *range;
Index: trunk/psModules/src/camera/pmFPAfile.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfile.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPAfile.c	(revision 7278)
@@ -22,9 +22,9 @@
 #include "pmFPA_JPEG.h"
 
-static void pmFPAfileFree (pmFPAfile *file)
-{
-
-    if (file == NULL)
+static void pmFPAfileFree(pmFPAfile *file)
+{
+    if (!file) {
         return;
+    }
 
     psFree (file->fpa);
@@ -54,9 +54,8 @@
 }
 
-pmFPAfile *pmFPAfileAlloc ()
-{
-
-    pmFPAfile *file = psAlloc (sizeof(pmFPAfile));
-    psMemSetDeallocator (file, (psFreeFunc) pmFPAfileFree);
+pmFPAfile *pmFPAfileAlloc()
+{
+    pmFPAfile *file = psAlloc(sizeof(pmFPAfile));
+    psMemSetDeallocator(file, (psFreeFunc) pmFPAfileFree);
 
     file->phu = NULL;
@@ -83,9 +82,14 @@
     file->state = PM_FPA_STATE_CLOSED;
 
-    return (file);
-}
-
-pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name)
-{
+    return file;
+}
+
+pmFPAfile *pmFPAfileDefine(psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name)
+{
+    PS_ASSERT_PTR_NON_NULL(files, NULL);
+    PS_ASSERT_PTR_NON_NULL(camera, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
+    PS_ASSERT_PTR_NON_NULL(name, NULL);
+    PS_ASSERT_INT_POSITIVE(strlen(name), NULL);
 
     bool status;
@@ -243,4 +247,6 @@
 bool pmFPAfileOpen (pmFPAfile *file, const pmFPAview *view)
 {
+    PS_ASSERT_PTR_NON_NULL(file, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
 
     bool status;
@@ -325,6 +331,9 @@
 }
 
-bool pmFPAfileRead (pmFPAfile *file, const pmFPAview *view)
-{
+bool pmFPAfileRead(pmFPAfile *file, const pmFPAview *view)
+{
+    PS_ASSERT_PTR_NON_NULL(file, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+
     if (file->state & PM_FPA_STATE_INACTIVE)
         return false;
@@ -378,6 +387,8 @@
 }
 
-bool pmFPAfileWrite (pmFPAfile *file, const pmFPAview *view)
-{
+bool pmFPAfileWrite(pmFPAfile *file, const pmFPAview *view)
+{
+    PS_ASSERT_PTR_NON_NULL(file, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
 
     if (file->state & PM_FPA_STATE_INACTIVE) {
@@ -436,4 +447,7 @@
 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view)
 {
+    PS_ASSERT_PTR_NON_NULL(file, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+
     if (file->state & PM_FPA_STATE_INACTIVE) {
         return false;
@@ -478,4 +492,7 @@
 bool pmFPAfileClose (pmFPAfile *file, const pmFPAview *view)
 {
+    PS_ASSERT_PTR_NON_NULL(file, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+
     if (file->state & PM_FPA_STATE_INACTIVE) {
         return false;
@@ -524,5 +541,7 @@
 bool pmFPAfileActivate (psMetadata *files, bool state, char *name)
 {
-    if (name == NULL) {
+    PS_ASSERT_PTR_NON_NULL(files, false);
+
+    if (!name) {
         psMetadataItem *item = NULL;
         psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL);
@@ -555,4 +574,7 @@
 bool pmFPAfileIOChecks (psMetadata *files, const pmFPAview *view, pmFPAfilePlace place)
 {
+    PS_ASSERT_PTR_NON_NULL(files, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+
     // recipe override values (command-line options):
     psMetadataItem *item = NULL;
@@ -577,6 +599,10 @@
 pmReadout *pmFPAfileCreateInternal (psMetadata *files, char *name, int Nx, int Ny, int type)
 {
-    pmReadout *readout = pmReadoutAlloc (NULL);
-    readout->image = psImageAlloc (Nx, Ny, type);
+    PS_ASSERT_PTR_NON_NULL(files, false);
+    PS_ASSERT_PTR_NON_NULL(name, false);
+    PS_ASSERT_INT_POSITIVE(strlen(name), false);
+
+    pmReadout *readout = pmReadoutAlloc(NULL);
+    readout->image = psImageAlloc(Nx, Ny, type);
 
     // I want an image from the
@@ -585,13 +611,17 @@
 
     file->readout = readout;
-    psMetadataAddPtr (files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file);
-    psFree (file);
+    psMetadataAddPtr(files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file);
+    psFree(file);
     // we free this copy of file, but 'files' still has a copy
 
-    return (readout);
-}
-
-bool pmFPAfileDropInternal (psMetadata *files, char *name)
-{
+    return readout;
+}
+
+bool pmFPAfileDropInternal(psMetadata *files, char *name)
+{
+    PS_ASSERT_PTR_NON_NULL(files, false);
+    PS_ASSERT_PTR_NON_NULL(name, false);
+    PS_ASSERT_INT_POSITIVE(strlen(name), false);
+
     bool status;
 
@@ -610,4 +640,9 @@
 pmReadout *pmFPAfileThisReadout (psMetadata *files, const pmFPAview *view, const char *name)
 {
+    PS_ASSERT_PTR_NON_NULL(files, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(name, false);
+    PS_ASSERT_INT_POSITIVE(strlen(name), false);
+
     bool status;
 
@@ -629,4 +664,7 @@
 bool pmFPAviewReadFitsImage (const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
+
     bool status;
     pmFPA *fpa = file->fpa;
@@ -680,4 +718,6 @@
 bool pmFPAviewWriteFitsImage (const pmFPAview *view, pmFPAfile *file)
 {
+    PS_ASSERT_PTR_NON_NULL(view, false);
+    PS_ASSERT_PTR_NON_NULL(file, false);
 
     pmFPA *fpa = file->fpa;
@@ -748,4 +788,10 @@
 pmFPAfile *pmFPAfileFromArgs (bool *found, pmConfig *config, char *filename, char *argname)
 {
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    PS_ASSERT_PTR_NON_NULL(filename, false);
+    PS_ASSERT_INT_POSITIVE(strlen(filename), false);
+    PS_ASSERT_PTR_NON_NULL(argname, false);
+    PS_ASSERT_INT_POSITIVE(strlen(argname), false);
+
     bool status;
     pmFPA *fpa = NULL;
@@ -755,13 +801,16 @@
     psMetadata *format = NULL;
 
-    if (*found)
-        return NULL;
+    if (*found) {
+        return NULL;
+    }
 
     // we search the argument data for the named fileset (argname)
     psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname);
-    if (!status)
-        return NULL;
-    if (infiles->n < 1)
-        return NULL;
+    if (!status) {
+        return NULL;
+    }
+    if (infiles->n < 1) {
+        return NULL;
+    }
 
     // determine the current format from the header
@@ -836,4 +885,10 @@
 pmFPAfile *pmFPAfileSetFromArgs (bool *found, pmConfig *config, char *filename, char *argname)
 {
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    PS_ASSERT_PTR_NON_NULL(filename, false);
+    PS_ASSERT_INT_POSITIVE(strlen(filename), false);
+    PS_ASSERT_PTR_NON_NULL(argname, false);
+    PS_ASSERT_INT_POSITIVE(strlen(argname), false);
+
     bool status;
     pmFPA *fpa = NULL;
@@ -848,8 +903,10 @@
     // we search the argument data for the named fileset (argname)
     psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname);
-    if (!status)
-        return NULL;
-    if (infiles->n < 1)
-        return NULL;
+    if (!status) {
+        return NULL;
+    }
+    if (infiles->n < 1) {
+        return NULL;
+    }
 
     // determine the current format from the header
@@ -914,4 +971,9 @@
 pmFPAfile *pmFPAfileFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, char *filename)
 {
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    PS_ASSERT_PTR_NON_NULL(src, false);
+    PS_ASSERT_PTR_NON_NULL(filename, false);
+    PS_ASSERT_INT_POSITIVE(strlen(filename), false);
+
     // XXX pmFPAConstruct has many leaks (6919)
     pmFPA *fpa = pmFPAConstruct (config->camera);
@@ -928,4 +990,9 @@
 pmFPAfile *pmFPAfileFromConf (bool *found, pmConfig *config, char *filename, pmFPA *input)
 {
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    PS_ASSERT_PTR_NON_NULL(filename, false);
+    PS_ASSERT_INT_POSITIVE(strlen(filename), false);
+    PS_ASSERT_PTR_NON_NULL(input, false);
+
     psFits *fits = NULL;
     pmFPAfile *file = NULL;
@@ -934,6 +1001,7 @@
     psArray *infiles = NULL;
 
-    if (*found)
-        return NULL;
+    if (*found) {
+        return NULL;
+    }
 
     // a camera config is needed (as source of file rule)
@@ -951,6 +1019,7 @@
 
     // image names come from the file->name list?
-    if (!strcasecmp (file->filerule, "@FILES"))
+    if (!strcasecmp (file->filerule, "@FILES")) {
         psAbort ("pmFPAfileFromConfig", "programming error");
+    }
 
     // image needs to come from the detrend database
@@ -964,6 +1033,7 @@
         infiles->data[0] = psStringCopy (file->filerule);
     }
-    if (infiles == NULL)
-        return NULL;
+    if (infiles == NULL) {
+        return NULL;
+    }
     if (infiles->n < 1) {
         psFree (infiles);
@@ -1018,4 +1088,9 @@
 bool pmFPAfileAddFileNames (psMetadata *files, char *name, char *value, int mode)
 {
+    PS_ASSERT_PTR_NON_NULL(files, false);
+    PS_ASSERT_PTR_NON_NULL(name, false);
+    PS_ASSERT_INT_POSITIVE(strlen(name), false);
+    PS_ASSERT_PTR_NON_NULL(value, false);
+    PS_ASSERT_INT_POSITIVE(strlen(value), false);
 
     // add the output names to the output-type files
@@ -1036,4 +1111,8 @@
 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, const pmFPAview *view)
 {
+    PS_ASSERT_PTR_NON_NULL(rule, NULL);
+    PS_ASSERT_INT_POSITIVE(strlen(rule), NULL);
+    PS_ASSERT_PTR_NON_NULL(file, NULL);
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
 
     char *newName = NULL;     // destination for resulting name
@@ -1078,4 +1157,8 @@
 bool pmFPAfileCopyView (pmFPA *out, pmFPA *in, const pmFPAview *view)
 {
+    PS_ASSERT_PTR_NON_NULL(out, false);
+    PS_ASSERT_PTR_NON_NULL(in, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+
     // pmFPAWrite takes care of all PHUs as needed
     if (view->chip == -1) {
@@ -1112,4 +1195,9 @@
 bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, psMetadata *format, int xBin, int yBin, const pmFPAview *view)
 {
+    PS_ASSERT_PTR_NON_NULL(out, false);
+    PS_ASSERT_PTR_NON_NULL(in, false);
+    PS_ASSERT_PTR_NON_NULL(format, false);
+    PS_ASSERT_PTR_NON_NULL(view, false);
+
     // pmFPAWrite takes care of all PHUs as needed
     if (view->chip == -1) {
Index: trunk/psModules/src/camera/pmFPAview.c
===================================================================
--- trunk/psModules/src/camera/pmFPAview.c	(revision 7276)
+++ trunk/psModules/src/camera/pmFPAview.c	(revision 7278)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-05-01 01:55:43 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-06-02 00:55:22 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,15 +19,14 @@
 #include "pmFPAview.h"
 
-static void pmFPAviewFree (pmFPAview *view)
-{
-    if (view == NULL)
-        return;
+static void pmFPAviewFree(pmFPAview *view)
+{
+    // No reason to keep this function, apart from the fact that it allows us to type the memBlock
     return;
 }
 
-pmFPAview *pmFPAviewAlloc (int nRows)
-{
-    pmFPAview *view = psAlloc (sizeof(pmFPAview));
-    psMemSetDeallocator (view, (psFreeFunc) pmFPAviewFree);
+pmFPAview *pmFPAviewAlloc(int nRows)
+{
+    pmFPAview *view = psAlloc(sizeof(pmFPAview));
+    psMemSetDeallocator(view, (psFreeFunc) pmFPAviewFree);
 
     view->chip    = -1;
@@ -36,9 +35,10 @@
     view->iRows   =  0;
     view->nRows   = nRows;
-    return (view);
-}
-
-pmFPAdepth pmFPAviewDepth (const pmFPAview *view)
-{
+    return view;
+}
+
+pmFPAdepth pmFPAviewDepth(const pmFPAview *view)
+{
+    PS_ASSERT_PTR_NON_NULL(view, PM_FPA_DEPTH_NONE);
 
     if (view->chip < 0) {
@@ -54,6 +54,8 @@
 }
 
-pmChip *pmFPAviewThisChip (const pmFPAview *view, pmFPA *fpa)
-{
+pmChip *pmFPAviewThisChip(const pmFPAview *view, pmFPA *fpa)
+{
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
 
     if (view->chip < 0) {
@@ -69,6 +71,9 @@
 }
 
-pmChip *pmFPAviewNextChip (pmFPAview *view, pmFPA *fpa, int nStep)
-{
+pmChip *pmFPAviewNextChip(pmFPAview *view, pmFPA *fpa, int nStep)
+{
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
+
     view->cell = -1;
     view->readout = -1;
@@ -100,6 +105,8 @@
 }
 
-pmCell *pmFPAviewThisCell (const pmFPAview *view, pmFPA *fpa)
-{
+pmCell *pmFPAviewThisCell(const pmFPAview *view, pmFPA *fpa)
+{
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
 
     if (view->cell < 0) {
@@ -108,7 +115,5 @@
 
     pmChip *chip = pmFPAviewThisChip (view, fpa);
-    if (chip == NULL) {
-        return NULL;
-    }
+    PS_ASSERT_PTR_NON_NULL(chip, NULL);
 
     if (view->cell >= chip->cells->n) {
@@ -122,9 +127,9 @@
 pmCell *pmFPAviewNextCell (pmFPAview *view, pmFPA *fpa, int nStep)
 {
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
 
     pmChip *chip = pmFPAviewThisChip (view, fpa);
-    if (chip == NULL) {
-        return NULL;
-    }
+    PS_ASSERT_PTR_NON_NULL(chip, NULL);
 
     view->readout = -1;
@@ -158,4 +163,6 @@
 pmReadout *pmFPAviewThisReadout (const pmFPAview *view, pmFPA *fpa)
 {
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
 
     if (view->readout < 0) {
@@ -164,7 +171,5 @@
 
     pmCell *cell = pmFPAviewThisCell (view, fpa);
-    if (cell == NULL) {
-        return NULL;
-    }
+    PS_ASSERT_PTR_NON_NULL(cell, NULL);
 
     if (view->readout >= cell->readouts->n) {
@@ -178,9 +183,9 @@
 pmReadout *pmFPAviewNextReadout (pmFPAview *view, pmFPA *fpa, int nStep)
 {
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
 
     pmCell *cell = pmFPAviewThisCell (view, fpa);
-    if (cell == NULL) {
-        return NULL;
-    }
+    PS_ASSERT_PTR_NON_NULL(cell, NULL);
 
     view->iRows = 0;
@@ -211,6 +216,9 @@
 }
 
-pmHDU *pmFPAviewThisHDU (const pmFPAview *view, pmFPA *fpa)
-{
+pmHDU *pmFPAviewThisHDU(const pmFPAview *view, pmFPA *fpa)
+{
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
+
     // the HDU is attached to a cell, chip or fpa
     // if this view has a -1 for the level which contains the hdu,
@@ -229,6 +237,9 @@
 }
 
-pmHDU *pmFPAviewThisPHU (const pmFPAview *view, pmFPA *fpa)
-{
+pmHDU *pmFPAviewThisPHU(const pmFPAview *view, pmFPA *fpa)
+{
+    PS_ASSERT_PTR_NON_NULL(view, NULL);
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
+
     // select the HDU which corresponds to the PHU containing this view
 
Index: trunk/psModules/src/camera/pmHDU.c
===================================================================
--- trunk/psModules/src/camera/pmHDU.c	(revision 7276)
+++ trunk/psModules/src/camera/pmHDU.c	(revision 7278)
@@ -61,5 +61,5 @@
     psMemSetDeallocator(hdu, (psFreeFunc)hduFree);
 
-    if (! extname || strlen(extname) == 0) {
+    if (!extname || strlen(extname) == 0) {
         hdu->phu = true;
         hdu->extname = psStringCopy("PHU");
@@ -86,6 +86,6 @@
                     )
 {
-    assert(hdu);
-    assert(fits);
+    PS_ASSERT_PTR_NON_NULL(hdu, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
 
     // Move to the appropriate extension
@@ -113,6 +113,6 @@
               )
 {
-    assert(hdu);
-    assert(fits);
+    PS_ASSERT_PTR_NON_NULL(hdu, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
 
     // Read the header; includes the move
@@ -159,6 +159,6 @@
                )
 {
-    assert(hdu);
-    assert(fits);
+    PS_ASSERT_PTR_NON_NULL(hdu, false);
+    PS_ASSERT_PTR_NON_NULL(fits, false);
 
     psTrace(__func__, 7, "Writing HDU %s\n", hdu->extname);
Index: trunk/psModules/src/camera/pmHDUGenerate.c
===================================================================
--- trunk/psModules/src/camera/pmHDUGenerate.c	(revision 7276)
+++ trunk/psModules/src/camera/pmHDUGenerate.c	(revision 7278)
@@ -437,4 +437,6 @@
                          )
 {
+    PS_ASSERT_PTR_NON_NULL(cell, false);
+
     // Get the HDU and a list of cells below it
     pmHDU *hdu = pmHDUFromCell(cell); // The HDU in the cell
@@ -487,4 +489,6 @@
                          )
 {
+    PS_ASSERT_PTR_NON_NULL(chip, false);
+
     // Get the HDU and a list of cells below it
     pmHDU *hdu = pmHDUFromChip(chip);   // The HDU in the chip
@@ -536,4 +540,6 @@
                         )
 {
+    PS_ASSERT_PTR_NON_NULL(fpa, false);
+
     // Get the HDU and a list of cells below it
     pmHDU *hdu = pmHDUFromFPA(fpa);     // The HDU in the FPA
Index: trunk/psModules/src/camera/pmHDUUtils.c
===================================================================
--- trunk/psModules/src/camera/pmHDUUtils.c	(revision 7276)
+++ trunk/psModules/src/camera/pmHDUUtils.c	(revision 7278)
@@ -8,4 +8,5 @@
                    )
 {
+    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
     return fpa->hdu;
 }
@@ -14,4 +15,6 @@
                     )
 {
+    PS_ASSERT_PTR_NON_NULL(chip, NULL);
+
     pmHDU *hdu = chip->hdu;             // The HDU information
     if (!hdu) {
@@ -25,4 +28,6 @@
                     )
 {
+    PS_ASSERT_PTR_NON_NULL(cell, NULL);
+
     pmHDU *hdu = cell->hdu;             // The HDU information
     if (!hdu) {
@@ -33,9 +38,10 @@
 }
 
-pmHDU *pmHDUFromReadout (pmReadout *readout)
+pmHDU *pmHDUFromReadout(pmReadout *readout)
 {
+    PS_ASSERT_PTR_NON_NULL(readout, NULL);
 
     pmCell *cell = readout->parent; // cell containing this readout;
-    pmHDU *hdu = pmHDUFromCell (cell);
+    pmHDU *hdu = pmHDUFromCell(cell);
     return hdu;
 }
@@ -64,4 +70,6 @@
                )
 {
+    PS_ASSERT_PTR_NON_NULL(hdu,);
+
     if (hdu->phu) {
         psTrace(__func__, level, "HDU: %s (PHU)\n", hdu->extname);
