Index: trunk/psModules/src/camera/pmFPA.c
===================================================================
--- trunk/psModules/src/camera/pmFPA.c	(revision 8815)
+++ trunk/psModules/src/camera/pmFPA.c	(revision 9584)
@@ -12,6 +12,6 @@
 * XXX: Should we implement non-linear cell->chip transforms?
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-09-15 09:49:01 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-10-17 00:33:56 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -101,5 +101,4 @@
     psFree(chip->analysis);
     psFree(chip->hdu);
-    psFree(chip->mosaic);
 
     # if FPA_ASTROM
@@ -322,5 +321,5 @@
     tmpChip->toFPA = NULL;
     tmpChip->fromFPA = NULL;
-    # endif
+    #endif
 
     tmpChip->analysis = psMetadataAlloc();
@@ -331,5 +330,4 @@
     }
     tmpChip->hdu = NULL;
-    tmpChip->mosaic = NULL;
     tmpChip->process = true;            // Work on all chips, by default
     tmpChip->file_exists = false;       // Not yet identified
@@ -355,5 +353,5 @@
     tmpFPA->toTangentPlane = NULL;
     tmpFPA->projection = NULL;
-    # endif
+    #endif
 
     tmpFPA->analysis = NULL;
@@ -369,5 +367,7 @@
 }
 
-static bool cellCheckParents(pmCell *cell)
+// Check a cell to ensure that all component readouts have the parent pointer set correctly
+static bool cellCheckParents(pmCell *cell // Cell to check
+                            )
 {
     PS_ASSERT_PTR_NON_NULL(cell, true);
@@ -387,5 +387,7 @@
 }
 
-static bool chipCheckParents(pmChip *chip)
+// Check a chip to ensure that all component cells have the parent pointer set correctly
+static bool chipCheckParents(pmChip *chip // Chip to check
+                            )
 {
     PS_ASSERT_PTR_NON_NULL(chip, true);
@@ -393,5 +395,5 @@
     bool flag = true;
     for (long i = 0; i < chip->cells->n ; i++) {
-        pmCell *tmpCell = (pmCell *) chip->cells->data[i];
+        pmCell *tmpCell = (pmCell*)chip->cells->data[i];
         if (!tmpCell) {
             continue;
@@ -413,5 +415,5 @@
     bool flag = true;
     for (long i = 0; i < fpa->chips->n ; i++) {
-        pmChip *tmpChip = (pmChip *) fpa->chips->data[i];
+        pmChip *tmpChip = (pmChip*)fpa->chips->data[i];
         if (!tmpChip) {
             continue;
@@ -426,327 +428,2 @@
     return flag;
 }
-
-/** functions to turn on/off the file_exists flag **/
-bool pmFPASetFileStatus(pmFPA *fpa, bool status)
-{
-    PS_ASSERT_PTR_NON_NULL(fpa, false);
-
-    for (int i = 0; i < fpa->chips->n; i++) {
-        pmChip *chip = fpa->chips->data[i];
-        pmChipSetFileStatus (chip, status);
-    }
-    return true;
-}
-
-bool pmChipSetFileStatus(pmChip *chip, bool status)
-{
-    PS_ASSERT_PTR_NON_NULL(chip, false);
-
-    chip->file_exists = status;
-    for (int i = 0; i < chip->cells->n; i++) {
-        pmCell *cell = chip->cells->data[i];
-        pmCellSetFileStatus (cell, status);
-    }
-    return true;
-}
-
-bool pmCellSetFileStatus(pmCell *cell, bool status)
-{
-    PS_ASSERT_PTR_NON_NULL(cell, false);
-
-    cell->file_exists = status;
-    for (int i = 0; i < cell->readouts->n; i++) {
-        pmReadout *readout = cell->readouts->data[i];
-        readout->file_exists = status;
-    }
-    return true;
-}
-
-bool pmFPACheckFileStatus(const pmFPA *fpa)
-{
-    PS_ASSERT_PTR_NON_NULL(fpa, false);
-
-    for (int i = 0; i < fpa->chips->n; i++) {
-        pmChip *chip = fpa->chips->data[i];
-        if (!pmChipCheckFileStatus(chip)) {
-            return false;
-        }
-    }
-    return true;
-}
-
-bool pmChipCheckFileStatus(const pmChip *chip)
-{
-    PS_ASSERT_PTR_NON_NULL(chip, false);
-    if (!chip->file_exists) {
-        return false;
-    }
-
-    for (int i = 0; i < chip->cells->n; i++) {
-        pmCell *cell = chip->cells->data[i];
-        if (!pmCellCheckFileStatus(cell)) {
-            return false;
-        }
-    }
-    return true;
-}
-
-bool pmCellCheckFileStatus(const pmCell *cell)
-{
-    PS_ASSERT_PTR_NON_NULL(cell, false);
-    if (!cell->file_exists) {
-        return false;
-    }
-
-    for (int i = 0; i < cell->readouts->n; i++) {
-        pmReadout *readout = cell->readouts->data[i];
-        if (!readout->file_exists) {
-            return false;
-        }
-    }
-    return true;
-}
-
-/** functions to turn on/off the data_exists flag **/
-bool pmFPASetDataStatus(pmFPA *fpa, bool status)
-{
-    PS_ASSERT_PTR_NON_NULL(fpa, false);
-
-    for (int i = 0; i < fpa->chips->n; i++) {
-        pmChip *chip = fpa->chips->data[i];
-        pmChipSetDataStatus (chip, status);
-    }
-    return true;
-}
-
-bool pmChipSetDataStatus(pmChip *chip, bool status)
-{
-    PS_ASSERT_PTR_NON_NULL(chip, false);
-
-    chip->data_exists = status;
-    for (int i = 0; i < chip->cells->n; i++) {
-        pmCell *cell = chip->cells->data[i];
-        pmCellSetDataStatus (cell, status);
-    }
-    return true;
-}
-
-bool pmCellSetDataStatus (pmCell *cell, bool status)
-{
-    PS_ASSERT_PTR_NON_NULL(cell, false);
-
-    cell->data_exists = status;
-    for (int i = 0; i < cell->readouts->n; i++) {
-        pmReadout *readout = cell->readouts->data[i];
-        readout->data_exists = status;
-    }
-    return true;
-}
-
-/*****************************************************************************
- *****************************************************************************/
-
-// Set cells within a chip to be processed or not
-static bool setCellsProcess(const pmChip *chip, // Chip of interest
-                            bool process  // Process this chip?
-                           )
-{
-    PS_ASSERT_PTR_NON_NULL(chip, false);
-
-    psArray *cells = chip->cells;       // Component cells
-    if (! cells) {
-        return false;
-    }
-    for (int i = 0; i < cells->n; i++) {
-        pmCell *tmpCell = cells->data[i]; // Cell of interest
-        if (tmpCell) {
-            tmpCell->process = process;
-        }
-    }
-
-    return true;
-}
-
-/*****************************************************************************
-XXX EAM : I've added the 'exclusive' option.  if true all other chips are de-selected
-XXX EAM : a negative value is valid and, in combinations with exclusive, de-selects all chips
- *****************************************************************************/
-bool pmFPASelectChip(pmFPA *fpa, int chipNum, bool exclusive)
-{
-    PS_ASSERT_PTR_NON_NULL(fpa, false);
-
-    psArray *chips = fpa->chips;        // Component chips
-    if ((chips == NULL) || (chipNum >= chips->n)) {
-        return(false);
-    }
-
-    for (int i = 0 ; i < chips->n ; i++) {
-        pmChip *tmpChip = (pmChip *) chips->data[i];
-        if (tmpChip == NULL) {
-            continue;
-        }
-        if (i == chipNum) {
-            tmpChip->process = true;
-            setCellsProcess(tmpChip, true);
-        } else {
-            if (exclusive) {
-                tmpChip->process = false;
-                setCellsProcess(tmpChip, false);
-            }
-        }
-
-    }
-
-    return true;
-}
-
-/*****************************************************************************
-XXX EAM : I've added the 'exclusive' option.  if true all other chips are de-selected
-XXX EAM : a negative value is valid and, in combinations with exclusive, de-selects all cells
-XXX this function should probably be re-defined to merge with 'setCellsProcess'
- *****************************************************************************/
-bool pmChipSelectCell(pmChip *chip, int cellNum, bool exclusive)
-{
-    PS_ASSERT_PTR_NON_NULL(chip, false);
-
-    psArray *cells = chip->cells;       // Component cells
-    if (!cells || cellNum > cells->n) {
-        return false;
-    }
-
-    for (int i = 0; i < cells->n; i++) {
-        pmCell *cell = cells->data[i];
-        if (!cell) {
-            continue;
-        }
-        if (i == cellNum) {
-            cell->process = true;
-        } else {
-            if (exclusive) {
-                cell->process = false;
-            }
-        }
-    }
-    return true;
-}
-
-/*****************************************************************************
-XXX: The SDRS is ambiguous on a few things:
-    Whether or not the other chips should be set process=true. [PAP: No]
-    Should we return the number of chip process=true before or after they're set, [PAP: After]
- *****************************************************************************/
-/**
- *
- * pmFPAExcludeChip shall set process to false only for the specified chip
- * number (chipNum). In the event that the specified chip number does not exist
- * within the fpa, the function shall generate a warning, and perform no action.
- * The function shall return the number of chips within the fpa that have process
- * set to true.
- *
- */
-int pmFPAExcludeChip(
-    pmFPA *fpa,
-    int chipNum)
-{
-    PS_ASSERT_PTR_NON_NULL(fpa, -1);
-
-    psArray *chips = fpa->chips;        // Component chips
-    if (chips == NULL) {
-        psLogMsg(__func__, PS_LOG_WARN, "WARNING: fpa->chips == NULL\n");
-        return(0);
-    }
-    if ((chipNum >= chips->n) || (NULL == (pmChip *) chips->data[chipNum])) {
-        psLogMsg(__func__, PS_LOG_WARN, "WARNING: the specified chip (%d) does not exist.\n", chipNum);
-        return(0);
-    }
-
-    int numChips = 0;                   // Number of chips to be processed
-    for (int i = 0 ; i < chips->n ; i++) {
-        pmChip *tmpChip = (pmChip *) chips->data[i]; // Chip of interest
-        if (tmpChip != NULL) {
-            if (i == chipNum) {
-                tmpChip->process = false;
-                setCellsProcess(tmpChip, false); // Wipe out the cell as well
-            } else if (tmpChip->process) {
-                numChips++;
-            }
-        }
-    }
-
-    return(numChips);
-}
-
-int pmChipExcludeCell(pmChip *chip,
-                      int cellNum
-                     )
-{
-    PS_ASSERT_PTR_NON_NULL(chip, -1);
-
-    psArray *cells = chip->cells;       // The component cells
-    if (!cells || cellNum > cells->n) {
-        return 0;
-    }
-
-    int numCells = 0;                   // Number of cells to be processed
-    for (int i = 0; i < cells->n; i++) {
-        pmCell *cell = cells->data[i];
-        if (!cell) {
-            continue;
-        }
-        if (i == cellNum) {
-            cell->process = false;
-        } else {
-            numCells++;
-        }
-    }
-
-    return numCells;
-}
-
-static char *NameNONE = "NONE";
-static char *NameFPA = "FPA";
-static char *NameCHIP = "CHIP";
-static char *NameCELL = "CELL";
-static char *NameREADOUT = "READOUT";
-
-char *pmFPALevelToName(pmFPALevel level)
-{
-
-    switch (level) {
-    case PM_FPA_LEVEL_NONE:
-        return NameNONE;
-    case PM_FPA_LEVEL_FPA:
-        return NameFPA;
-    case PM_FPA_LEVEL_CHIP:
-        return NameCHIP;
-    case PM_FPA_LEVEL_CELL:
-        return NameCELL;
-    case PM_FPA_LEVEL_READOUT:
-        return NameREADOUT;
-    default:
-        psAbort(PS_FILE_LINE, "You can't get here; level = %d", level);
-    }
-    return NULL;
-}
-
-pmFPALevel pmFPALevelFromName(const char *name)
-{
-    pmFPALevel val;
-
-    if (name == NULL) {
-        val = PM_FPA_LEVEL_NONE;
-    } else if (!strcasecmp(name, "FPA"))     {
-        val = PM_FPA_LEVEL_FPA;
-    } else if (!strcasecmp(name, "CHIP"))    {
-        val = PM_FPA_LEVEL_CHIP;
-    } else if (!strcasecmp(name, "CELL"))    {
-        val = PM_FPA_LEVEL_CELL;
-    } else if (!strcasecmp(name, "READOUT")) {
-        val = PM_FPA_LEVEL_READOUT;
-    } else {
-        val = PM_FPA_LEVEL_NONE;
-    }
-
-    return val;
-}
-
