Index: /branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h	(revision 6558)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h	(revision 6559)
@@ -1,10 +1,26 @@
+/** @file  pmFPAview.h
+*
+*  @brief Tools to manipulate the FPA structure elements.
+*
+*  @ingroup AstroImage
+*
+*  @author EAM, IfA
+*
+*  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-03-09 03:24:49 $
+*
+*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
+*/
+
+#ifndef PM_FPA_FILE_H
+#define PM_FPA_FILE_H
 
 typedef enum {
-    PM_FPA_FILE_IMAGE;
-    PM_FPA_FILE_SX;
-    PM_FPA_FILE_OBJ;
-    PM_FPA_FILE_CMP;
-    PM_FPA_FILE_CMF;
-    PM_FPA_FILE_RAW;
+    PM_FPA_FILE_IMAGE,
+    PM_FPA_FILE_SX,
+    PM_FPA_FILE_OBJ,
+    PM_FPA_FILE_CMP,
+    PM_FPA_FILE_CMF,
+    PM_FPA_FILE_RAW,
 } pmFPAfileType;
 
@@ -30,5 +46,5 @@
 
 pmFPAfile *pmFPAfileAlloc ();
-pmFile *pmFPAfileDefine (pmFPAview *view, psMetadata *camera, char *name);
+pmFPAfile *pmFPAfileDefine (pmFPAview *view, psMetadata *camera, char *name);
 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view, psMetadata *camera);
 bool pmFPAfileRead (pmFPAfile *file, pmFPAview *view, psMetadata *camera);
@@ -36,2 +52,4 @@
 bool pmFPAfileIOCheck (pmFPAview *view, psMetadata *camera);
 bool pmFPAviewReadFitsImage (pmFPAview *view, psFits *fits);
+
+# endif
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPAview.c
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPAview.c	(revision 6558)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPAview.c	(revision 6559)
@@ -1,5 +1,48 @@
-# include "pmFPAview.h"
-
-static void pmPFAviewFree (pmFPAview *view)
+/** @file  pmFPAview.c
+ *
+ *  @author EAM, IfA
+ *
+ *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-03-09 03:24:49 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include "pslib.h"
+#include "pmHDU.h"
+#include "pmFPA.h"
+#include "pmFPAview.h"
+#include "pmFPARead.h"
+#include "pmFPAWrite.h"
+
+bool pmChipRead(pmChip *fpa,              // FPA to read into
+                psFits *fits,            // FITS file from which to read
+                psMetadata *phu,         // Primary header
+                psDB *db                 // Database handle, for concept ingest
+               );
+
+bool pmCellRead(pmCell *fpa,              // FPA to read into
+                psFits *fits,            // FITS file from which to read
+                psMetadata *phu,         // Primary header
+                psDB *db                 // Database handle, for concept ingest
+               );
+
+bool pmReadoutRead(pmReadout *fpa,              // FPA to read into
+                   psFits *fits,            // FITS file from which to read
+                   psMetadata *phu,         // Primary header
+                   psDB *db                 // Database handle, for concept ingest
+                  );
+
+bool pmReadoutReadSegment(pmReadout *fpa,              // FPA to read into
+                          psFits *fits,            // FITS file from which to read
+                          int n, int i,
+                          psMetadata *phu,         // Primary header
+                          psDB *db);
+
+static void pmFPAviewFree (pmFPAview *view)
 {
 
@@ -15,4 +58,5 @@
 
     pmFPAview *view = psAlloc (sizeof(pmFPAview));
+    psMemSetDeallocator (view, (psFreeFunc) pmFPAviewFree);
 
     view->fpa     = fpa;
@@ -167,5 +211,5 @@
 }
 
-pmCell *pmFPAviewNextReadout (pmFPAview *view, int nStep)
+pmReadout *pmFPAviewNextReadout (pmFPAview *view, int nStep)
 {
 
@@ -178,6 +222,6 @@
 
     // if there are no available cells, return NULL
-    if (view->fpa->readouts->n <= 0) {
-        view->readouts = -1;
+    if (cell->readouts->n <= 0) {
+        view->readout = -1;
         return NULL;
     }
@@ -210,11 +254,11 @@
 
     if (view->chip < 0) {
-        return pmHDUfromFPA (view->fpa);
+        return pmHDUFromFPA (view->fpa);
     }
     if (view->cell < 0) {
-        return pmHDUfromChip (pmFPAviewThisChip (view));
+        return pmHDUFromChip (pmFPAviewThisChip (view));
     }
     if (view->readout < 0) {
-        return pmHDUfromCell (pmFPAviewThisCell (view));
+        return pmHDUFromCell (pmFPAviewThisCell (view));
     }
     return NULL;
@@ -225,5 +269,4 @@
 {
 
-    char *name;
     char *newName = NULL;     // destination for resulting name
 
@@ -249,8 +292,7 @@
     }
     if (strstr (newName, "{EXTNAME}") != NULL) {
-        pmCell *cell = pmFPAviewThisCell (view);
-        char *name = psMetadataLookupStr (NULL, header, "EXTNAME");
-        if (name != NULL) {
-            newName = psStringSubstitute (newName, name, "{EXTNAME}");
+        pmHDU *hdu = pmFPAviewThisHDU (view);
+        if (hdu->extname != NULL) {
+            newName = psStringSubstitute (newName, hdu->extname, "{EXTNAME}");
         }
     }
@@ -266,5 +308,5 @@
 
     if (view->chip == -1) {
-        pmFPARead (fpa, fits, phu, database);
+        pmFPARead (fpa, fits, NULL, NULL);
         return true;
     }
@@ -276,5 +318,5 @@
 
     if (view->cell == -1) {
-        pmChipRead (chip, fits, phu, database);
+        pmChipRead (chip, fits, NULL, NULL);
         return true;
     }
@@ -286,5 +328,5 @@
 
     if (view->readout == -1) {
-        pmCellRead (cell, fits, phu, database);
+        pmCellRead (cell, fits, NULL, NULL);
         return true;
     }
@@ -296,7 +338,7 @@
 
     if (view->nRows == 0) {
-        pmReadoutRead (readout, fits, phu, database);
+        pmReadoutRead (readout, fits, NULL, NULL);
     } else {
-        pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, phu, database);
+        pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);
     }
     return true;
Index: /branches/rel10_ifa/psModules/src/astrom/pmFPAview.h
===================================================================
--- /branches/rel10_ifa/psModules/src/astrom/pmFPAview.h	(revision 6558)
+++ /branches/rel10_ifa/psModules/src/astrom/pmFPAview.h	(revision 6559)
@@ -7,6 +7,6 @@
 *  @author EAM, IfA
 *
-*  @version $Revision: 1.1.2.1 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-03-05 23:34:35 $
+*  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-03-09 03:24:49 $
 *
 *  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
@@ -15,9 +15,4 @@
 #ifndef PM_FPA_VIEW_H
 #define PM_FPA_VIEW_H
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "pslib.h"
-#include "pmFPA.h"
 
 /// @addtogroup AstroImage
@@ -36,6 +31,6 @@
 {
     pmFPA *fpa;
-    psMetadata IO;
-    psMetadata camera;
+    psMetadata *IO;
+    psMetadata *camera;
     int chip;
     int cell;
@@ -68,5 +63,5 @@
 
 // advance view to the next readout
-pmCell *pmFPAviewNextReadout (pmFPAview *view, int nStep);
+pmReadout *pmFPAviewNextReadout (pmFPAview *view, int nStep);
 
 // return the HDU corresponding to the current view
@@ -78,2 +73,4 @@
 // read an image into the current view
 bool pmFPAviewReadFitsImage (pmFPAview *view, psFits *fits);
+
+# endif
