Index: /branches/rel10_ifa/psModules/src/astrom/Makefile.am
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/Makefile.am	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/Makefile.am	(revision 6552)
@@ -5,29 +5,25 @@
 libpsmoduleastrom_la_SOURCES  = \
 	pmFPA.c \
-	pmFPAAstrometry.c \
-	pmAstrometryObjects.c \
 	pmFPAConstruct.c \
 	pmFPARead.c \
-	pmFPAWrite.c \
-        pmFPAfile.c \
-        pmFPAview.c \
+	pmHDU.c \
 	pmReadout.c \
-	psAdditionals.c \
 	pmConcepts.c \
 	pmConceptsRead.c \
 	pmConceptsWrite.c \
-	pmConceptsStandard.c \
-	pmChipMosaic.c
+	pmConceptsStandard.c
+#	pmChipMosaic.c
+#	pmFPAfile.c
+#	pmFPAview.c
+#	pmFPAWrite.c
+#	pmFPAAstrometry.c
+#	pmAstrometryObjects.c
 
 psmoduleincludedir = $(includedir)
 psmoduleinclude_HEADERS = \
 	pmFPA.h \
-	pmFPAAstrometry.h \
-	pmAstrometryObjects.h \
 	pmFPAConstruct.h \
 	pmFPARead.h \
-	pmFPAWrite.h \
-        pmFPAfile.c \
-        pmFPAview.c \
+	pmHDU.h \
 	pmReadout.h \
 	psAdditionals.h \
@@ -35,4 +31,9 @@
 	pmConceptsRead.h \
 	pmConceptsWrite.h \
-	pmConceptsStandard.h \
-	pmChipMosaic.h 
+	pmConceptsStandard.h
+#	pmChipMosaic.h 
+#	pmFPAfile.c
+#	pmFPAview.c
+#	pmFPAWrite.h
+#	pmFPAAstrometry.h
+#	pmAstrometryObjects.h
Index: /branches/rel10_ifa/psModules/src/astrom/pmConcepts.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmConcepts.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmConcepts.c	(revision 6552)
@@ -154,6 +154,10 @@
             }
         }
-        psMetadataAddItem(target, conceptItem, PS_LIST_TAIL, PS_META_REPLACE);
-        psFree(conceptItem);            // Drop reference
+        if (conceptItem) {
+            psMetadataAddItem(target, conceptItem, PS_LIST_TAIL, PS_META_REPLACE);
+            psFree(conceptItem);        // Drop reference
+        }
+        // No error if conceptItem is NULL, since that may only mean that the required information isn't
+        // present yet.
     }
     psFree(specsIter);
@@ -537,5 +541,5 @@
 {
     // Copy FPA concepts
-    target->concepts = pap_psMetadataCopy(target->concepts, source->concepts);
+    target->concepts = psMetadataCopy(target->concepts, source->concepts);
 
     // Copy chip concepts
@@ -553,5 +557,5 @@
             continue;
         }
-        targetChip->concepts = pap_psMetadataCopy(targetChip->concepts, sourceChip->concepts);
+        targetChip->concepts = psMetadataCopy(targetChip->concepts, sourceChip->concepts);
 
         // Copy cell concepts
@@ -569,5 +573,5 @@
                 continue;
             }
-            targetCell->concepts = pap_psMetadataCopy(targetCell->concepts, sourceCell->concepts);
+            targetCell->concepts = psMetadataCopy(targetCell->concepts, sourceCell->concepts);
         }
     }
Index: /branches/rel10_ifa/psModules/src/astrom/pmConcepts.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmConcepts.h	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmConcepts.h	(revision 6552)
@@ -40,6 +40,17 @@
                       );
 
+#if 0
+// Some specificity to reading and writing concepts
+typedef enum {
+    PM_CONCEPT_SOURCE_ALL      = 0x00,  // Do all sources
+    PM_CONCEPT_SOURCE_CAMERA   = 0x01,  // Do concepts that come from the camera information
+    PM_CONCEPT_SOURCE_DEFAULTS = 0x02,  // Do concepts that come from defaults
+    PM_CONCEPT_SOURCE_HEADER   = 0x04,  // Do concepts that come from FITS header
+    PM_CONCEPT_SOURCE_DATABASE = 0x08   // Do concepts that come from database
+} pmConceptSource;
+#endif
+
 // Set blanks, read or write concepts at the appropriate level
-bool pmConceptsBlankFPA(pmFPA *fpa    // FPA for which to set blank concepts
+bool pmConceptsBlankFPA(pmFPA *fpa      // FPA for which to set blank concepts
                        );
 bool pmConceptsReadFPA(pmFPA *fpa,      // FPA for which to read concepts
@@ -49,5 +60,5 @@
                         psDB *db        // Database handle
                        );
-bool pmConceptsBlankChip(pmChip *chip // FPA for which to set blank concepts
+bool pmConceptsBlankChip(pmChip *chip   // FPA for which to set blank concepts
                         );
 bool pmConceptsReadChip(pmChip *chip,   // Chip for which to read concepts
@@ -55,7 +66,7 @@
                        );
 bool pmConceptsWriteChip(pmChip *chip,  // Chip for which to write concepts
-                         psDB *db        // Database handle
+                         psDB *db       // Database handle
                         );
-bool pmConceptsBlankCell(pmCell *cell // Cell for which to set blank concepts
+bool pmConceptsBlankCell(pmCell *cell   // Cell for which to set blank concepts
                         );
 bool pmConceptsReadCell(pmCell *cell,   // Cell for which to read concepts
Index: /branches/rel10_ifa/psModules/src/astrom/pmConceptsRead.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmConceptsRead.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmConceptsRead.c	(revision 6552)
@@ -13,5 +13,5 @@
 {
     if (cell) {
-        psMetadata *camera = cell->camera;      // Camera data
+        psMetadata *camera = cell->config; // Camera configuration
         psMetadataItem *item = psMetadataLookup(camera, concept);
         return item;
@@ -55,12 +55,4 @@
         if (fpa->hdu) {
             psMetadataItem *fpaItem = psMetadataLookup(fpa->hdu->header, keyword);
-            if (fpaItem) {
-                // XXX: Need to clean up before returning
-                return fpaItem;
-            }
-        }
-
-        if (fpa->phu) {
-            psMetadataItem *fpaItem = psMetadataLookup(fpa->phu, keyword);
             if (fpaItem) {
                 // XXX: Need to clean up before returning
Index: /branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c	(revision 6552)
@@ -663,5 +663,5 @@
     if (strcasecmp(source, "VALUE") == 0) {
         // Check that it's the same value as stored in the camera
-        psString checkString = psMetadataLookupStr(NULL, cell->camera, "CELL.TRIMSEC");
+        psString checkString = psMetadataLookupStr(NULL, cell->config, "CELL.TRIMSEC");
         psRegion checkRegion = psRegionFromString(checkString);
         if (! COMPARE_REGIONS(&checkRegion, trimsec)) {
@@ -709,5 +709,5 @@
     if (strcasecmp(source, "VALUE") == 0) {
         // Check that it's the same value as stored in the camera
-        psString checkString = psMetadataLookupStr(NULL, cell->camera, "CELL.BIASSEC");
+        psString checkString = psMetadataLookupStr(NULL, cell->config, "CELL.BIASSEC");
         psList *checkList = psStringSplit(checkString, " ;");
         if (biassecs->n != checkList->n) {
@@ -763,5 +763,5 @@
 
     if (strcasecmp(source, "HEADER") == 0) {
-        psString keywordsString = psMetadataLookupStr(NULL, cell->camera, "CELL.BIASSEC");
+        psString keywordsString = psMetadataLookupStr(NULL, cell->config, "CELL.BIASSEC");
         psList *keywords = psStringSplit(keywordsString, " ,;");
         if (biassecs->n != keywords->n) {
Index: /branches/rel10_ifa/psModules/src/astrom/pmConceptsWrite.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmConceptsWrite.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmConceptsWrite.c	(revision 6552)
@@ -73,9 +73,9 @@
                            )
 {
-    if (! cell->camera) {
+    if (! cell->config) {
         return false;
     }
     if (cell) {
-        psMetadataItem *item = psMetadataLookup(cell->camera, concept->name); // Info we want
+        psMetadataItem *item = psMetadataLookup(cell->config, concept->name); // Info we want
         return compareConcepts(item, concept);
     }
@@ -138,12 +138,4 @@
             psTrace(__func__, 7, "Adding to the FPA level header...\n");
             psMetadataAddItem(fpa->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE);
-            status = true;
-        } else {
-            // In desperation, add to the PHU --- it HAS to be in the header somewhere!
-            if (! fpa->phu) {
-                fpa->phu = psMetadataAlloc();
-            }
-            psTrace(__func__, 7, "Adding to the PHU...\n");
-            psMetadataAddItem(fpa->phu, headerItem, PS_LIST_TAIL, PS_META_REPLACE);
             status = true;
         }
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPA.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPA.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPA.c	(revision 6552)
@@ -12,6 +12,6 @@
 * XXX: Should we implement non-linear cell->chip transforms?
 *
-*  @version $Revision: 1.1.4.1 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-02-17 17:13:41 $
+*  @version $Revision: 1.1.4.2 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-03-09 03:08:08 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -26,4 +26,5 @@
 #include "pslib.h"
 
+#include "pmHDU.h"
 #include "pmFPA.h"
 #include "pmConcepts.h"
@@ -97,10 +98,7 @@
         #endif
 
-        psFree(cell->toChip);
-        psFree(cell->toFPA);
-        psFree(cell->toSky);
         psFree(cell->concepts);
         psFree(cell->analysis);
-        psFree(cell->camera);
+        psFree(cell->config);
         psFree(cell->hdu);
     }
@@ -135,6 +133,10 @@
         #endif
 
+        #if 0
+
         psFree(chip->toFPA);
         psFree(chip->fromFPA);
+        #endif
+
         psFree(chip->concepts);
         psFree(chip->analysis);
@@ -148,7 +150,11 @@
     if (fpa != NULL) {
         psTrace(__func__, 9, "Freeing fpa %lx\n", (size_t)fpa);
+        #if 0
+
         psFree(fpa->fromTangentPlane);
         psFree(fpa->toTangentPlane);
         psFree(fpa->projection);
+        #endif
+
         psFree(fpa->concepts);
         psFree(fpa->analysis);
@@ -172,5 +178,4 @@
         psFree(fpa->chips);
         psFree(fpa->hdu);
-        psFree(fpa->phu);
     }
 }
@@ -230,26 +235,8 @@
 
 
-
-void p_pmHDUFree(p_pmHDU *hdu)
-{
-    if (hdu) {
-        psFree(hdu->extname);
-        psFree(hdu->header);
-        psFree(hdu->images);
-        psFree(hdu->masks);
-        psFree(hdu->weights);
-    }
-}
-
-// XXX: Verify these default values for row0, col0, rowBins, colBins
-// PAP: These values may disappear in the future in favour of values in parent->concepts?
 pmReadout *pmReadoutAlloc(pmCell *cell)
 {
     pmReadout *tmpReadout = (pmReadout *) psAlloc(sizeof(pmReadout));
 
-    tmpReadout->col0 = 0;
-    tmpReadout->row0 = 0;
-    tmpReadout->colBins = 0;
-    tmpReadout->rowBins = 0;
     tmpReadout->image = NULL;
     tmpReadout->mask = NULL;
@@ -276,14 +263,8 @@
 pmCell *pmCellAlloc(
     pmChip *chip,
-    psMetadata *cameraData,
     const char *name)
 {
     pmCell *tmpCell = (pmCell *) psAlloc(sizeof(pmCell));
 
-    tmpCell->col0 = 0;
-    tmpCell->row0 = 0;
-    tmpCell->toChip = NULL;
-    tmpCell->toFPA = NULL;
-    tmpCell->toSky = NULL;
     tmpCell->concepts = psMetadataAlloc();
     psBool rc = psMetadataAddStr(tmpCell->concepts, PS_LIST_HEAD, "CELL.NAME", 0, NULL, name);
@@ -291,5 +272,5 @@
         psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not add CELL.NAME to metadata.\n");
     }
-    tmpCell->camera = psMemIncrRefCounter(cameraData);
+    tmpCell->config = NULL;
     tmpCell->analysis = psMetadataAlloc();
     tmpCell->readouts = psArrayAlloc(0);
@@ -323,8 +304,12 @@
     pmChip *tmpChip = (pmChip *) psAlloc(sizeof(pmChip));
 
+    #if 0
+
     tmpChip->col0 = 0;
     tmpChip->row0 = 0;
     tmpChip->toFPA = NULL;
     tmpChip->fromFPA = NULL;
+    #endif
+
     tmpChip->concepts = psMetadataAlloc();
     psBool rc = psMetadataAddStr(tmpChip->concepts, PS_LIST_HEAD, "CHIP.NAME", 0, NULL, name);
@@ -359,7 +344,11 @@
     pmFPA *tmpFPA = (pmFPA *) psAlloc(sizeof(pmFPA));
 
+    #if 0
+
     tmpFPA->fromTangentPlane = NULL;
     tmpFPA->toTangentPlane = NULL;
     tmpFPA->projection = NULL;
+    #endif
+
     tmpFPA->concepts = psMetadataAlloc();
     tmpFPA->analysis = NULL;
@@ -367,5 +356,4 @@
     tmpFPA->chips = psArrayAlloc(0);
     tmpFPA->hdu = NULL;
-    tmpFPA->phu = NULL;
 
     pmConceptsBlankFPA(tmpFPA);
@@ -375,14 +363,28 @@
 }
 
-p_pmHDU *p_pmHDUAlloc(const char *extname)
-{
-    p_pmHDU *hdu = psAlloc(sizeof(p_pmHDU));
-    psMemSetDeallocator(hdu, (psFreeFunc)p_pmHDUFree);
-
-    hdu->extname = psStringCopy(extname);
-    hdu->header = NULL;
-    hdu->images = NULL;
-    hdu->masks = NULL;
-    hdu->weights = NULL;
+pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
+                   )
+{
+    return fpa->hdu;
+}
+
+pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
+                    )
+{
+    pmHDU *hdu = chip->hdu;             // The HDU information
+    if (!hdu) {
+        hdu = pmHDUFromFPA(chip->parent); // Grab HDU info from the FPA
+    }
+
+    return hdu;
+}
+
+pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
+                    )
+{
+    pmHDU *hdu = cell->hdu;             // The HDU information
+    if (!hdu) {
+        hdu = pmHDUFromChip(cell->parent); // Grab HDU info from the chip
+    }
 
     return hdu;
@@ -599,5 +601,5 @@
 }
 
-
+#if 0
 bool pmCellSetWeights(pmCell *cell // Cell for which to set weights
                      )
@@ -609,5 +611,5 @@
     float bad = psMetadataLookupF32(NULL, cell->concepts, "CELL.BAD"); // Bad level
 
-    p_pmHDU *hdu = cell->hdu;           // The data unit, containing the weight and mask originals
+    pmHDU *hdu = cell->hdu;             // The data unit, containing the weight and mask originals
     if (!hdu) {
         pmChip *chip = cell->parent;    // The parent chip
@@ -682,3 +684,3 @@
 }
 
-
+#endif
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPA.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPA.h	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPA.h	(revision 6552)
@@ -7,6 +7,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.1.4.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-03-04 03:03:28 $
+*  @version $Revision: 1.1.4.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-03-09 03:08:08 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -18,10 +18,10 @@
 #include <config.h>
 #endif
+
 #include "pslib.h"
-#include "psDB.h"
+#include "pmHDU.h"
 
 /// @addtogroup AstroImage
 /// @{
-
 
 /** Focal plane data structure
@@ -43,8 +43,10 @@
 typedef struct
 {
+    #if 0
     // Astrometric transformations
     psPlaneDistort* fromTangentPlane;   ///< Transformation from tangent plane to focal plane
     psPlaneDistort* toTangentPlane;     ///< Transformation from focal plane to tangent plane
     psProjection *projection;           ///< Projection from tangent plane to sky
+    #endif
     // Information
     psMetadata *concepts;               ///< Cache for PS concepts
@@ -72,4 +74,5 @@
 typedef struct
 {
+    #if 0
     // Offset specifying position on focal plane
     int col0;                           ///< Offset from the left of FPA.
@@ -78,4 +81,5 @@
     psPlaneTransform* toFPA;            ///< Transformation from chip to FPA coordinates
     psPlaneTransform* fromFPA;          ///< Transformation from FPA to chip coordinates
+    #endif
     // Information
     psMetadata *concepts;               ///< Cache for PS concepts
@@ -100,14 +104,6 @@
 typedef struct
 {
-    // Offset specifying position on chip
-    int col0;                           ///< Offset from the left of chip.
-    int row0;                           ///< Offset from the bottom of chip.
-    // Astrometric transformations
-    psPlaneTransform* toChip;           ///< Transformations from cell to chip coordinates
-    psPlaneTransform* toFPA;            ///< Transformations from cell to FPA coordinates
-    psPlaneTransform* toSky;            ///< Transformations from cell to sky coordinates
-    // Information
     psMetadata *concepts;               ///< Cache for PS concepts
-    psMetadata *camera;                 ///< Camera Info
+    psMetadata *config;                 ///< Cell configuration info
     psMetadata *analysis;               ///< Cell-level analysis metadata
     psArray *readouts;                  ///< The readouts (referred to by number)
@@ -168,5 +164,4 @@
 pmCell *pmCellAlloc(
     pmChip *chip,       ///< Parent chip
-    psMetadata *cameraData, ///< Camera data
     const char *name    ///< Name of cell
 );
@@ -199,13 +194,11 @@
 );
 
-/** Allocates a p_pmHDU
- *
- * XXX: More detailed description
- *
- * @return p_pmHDU*    newly allocated p_pmHDU
- */
-p_pmHDU *p_pmHDUAlloc(const char *extname // Extension name
-                     );
-
+// Find the HDU in the FPA hierarchy
+pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
+                   );
+pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
+                    );
+pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
+                    );
 
 /** Verify parent links.
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c	(revision 6552)
@@ -11,11 +11,11 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-// Read data for a particular cell from the camera configuration
-static psMetadata *getCellData(const psMetadata *camera, // The camera configuration
+// Read data for a particular cell from the camera format description
+static psMetadata *getCellData(const psMetadata *format, // The camera format description
                                const char *cellName // The name of the cell
                               )
 {
     bool status = true;                 // Result of MD lookup
-    psMetadata *cells = psMetadataLookupMD(&status, camera, "CELLS"); // The CELLS
+    psMetadata *cells = psMetadataLookupMD(&status, format, "CELLS"); // The CELLS
     if (! status) {
         psError(PS_ERR_IO, false, "Unable to determine CELLS of camera.\n");
@@ -28,29 +28,95 @@
     }
 
-    #if 0
-    // Need to create a new instance, so that each cell can work with its own
-    psMetadata *copy = psMetadataAlloc();
-    psMetadataIterator *iter = psMetadataIteratorAlloc(cellData, PS_LIST_HEAD, NULL); // Iterator
-    psMetadataItem *item = NULL;        // Item from iteration
-    while (item = psMetadataGetAndIncrement(iter)) {
-        if (item->type == PS_DATA_METADATA_MULTI || item->type == PS_DATA_METADATA) {
-            psLogMsg(__func__, PS_LOG_WARN, "PS_DATA_METADATA_MULTI and PS_DATA_METADATA are not supported "
-                     "in a cell definition --- %s ignored.\n", item->name);
+    return cellData;
+}
+
+// Find a chip by name
+static pmChip *findChip(pmFPA *fpa, // FPA in which to find the chip
+                        const char *name // Name of the chip
+                       )
+{
+    psArray *chips = fpa->chips;    // Array of chips
+    for (int i = 0; i < chips->n; i++) {
+        pmChip *chip = chips->data[i]; // The chip of interest
+        psString testName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of this chip
+        if (strcmp(name, testName) == 0) {
+            return chip;
+        }
+    }
+
+    psError(PS_ERR_IO, true, "Unable to find chip %s\n", name);
+    return NULL;
+}
+
+// Find a cell by name
+static pmCell *findCell(pmChip *chip, // Chip in which to find the cell
+                        const char *name // Name of the cell
+                       )
+{
+    psArray *cells = chip->cells;    // Array of cells
+    for (int i = 0; i < cells->n; i++) {
+        pmCell *cell = cells->data[i]; // The cell of interest
+        psString testName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of this cell
+        if (strcmp(name, testName) == 0) {
+            return cell;
+        }
+    }
+
+    psError(PS_ERR_IO, true, "Unable to find cell %s\n", name);
+    return NULL;
+}
+
+// Parse a list of first:second pairs in a string
+static bool parsePairs(psArray **first, // Array of the first values
+                       psArray **second, // Array of the second values
+                       const char *string // The string to parse
+                      )
+{
+    bool allOK = true;                  // Everything was OK?
+    psList *pairs = psStringSplit(string, " ,;"); // List of the pairs
+    *first = psArrayAlloc(pairs->n);
+    *second = psArrayAlloc(pairs->n);
+    int num = 0;
+    psListIterator *pairsIter = psListIteratorAlloc(pairs, PS_LIST_HEAD, false); // Iterator for pairs
+    psString pair = NULL;               // "first:second" pair string
+    while ((pair = psListGetAndIncrement(pairsIter))) {
+        psList *firstSecond = psStringSplit(pair, ":"); // List containing the first and second
+        if (firstSecond->n != 2) {
+            psLogMsg(__func__, PS_LOG_WARN, "Badly formated first:second pair: %s --- ignored.\n", pair);
+            allOK = false;
             continue;
         }
-        if (! psMetadataAdd(copy, PS_LIST_TAIL, item->name, item->type, item->comment, item->data.V)) {
-            psAbort(__func__, "Should never reach here!\n");
-        }
-    }
-    psFree(iter);
-
-    return copy;
-    #else
-
-    return cellData;
-    #endif
-
-}
-
+        psString firstBit = psListGet(firstSecond, PS_LIST_HEAD); // The first bit
+        psString secondBit = psListGet(firstSecond, PS_LIST_TAIL); // The second bit
+        psArraySet(*first, num, firstBit);
+        psArraySet(*second, num, secondBit);
+        num++;
+        psFree(firstSecond);
+    }
+    psFree(pairsIter);
+    psFree(pairs);
+
+    return allOK;
+}
+
+// Get the chip name from a primary header lookup
+static psString chipNameFromHeader(const psMetadata *format, // FORMAT within the camera format description
+                                   const psMetadata *header // Primary header
+                                  )
+{
+    bool mdok = true;                   // Result of MD lookup
+    psString chipNameHeader = psMetadataLookupStr(&mdok, format, "CHIP.NAME");
+    if (!mdok || strlen(chipNameHeader) == 0) {
+        psError(PS_ERR_IO, false, "Unable to find CHIP.NAME in the FORMAT.\n");
+        return false;
+    }
+    psString chipName = psMetadataLookupStr(&mdok, header, chipNameHeader);
+    if (!chipName || strlen(chipName) == 0) {
+        psError(PS_ERR_IO, false, "Unable to find %s in primary header to identify chip name.\n", chipName);
+        return NULL;
+    }
+
+    return chipName;
+}
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -58,4 +124,228 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
+// Construct an FPA instance on the basis of a camera configuration
+pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
+                     )
+{
+    pmFPA *fpa = pmFPAAlloc(camera);    // The FPA to fill out
+
+    bool mdok = true;                   // Status from MD lookups
+    psMetadata *components = psMetadataLookupMD(&mdok, camera, "FPA"); // FPA components
+    psMetadataIterator *componentsIter = psMetadataIteratorAlloc(components, PS_LIST_HEAD, NULL);
+    psMetadataItem *componentsItem = NULL; // Item from components
+    while ((componentsItem = psMetadataGetAndIncrement(componentsIter))) {
+        const char *chipName = componentsItem->name; // Name of the chip
+        if (componentsItem->type != PS_DATA_STRING) {
+            psLogMsg(__func__, PS_LOG_WARN, "Element %s in FPA within the camera configuration is not of "
+                     "type STR (type=%x) --- ignored.\n", chipName, componentsItem->type);
+            continue;
+        }
+        pmChip *chip = pmChipAlloc(fpa, chipName); // The chip
+        psList *cellNames = psStringSplit(componentsItem->data.V, " ,;"); // List of cell names
+        psListIterator *cellNamesIter = psListIteratorAlloc(cellNames, PS_LIST_HEAD, false); // Iterator
+        psString cellName = NULL;       // Name of cell
+        while ((cellName = psListGetAndIncrement(cellNamesIter))) {
+            pmCell *cell = pmCellAlloc(chip, cellName); // New cell
+            psFree(cell);               // Drop reference
+        }
+        psFree(chip);                   // Drop reference
+        psFree(cellNamesIter);
+    }
+    psFree(componentsIter);
+
+    return fpa;
+}
+
+
+// Add an input file to the FPA
+bool pmFPAAddSource(pmFPA *fpa,         // FPA to which to add
+                    pmChip *chip,       // Chip to which to add, or NULL
+                    pmCell *cell,       // Cell to which to add, or NULL
+                    psMetadata *phu,    // Primary header of file
+                    const psMetadata *format // Format of file
+                   )
+{
+    // Just in case someone's playing silly billy...
+    if (cell && !chip) {
+        chip = cell->parent;
+    }
+    if (chip && !fpa) {
+        fpa = chip->parent;
+    }
+
+    bool mdok = true;                   // Status from metadata lookups
+    psMetadata *formatSpec = psMetadataLookupMD(&mdok, format, "FORMAT"); // The format specification
+    if (!mdok || !formatSpec) {
+        psError(PS_ERR_IO, false, "Unable to find FORMAT in the camera format configuration.\n");
+        return false;
+    }
+
+    // Where does the PHU go?
+    const char *phuType = psMetadataLookupStr(&mdok, formatSpec, "PHU"); // What is the PHU?
+    if (!mdok || strlen(phuType) == 0) {
+        psError(PS_ERR_IO, false, "Unable to find PHU in the format specification.\n");
+        return false;
+    }
+    pmHDU *phdu = pmHDUAlloc("PHU");    // The primary header data unit
+    phdu->header = psMemIncrRefCounter(phu);
+    if (fpa && !fpa->hdu && strcasecmp(phuType, "FPA") == 0) {
+        fpa->hdu = phdu;
+    } else if (chip && !chip->hdu && strcasecmp(phuType, "CHIP") == 0) {
+        chip->hdu = phdu;
+    } else if (cell && !cell->hdu && strcasecmp(phuType, "CELL") == 0) {
+        // cell->hdu = phdu;
+        psError(PS_ERR_IO, true, "The case of PHU == CELL has not been written yet!\n");
+        return false;
+    }
+
+    // And the individual extensions?
+    const char *extType = psMetadataLookupStr(&mdok, formatSpec, "EXTENSIONS"); // What's in the extns?
+    if (!mdok || strlen(extType) == 0) {
+        psError(PS_ERR_IO, false, "Unable to find EXTENSIONS in the format specification.\n");
+        return false;
+    }
+    psMetadata *contents = psMetadataLookupMD(&mdok, format, "CONTENTS"); // The contents of the FITS file
+    if (!mdok || !contents) {
+        psError(PS_ERR_IO, false, "Unable to find CONTENTS in the camera format configuration.\n");
+        return false;
+    }
+
+    if (strcasecmp(extType, "NONE") == 0) {
+        // No extensions --- it's all in the PHU
+        psString chipType = chipNameFromHeader(formatSpec, phu); // Type of chip
+        psString content = psMetadataLookupStr(&mdok, contents, chipType); // The content line
+
+        // Parse the list of first:second
+        psArray *names = NULL;          // The first bits
+        psArray *values = NULL;         // The second bits
+        parsePairs(&names, &values, content);
+        for (int i = 0; i < names->n; i++) {
+            psString chipName = names->data[i]; // The name of the chip
+            psString cellName = values->data[i]; // The name of the cell
+            pmChip *chip = findChip(fpa, chipName); // The chip we're looking for
+            pmCell *cell = findCell(chip, cellName); // The cell we're looking for
+            psMetadata *cellData = getCellData(format, cellName); // Data for this cell
+            if (! cellData) {
+                psLogMsg(__func__, PS_LOG_WARN, "Unable to find data for %s in CELLS --- ignored.\n",
+                         cellName);
+                continue;
+            }
+
+            // Have already plugged in the PHU
+
+            // Put in the cell data
+            if (cell->config) {
+                psLogMsg(__func__, PS_LOG_WARN, "Overwriting cell data in chip %s, cell %s\n", chipName,
+                         cellName);
+                psFree(cell->config); // Make way!
+            }
+            cell->config = psMemIncrRefCounter(cellData);
+        }
+    }
+
+
+    // Go through the contents
+    psMetadataIterator *contentsIter = psMetadataIteratorAlloc(contents, PS_LIST_HEAD, NULL);
+    psMetadataItem *contentsItem = NULL; // Item from contents
+    while ((contentsItem = psMetadataGetAndIncrement(contentsIter))) {
+        const char *extName = contentsItem->name;
+        if (contentsItem->type != PS_DATA_STRING) {
+            psLogMsg(__func__, PS_LOG_WARN, "CONTENTS item %s is not of type STR --- ignored.\n", extName);
+            continue;
+        }
+
+        pmHDU *hdu = pmHDUAlloc(extName); // The extension
+
+        // Parse the list of first:second
+        psArray *names = NULL;          // The first bits
+        psArray *values = NULL;         // The second bits
+        parsePairs(&names, &values, contentsItem->data.V);
+
+        // XXX Memory problems in here --> leaks and/or double frees???
+        if (strcasecmp(extType, "CHIP") == 0) {
+            // Extensions are chips
+            for (int i = 0; i < names->n; i++) {
+                psString chipName = names->data[i]; // The name of the chip
+                psString cellName = values->data[i]; // The name of the cell
+                pmChip *chip = findChip(fpa, chipName); // The chip we're looking for
+                pmCell *cell = findCell(chip, cellName); // The cell we're looking for
+                psMetadata *cellData = getCellData(format, cellName); // Data for this cell
+                if (! cellData) {
+                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find data for %s in CELLS --- ignored.\n",
+                             cellName);
+                    continue;
+                }
+
+                // Put in the extension
+                if (chip->hdu) {
+                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s\n", chipName);
+                    psFree(chip->hdu);  // Make way!
+                }
+                chip->hdu = psMemIncrRefCounter(hdu);
+
+                // Put in the cell data
+                if (cell->config) {
+                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting cell data in chip %s, cell %s\n", chipName,
+                             cellName);
+                    psFree(cell->config); // Make way!
+                }
+                cell->config = psMemIncrRefCounter(cellData);
+            }
+
+        } else if (strcasecmp(extType, "CELL") == 0) {
+            // Extensions are cells
+            psString chipName = NULL;   // Name of chip under consideration
+            pmChip *chip = NULL;        // The chip we're looking for
+            if (! fpa->hdu->phu) {
+                // Need to look up the name of the chip
+                chipName = chipNameFromHeader(formatSpec, phu);
+                chip = findChip(fpa, chipName);
+            }
+            for (int i = 0; i < names->n; i++) {
+                psString cellType = values->data[i]; // The type of the cell
+                psString cellName = NULL; // The name of the cell
+                if (fpa->hdu->phu) {
+                    // We've got chipName:cellType with cellType == cellName
+                    chipName = names->data[i];
+                    cellName = cellType;
+                    chip = findChip(fpa, chipName);
+                } else {
+                    // We've got cellName:cellType and the chipName comes from before
+                    cellName = names->data[i];
+                }
+                psMetadata *cellData = getCellData(format, cellType); // Data for this cell
+                pmCell *cell = findCell(chip, cellName); // The cell we're looking for
+
+                // Put in the extension
+                if (cell->hdu) {
+                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s, cell %s\n", chipName,
+                             cellName);
+                    psFree(cell->hdu);
+                }
+                cell->hdu = psMemIncrRefCounter(hdu);
+
+                // Put in the cell data
+                if (cell->config) {
+                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting cell data in chip %s, cell %s\n", chipName,
+                             cellName);
+                    psFree(cell->config);
+                }
+                cell->config = psMemIncrRefCounter(cellData);
+            }
+
+        }
+        psFree(hdu);
+        psFree(names);
+        psFree(values);
+    }
+    psFree(contentsIter);
+
+    return true;
+}
+
+
+
+
+#if 0
 pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
                      )
@@ -270,7 +560,10 @@
     return fpa;
 }
+#endif
+
 
 // Print out the focal plane structure
-void pmFPAPrint(pmFPA *fpa              // FPA to print
+void pmFPAPrint(pmFPA *fpa,             // FPA to print
+                bool concepts           // Print concepts?
                )
 {
@@ -279,8 +572,10 @@
         psTrace(__func__, 2, "---> FPA is extension %s.\n", fpa->hdu->extname);
         if (! fpa->hdu->images) {
-            psTrace(__func__, 2, "---> NO PIXELS for extension %s\n", fpa->hdu->extname);
-        }
-    }
-    psMetadataPrint(fpa->concepts, 2);
+            psTrace(__func__, 2, "---> NO PIXELS read in for extension %s\n", fpa->hdu->extname);
+        }
+    }
+    if (concepts) {
+        psMetadataPrint(fpa->concepts, 2);
+    }
 
     psArray *chips = fpa->chips;        // Array of chips
@@ -292,8 +587,10 @@
             psTrace(__func__, 4, "---> Chip is extension %s.\n", chip->hdu->extname);
             if (! chip->hdu->images) {
-                psTrace(__func__, 4, "---> NO PIXELS for extension %s\n", chip->hdu->extname);
-            }
-        }
-        psMetadataPrint(chip->concepts, 4);
+                psTrace(__func__, 4, "---> NO PIXELS read in for extension %s\n", chip->hdu->extname);
+            }
+        }
+        if (concepts) {
+            psMetadataPrint(chip->concepts, 4);
+        }
 
         // Iterate over the chip
@@ -305,8 +602,10 @@
                 psTrace(__func__, 6, "---> Cell is extension %s.\n", cell->hdu->extname);
                 if (! cell->hdu->images) {
-                    psTrace(__func__, 6, "---> NO PIXELS for extension %s\n", cell->hdu->extname);
-                }
-            }
-            psMetadataPrint(cell->concepts, 6);
+                    psTrace(__func__, 6, "---> NO PIXELS read in for extension %s\n", cell->hdu->extname);
+                }
+            }
+            if (concepts) {
+                psMetadataPrint(cell->concepts, 6);
+            }
 
             psTrace(__func__, 7, "Readouts:\n");
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.h	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.h	(revision 6552)
@@ -5,10 +5,19 @@
 #include "pmFPA.h"
 
-// Read the contents of a FITS file (format specified by the camera configuration) into memory
+// Construct an FPA instance on the basis of a camera configuration
 pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
                      );
 
+// Add an input file to the FPA
+bool pmFPAAddSource(pmFPA *fpa,         // FPA to which to add
+                    pmChip *chip,       // Chip to which to add, or NULL
+                    pmCell *cell,       // Cell to which to add, or NULL
+                    psMetadata *phu,    // Primary header of file
+                    const psMetadata *format // Format of file
+                   );
+
 // Print out the FPA
-void pmFPAPrint(pmFPA *fpa              // FPA to print
+void pmFPAPrint(pmFPA *fpa,             // FPA to print
+                bool concepts           // Print concepts?
                );
 
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPARead.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPARead.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPARead.c	(revision 6552)
@@ -12,5 +12,5 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-
+#if 0
 // Read a FITS extension into a chip
 static bool readExtension(p_pmHDU *hdu, // Pixel data into which to read
@@ -135,17 +135,6 @@
     return true;
 }
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Public functions
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-bool pmReadoutRead(pmReadout *readout,  // Readout to read into
-                   psFits *fits         // FITS file from which to read
-                  )
-{
-    //
-
-}
+#endif
+
 
 // Carve a readout from the image pixels
@@ -162,5 +151,5 @@
 
     // Get the list of overscans
-    psListIterator *iter = psListIteratorAlloc(biassecs, PS_LIST_HEAD, false); // Iterator
+    psListIterator *iter = psListIteratorAlloc((psList*)biassecs, PS_LIST_HEAD, false); // Iterator
     psRegion *biassec = NULL;       // A BIASSEC region from the list
     while ((biassec = psListGetAndIncrement(iter))) {
@@ -174,5 +163,19 @@
 }
 
-
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Public functions
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+#if 0
+bool pmReadoutRead(pmReadout *readout,  // Readout to read into
+                   psFits *fits         // FITS file from which to read
+                  )
+{
+    // This is very very different
+}
+#endif
+
+// Read in the cell, and allocate the readouts
 bool pmCellRead(pmCell *cell,           // Cell to read into
                 psFits *fits,           // FITS file from which to read
@@ -185,7 +188,4 @@
         return false;
     }
-
-    // Read the "concepts"
-    pmConceptsReadCell(cell, db);
 
     // Having read the cell, we now have to cut it up
@@ -205,5 +205,5 @@
 }
 
-
+// Read in the component cells
 bool pmChipRead(pmChip *chip,           // Chip to read into
                 psFits *fits,           // FITS file from which to read
@@ -223,4 +223,5 @@
 }
 
+// Read in the component chips
 bool pmFPARead(pmFPA *fpa,              // FPA to read into
                psFits *fits,            // FITS file from which to read
@@ -228,7 +229,7 @@
               )
 {
-    psArray *chips = fpa->cells;       // Array of cells
+    psArray *chips = fpa->chips;       // Array of chips
     for (int i = 0; i < chips->n; i++) {
-        pmCell *chip = chips->data[i];  // The cell of interest
+        pmChip *chip = chips->data[i];  // The cell of interest
         if (!pmChipRead(chip, fits, db)) {
             psError(PS_ERR_IO, false, "Unable to read chip %d.\n", i);
@@ -239,4 +240,50 @@
     return true;
 }
+
+// Read the PHU into the nominated HDU
+static bool readPHU(pmHDU *hdu,         // HDU to read into
+                    psFits *fits        // FITS file from which to read
+                   )
+{
+    if (! hdu || ! hdu->phu) {
+        return false;                   // Nothing to see here, move along
+    }
+    if (hdu->header) {
+        return true;                    // Already something to see here, no need to gawk at it...  (;
+    }
+    // Read the PHU
+    psFitsMoveExtNum(fits, 0, false);
+    hdu->header = psFitsReadHeader(hdu->header, fits);
+    return true;
+}
+
+// Read the PHU into a cell
+bool pmCellReadPHU(pmCell *cell,        // Cell to read into
+                   psFits *fits         // FITS file from which to read
+                  )
+{
+    return readPHU(cell->hdu, fits) || readPHU(cell->parent->hdu, fits) ||
+           readPHU(cell->parent->parent->hdu, fits);
+
+}
+
+// Read the PHU into a chip
+bool pmChipReadPHU(pmChip *chip,        // Chip to read into
+                   psFits *fits         // FITS file from which to read
+                  )
+{
+    return readPHU(chip->hdu, fits) || readPHU(chip->parent->hdu, fits);
+}
+
+// Read the PHU into an FPA
+bool pmFPAReadPHU(pmFPA *fpa,           // FPA to read into
+                  psFits *fits          // FITS file from which to read
+                 )
+{
+    return readPHU(fpa->hdu, fits);
+}
+
+
+
 
 #if 0
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPARead.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPARead.h	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPARead.h	(revision 6552)
@@ -5,4 +5,34 @@
 #include "pmFPA.h"
 
+
+bool pmCellRead(pmCell *cell,           // Cell to read into
+                psFits *fits,           // FITS file from which to read
+                psDB *db                // Database handle, for "concepts" ingest
+               );
+
+bool pmChipRead(pmChip *chip,           // Chip to read into
+                psFits *fits,           // FITS file from which to read
+                psDB *db                // Database handle, for "concepts" ingest
+               );
+
+bool pmFPARead(pmFPA *fpa,              // FPA to read into
+               psFits *fits,            // FITS file from which to read
+               psDB *db                 // Database handle, for "concepts" ingest
+              );
+
+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
@@ -27,5 +57,5 @@
                      psFits *source     // Source FITS file (for the original data)
                     );
-
+#endif
 
 #endif
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPAWrite.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPAWrite.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPAWrite.c	(revision 6552)
@@ -8,5 +8,5 @@
 
 static bool writeHDU(psFits *fits,      // FITS file to which to write
-                     p_pmHDU *hdu       // Pixel data to write
+                     pmHDU *hdu         // Pixel data to write
                     )
 {
Index: /branches/rel10_ifa/psModules/src/astrom/pmHDU.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmHDU.c	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmHDU.c	(revision 6552)
@@ -9,4 +9,5 @@
 {
     psFree(hdu->extname);
+    psFree(hdu->format);
     psFree(hdu->header);
     psFree(hdu->images);
@@ -32,9 +33,10 @@
         hdu->extname = psStringCopy(extname);
     }
+    hdu->format = NULL;
     hdu->header = NULL;
     hdu->images = NULL;
     hdu->table  = NULL;
 
-    return file;
+    return hdu;
 }
 
@@ -54,6 +56,15 @@
             return false;
         }
-    } else if (! psFitsMoveExtName(fits, hdu->extname)) {
-        psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
+        hdu->phu = true;
+    } else {
+        if (! psFitsMoveExtName(fits, hdu->extname)) {
+            psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
+        }
+        // Now, just in case for some reason the PHU has an extension name that we've moved to....
+        if (psFitsGetExtNum(fits) == 0) {
+            hdu->phu = true;
+        } else {
+            hdu->phu = false;
+        }
     }
 
@@ -63,6 +74,8 @@
     }
 
+    #ifdef FITS_TABLES
     // What type is it?
     if (psFitsIsImage(hdu->header)) {
+        #endif
         if (hdu->images) {
             psFree(hdu->images);        // Blow away anything existing
@@ -70,4 +83,6 @@
         hdu->images = psFitsReadImageCube(fits, psRegionSet(0,0,0,0));
         return true;
+        #ifdef FITS_TABLES
+
     }
     if (psFitsIsTable(hdu->table)) {
@@ -82,4 +97,5 @@
     psError(PS_ERR_UNKNOWN, true, "No idea what this HDU consists of!\n");
     return false;
+    #endif
 }
 
@@ -99,7 +115,11 @@
     }
 
+    #ifdef FITS_TABLES
     if (hdu->images && (!hdu->table || psFitsIsImage(hdu->header))) {
+        #endif
         psFitsWriteImageCube(fits, hdu->header, hdu->images, hdu->extname);
         return true;
+        #ifdef FITS_TABLES
+
     }
 
@@ -111,35 +131,6 @@
     psError(PS_ERR_IO, true, "No idea what this HDU consists of!\n");
     return false;
-}
-
-
-pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
-                   )
-{
-    return fpa->hdu;
-}
-
-pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
-                    )
-{
-    pmHDU *hdu = chip->hdu;             // The HDU information
-    if (!hdu) {
-        hdu = pmHDUFromFPA(chip->parent); // Grab HDU info from the FPA
-    }
-
-    return hdu;
-}
-
-pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
-                    )
-{
-    pmHDU *hdu = cell->hdu;             // The HDU information
-    if (!hdu) {
-        hdu = pmHDUFromChip(cell->parent); // Grab HDU info from the chip
-    }
-
-    return hdu;
-}
-
+    #endif
+}
 
 
Index: /branches/rel10_ifa/psModules/src/astrom/pmHDU.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmHDU.h	(revision 6551)
+++ /branches/rel10_ifa/psModules/src/astrom/pmHDU.h	(revision 6552)
@@ -1,7 +1,4 @@
 #ifndef PM_HDU_H
 #define PM_HDU_H
-
-#include "pslib.h"
-#include "pmFPA.h"
 
 // An instance of the FITS Header Data Unit
@@ -10,4 +7,5 @@
     psString extname;                   // The extension name
     bool phu;                           // Is this the FITS Primary Header Unit
+    psMetadata *format;                 // The camera format
     psMetadata *header;                 // The FITS header, or NULL if primary for FITS; or section info
     psArray *images;                    // The pixel data
@@ -21,14 +19,7 @@
 
 // Read the HDU
-bool pmHDURead(pmHDU *hdu);
-
-
-// Find the HDU in the FPA hierarchy
-pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
-                   );
-pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
-                    );
-pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
-                    );
+bool pmHDURead(pmHDU *hdu,              // HDU to read
+               psFits *fits             // FITS file to read from
+              );
 
 #endif
