IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9584


Ignore:
Timestamp:
Oct 16, 2006, 2:33:57 PM (20 years ago)
Author:
Paul Price
Message:

Creating pmFPALevel.[ch] to hold pmFPALevel stuff. Creating pmFPAFlags.[ch] to hold status flag setting and checking functions. Both of these were pulled out of pmFPA.[ch]. Documenting pmFPA.h, pmFPALevel.h, pmFPAFlags.h. Adding additional includes of the new header files to files that needed them.

Location:
trunk/psModules/src
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/Makefile.am

    r8990 r9584  
    2121        pmFPAfileDefine.c \
    2222        pmFPAfileIO.c \
    23         pmFPAfileFitsIO.c
     23        pmFPAfileFitsIO.c \
     24        pmFPAFlags.c \
     25        pmFPALevel.c
    2426
    2527pkginclude_HEADERS = \
     
    4143        pmFPAfileDefine.h \
    4244        pmFPAfileIO.h \
    43         pmFPAfileFitsIO.h
     45        pmFPAfileFitsIO.h \
     46        pmFPAFlags.h \
     47        pmFPALevel.h
    4448
    4549CLEANFILES = *~
  • trunk/psModules/src/camera/pmFPA.c

    r8815 r9584  
    1212* XXX: Should we implement non-linear cell->chip transforms?
    1313*
    14 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2006-09-15 09:49:01 $
     14*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2006-10-17 00:33:56 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    101101    psFree(chip->analysis);
    102102    psFree(chip->hdu);
    103     psFree(chip->mosaic);
    104103
    105104    # if FPA_ASTROM
     
    322321    tmpChip->toFPA = NULL;
    323322    tmpChip->fromFPA = NULL;
    324     # endif
     323    #endif
    325324
    326325    tmpChip->analysis = psMetadataAlloc();
     
    331330    }
    332331    tmpChip->hdu = NULL;
    333     tmpChip->mosaic = NULL;
    334332    tmpChip->process = true;            // Work on all chips, by default
    335333    tmpChip->file_exists = false;       // Not yet identified
     
    355353    tmpFPA->toTangentPlane = NULL;
    356354    tmpFPA->projection = NULL;
    357     # endif
     355    #endif
    358356
    359357    tmpFPA->analysis = NULL;
     
    369367}
    370368
    371 static bool cellCheckParents(pmCell *cell)
     369// Check a cell to ensure that all component readouts have the parent pointer set correctly
     370static bool cellCheckParents(pmCell *cell // Cell to check
     371                            )
    372372{
    373373    PS_ASSERT_PTR_NON_NULL(cell, true);
     
    387387}
    388388
    389 static bool chipCheckParents(pmChip *chip)
     389// Check a chip to ensure that all component cells have the parent pointer set correctly
     390static bool chipCheckParents(pmChip *chip // Chip to check
     391                            )
    390392{
    391393    PS_ASSERT_PTR_NON_NULL(chip, true);
     
    393395    bool flag = true;
    394396    for (long i = 0; i < chip->cells->n ; i++) {
    395         pmCell *tmpCell = (pmCell *) chip->cells->data[i];
     397        pmCell *tmpCell = (pmCell*)chip->cells->data[i];
    396398        if (!tmpCell) {
    397399            continue;
     
    413415    bool flag = true;
    414416    for (long i = 0; i < fpa->chips->n ; i++) {
    415         pmChip *tmpChip = (pmChip *) fpa->chips->data[i];
     417        pmChip *tmpChip = (pmChip*)fpa->chips->data[i];
    416418        if (!tmpChip) {
    417419            continue;
     
    426428    return flag;
    427429}
    428 
    429 /** functions to turn on/off the file_exists flag **/
    430 bool pmFPASetFileStatus(pmFPA *fpa, bool status)
    431 {
    432     PS_ASSERT_PTR_NON_NULL(fpa, false);
    433 
    434     for (int i = 0; i < fpa->chips->n; i++) {
    435         pmChip *chip = fpa->chips->data[i];
    436         pmChipSetFileStatus (chip, status);
    437     }
    438     return true;
    439 }
    440 
    441 bool pmChipSetFileStatus(pmChip *chip, bool status)
    442 {
    443     PS_ASSERT_PTR_NON_NULL(chip, false);
    444 
    445     chip->file_exists = status;
    446     for (int i = 0; i < chip->cells->n; i++) {
    447         pmCell *cell = chip->cells->data[i];
    448         pmCellSetFileStatus (cell, status);
    449     }
    450     return true;
    451 }
    452 
    453 bool pmCellSetFileStatus(pmCell *cell, bool status)
    454 {
    455     PS_ASSERT_PTR_NON_NULL(cell, false);
    456 
    457     cell->file_exists = status;
    458     for (int i = 0; i < cell->readouts->n; i++) {
    459         pmReadout *readout = cell->readouts->data[i];
    460         readout->file_exists = status;
    461     }
    462     return true;
    463 }
    464 
    465 bool pmFPACheckFileStatus(const pmFPA *fpa)
    466 {
    467     PS_ASSERT_PTR_NON_NULL(fpa, false);
    468 
    469     for (int i = 0; i < fpa->chips->n; i++) {
    470         pmChip *chip = fpa->chips->data[i];
    471         if (!pmChipCheckFileStatus(chip)) {
    472             return false;
    473         }
    474     }
    475     return true;
    476 }
    477 
    478 bool pmChipCheckFileStatus(const pmChip *chip)
    479 {
    480     PS_ASSERT_PTR_NON_NULL(chip, false);
    481     if (!chip->file_exists) {
    482         return false;
    483     }
    484 
    485     for (int i = 0; i < chip->cells->n; i++) {
    486         pmCell *cell = chip->cells->data[i];
    487         if (!pmCellCheckFileStatus(cell)) {
    488             return false;
    489         }
    490     }
    491     return true;
    492 }
    493 
    494 bool pmCellCheckFileStatus(const pmCell *cell)
    495 {
    496     PS_ASSERT_PTR_NON_NULL(cell, false);
    497     if (!cell->file_exists) {
    498         return false;
    499     }
    500 
    501     for (int i = 0; i < cell->readouts->n; i++) {
    502         pmReadout *readout = cell->readouts->data[i];
    503         if (!readout->file_exists) {
    504             return false;
    505         }
    506     }
    507     return true;
    508 }
    509 
    510 /** functions to turn on/off the data_exists flag **/
    511 bool pmFPASetDataStatus(pmFPA *fpa, bool status)
    512 {
    513     PS_ASSERT_PTR_NON_NULL(fpa, false);
    514 
    515     for (int i = 0; i < fpa->chips->n; i++) {
    516         pmChip *chip = fpa->chips->data[i];
    517         pmChipSetDataStatus (chip, status);
    518     }
    519     return true;
    520 }
    521 
    522 bool pmChipSetDataStatus(pmChip *chip, bool status)
    523 {
    524     PS_ASSERT_PTR_NON_NULL(chip, false);
    525 
    526     chip->data_exists = status;
    527     for (int i = 0; i < chip->cells->n; i++) {
    528         pmCell *cell = chip->cells->data[i];
    529         pmCellSetDataStatus (cell, status);
    530     }
    531     return true;
    532 }
    533 
    534 bool pmCellSetDataStatus (pmCell *cell, bool status)
    535 {
    536     PS_ASSERT_PTR_NON_NULL(cell, false);
    537 
    538     cell->data_exists = status;
    539     for (int i = 0; i < cell->readouts->n; i++) {
    540         pmReadout *readout = cell->readouts->data[i];
    541         readout->data_exists = status;
    542     }
    543     return true;
    544 }
    545 
    546 /*****************************************************************************
    547  *****************************************************************************/
    548 
    549 // Set cells within a chip to be processed or not
    550 static bool setCellsProcess(const pmChip *chip, // Chip of interest
    551                             bool process  // Process this chip?
    552                            )
    553 {
    554     PS_ASSERT_PTR_NON_NULL(chip, false);
    555 
    556     psArray *cells = chip->cells;       // Component cells
    557     if (! cells) {
    558         return false;
    559     }
    560     for (int i = 0; i < cells->n; i++) {
    561         pmCell *tmpCell = cells->data[i]; // Cell of interest
    562         if (tmpCell) {
    563             tmpCell->process = process;
    564         }
    565     }
    566 
    567     return true;
    568 }
    569 
    570 /*****************************************************************************
    571 XXX EAM : I've added the 'exclusive' option.  if true all other chips are de-selected
    572 XXX EAM : a negative value is valid and, in combinations with exclusive, de-selects all chips
    573  *****************************************************************************/
    574 bool pmFPASelectChip(pmFPA *fpa, int chipNum, bool exclusive)
    575 {
    576     PS_ASSERT_PTR_NON_NULL(fpa, false);
    577 
    578     psArray *chips = fpa->chips;        // Component chips
    579     if ((chips == NULL) || (chipNum >= chips->n)) {
    580         return(false);
    581     }
    582 
    583     for (int i = 0 ; i < chips->n ; i++) {
    584         pmChip *tmpChip = (pmChip *) chips->data[i];
    585         if (tmpChip == NULL) {
    586             continue;
    587         }
    588         if (i == chipNum) {
    589             tmpChip->process = true;
    590             setCellsProcess(tmpChip, true);
    591         } else {
    592             if (exclusive) {
    593                 tmpChip->process = false;
    594                 setCellsProcess(tmpChip, false);
    595             }
    596         }
    597 
    598     }
    599 
    600     return true;
    601 }
    602 
    603 /*****************************************************************************
    604 XXX EAM : I've added the 'exclusive' option.  if true all other chips are de-selected
    605 XXX EAM : a negative value is valid and, in combinations with exclusive, de-selects all cells
    606 XXX this function should probably be re-defined to merge with 'setCellsProcess'
    607  *****************************************************************************/
    608 bool pmChipSelectCell(pmChip *chip, int cellNum, bool exclusive)
    609 {
    610     PS_ASSERT_PTR_NON_NULL(chip, false);
    611 
    612     psArray *cells = chip->cells;       // Component cells
    613     if (!cells || cellNum > cells->n) {
    614         return false;
    615     }
    616 
    617     for (int i = 0; i < cells->n; i++) {
    618         pmCell *cell = cells->data[i];
    619         if (!cell) {
    620             continue;
    621         }
    622         if (i == cellNum) {
    623             cell->process = true;
    624         } else {
    625             if (exclusive) {
    626                 cell->process = false;
    627             }
    628         }
    629     }
    630     return true;
    631 }
    632 
    633 /*****************************************************************************
    634 XXX: The SDRS is ambiguous on a few things:
    635     Whether or not the other chips should be set process=true. [PAP: No]
    636     Should we return the number of chip process=true before or after they're set, [PAP: After]
    637  *****************************************************************************/
    638 /**
    639  *
    640  * pmFPAExcludeChip shall set process to false only for the specified chip
    641  * number (chipNum). In the event that the specified chip number does not exist
    642  * within the fpa, the function shall generate a warning, and perform no action.
    643  * The function shall return the number of chips within the fpa that have process
    644  * set to true.
    645  *
    646  */
    647 int pmFPAExcludeChip(
    648     pmFPA *fpa,
    649     int chipNum)
    650 {
    651     PS_ASSERT_PTR_NON_NULL(fpa, -1);
    652 
    653     psArray *chips = fpa->chips;        // Component chips
    654     if (chips == NULL) {
    655         psLogMsg(__func__, PS_LOG_WARN, "WARNING: fpa->chips == NULL\n");
    656         return(0);
    657     }
    658     if ((chipNum >= chips->n) || (NULL == (pmChip *) chips->data[chipNum])) {
    659         psLogMsg(__func__, PS_LOG_WARN, "WARNING: the specified chip (%d) does not exist.\n", chipNum);
    660         return(0);
    661     }
    662 
    663     int numChips = 0;                   // Number of chips to be processed
    664     for (int i = 0 ; i < chips->n ; i++) {
    665         pmChip *tmpChip = (pmChip *) chips->data[i]; // Chip of interest
    666         if (tmpChip != NULL) {
    667             if (i == chipNum) {
    668                 tmpChip->process = false;
    669                 setCellsProcess(tmpChip, false); // Wipe out the cell as well
    670             } else if (tmpChip->process) {
    671                 numChips++;
    672             }
    673         }
    674     }
    675 
    676     return(numChips);
    677 }
    678 
    679 int pmChipExcludeCell(pmChip *chip,
    680                       int cellNum
    681                      )
    682 {
    683     PS_ASSERT_PTR_NON_NULL(chip, -1);
    684 
    685     psArray *cells = chip->cells;       // The component cells
    686     if (!cells || cellNum > cells->n) {
    687         return 0;
    688     }
    689 
    690     int numCells = 0;                   // Number of cells to be processed
    691     for (int i = 0; i < cells->n; i++) {
    692         pmCell *cell = cells->data[i];
    693         if (!cell) {
    694             continue;
    695         }
    696         if (i == cellNum) {
    697             cell->process = false;
    698         } else {
    699             numCells++;
    700         }
    701     }
    702 
    703     return numCells;
    704 }
    705 
    706 static char *NameNONE = "NONE";
    707 static char *NameFPA = "FPA";
    708 static char *NameCHIP = "CHIP";
    709 static char *NameCELL = "CELL";
    710 static char *NameREADOUT = "READOUT";
    711 
    712 char *pmFPALevelToName(pmFPALevel level)
    713 {
    714 
    715     switch (level) {
    716     case PM_FPA_LEVEL_NONE:
    717         return NameNONE;
    718     case PM_FPA_LEVEL_FPA:
    719         return NameFPA;
    720     case PM_FPA_LEVEL_CHIP:
    721         return NameCHIP;
    722     case PM_FPA_LEVEL_CELL:
    723         return NameCELL;
    724     case PM_FPA_LEVEL_READOUT:
    725         return NameREADOUT;
    726     default:
    727         psAbort(PS_FILE_LINE, "You can't get here; level = %d", level);
    728     }
    729     return NULL;
    730 }
    731 
    732 pmFPALevel pmFPALevelFromName(const char *name)
    733 {
    734     pmFPALevel val;
    735 
    736     if (name == NULL) {
    737         val = PM_FPA_LEVEL_NONE;
    738     } else if (!strcasecmp(name, "FPA"))     {
    739         val = PM_FPA_LEVEL_FPA;
    740     } else if (!strcasecmp(name, "CHIP"))    {
    741         val = PM_FPA_LEVEL_CHIP;
    742     } else if (!strcasecmp(name, "CELL"))    {
    743         val = PM_FPA_LEVEL_CELL;
    744     } else if (!strcasecmp(name, "READOUT")) {
    745         val = PM_FPA_LEVEL_READOUT;
    746     } else {
    747         val = PM_FPA_LEVEL_NONE;
    748     }
    749 
    750     return val;
    751 }
    752 
  • trunk/psModules/src/camera/pmFPA.h

    r8047 r9584  
    1 /** @file  pmFPA.h
    2 *
    3 *  @brief This file defines the basic types the focal plane hierarchy.
    4 *
    5 *  @ingroup AstroImage
    6 *
    7 *  @author GLG, MHPCC
    8 *
    9 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-08-02 02:17:11 $
    11 *
    12 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    13 */
     1/// @file pmFPA.h
     2///
     3/// @brief Defines the focal plane hierarchy, along with functions for interacting with it
     4///
     5/// @ingroup Camera
     6///
     7/// @author George Gusciora, MHPCC
     8/// @author Paul Price, IfA
     9/// @author Eugene Magnier, IfA
     10///
     11/// @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12/// @date $Date: 2006-10-17 00:33:56 $
     13///
     14/// Copyright 2005-2006 Institute for Astronomy, University of Hawaii
     15///
    1416
    1517#ifndef PM_FPA_H
    1618#define PM_FPA_H
     19
    1720#if HAVE_CONFIG_H
    1821#include <config.h>
    1922#endif
    2023
    21 #include "pslib.h"
     24#include <pslib.h>
    2225#include "pmHDU.h"
    2326
    24 # define FPA_ASTROM 1
     27#define FPA_ASTROM 1                    ///< Include astrometry information in the structures?
    2528
    26 /// @addtogroup AstroImage
    27 /// @{
    28 
    29 /** Focal plane data structure
    30  *
    31  *  A focal plane consists of one or more chips (according to the number of
    32  *  pieces of contiguous silicon). It contains metadata containers for the
    33  *  concepts and analysis, a link to the parent, and pointers to the FITS header,
    34  *  if that corresponds to this level (the FPA may be the PHU, but will not ever
    35  *  contain pixels). For astrometry, it contains a transformation from the focal
    36  *  plane to the tangent plane and the fixed pattern residuals. It is expected
    37  *  that the transformation will consist of two 4D polynomials (i.e. a function
    38  *  of two coordinates in position, the magnitude of the object, and the color of
    39  *  the object) in order to correct for optical distortions and the effects of
    40  *  the atmosphere; hence we think that it is prudent to include a reverse
    41  *  transformation which will be derived from numerically inverting the forward
    42  *  transformation.
    43  *
    44  */
     29/// Focal plane array (the entirety of the camera)
     30///
     31/// The FPA is the top-level camera structure, and consists of one or more chips.  It also contains the
     32/// concepts metadata appropriate to this level, a summary of analysis tasks that have been performed, the
     33/// camera configuration information, any HDU that corresponds to this level for the file of interest, and
     34/// astrometric transformations.  The astrometric transformations encode how to transform from the tangent
     35/// plane to the sky, and back.
    4536typedef struct
    4637{
    47     # if FPA_ASTROM
     38    #if FPA_ASTROM
    4839    // Astrometric transformations
    49     psPlaneDistort* fromTangentPlane;   ///< Transformation from tangent plane to focal plane
    50 psPlaneDistort* toTangentPlane;     ///< Transformation from focal plane to tangent plane
    51 psProjection *projection;           ///< Projection from tangent plane to sky
    52 # endif
    53 // Information
    54 psMetadata *concepts;               ///< Cache for PS concepts
    55 unsigned int conceptsRead;          ///< Which concepts have been read
    56 psMetadata *analysis;               ///< FPA-level analysis metadata
    57 const psMetadata *camera;           ///< Camera configuration
    58 psArray *chips;                     ///< The chips
    59 pmHDU *hdu;                         ///< FITS data
     40    psPlaneDistort *fromTangentPlane;   ///< Transformation from tangent plane to focal plane, or NULL
     41    psPlaneDistort *toTangentPlane;     ///< Transformation from focal plane to tangent plane, or NULL
     42    psProjection *projection;           ///< Projection from tangent plane to sky, or NULL
     43    #endif
     44    // Information
     45    psMetadata *concepts;               ///< FPA-level concepts
     46    unsigned int conceptsRead;          ///< Which concepts have been read; see pmConceptsSource
     47    psMetadata *analysis;               ///< FPA-level analysis metadata
     48    const psMetadata *camera;           ///< Camera configuration
     49    psArray *chips;                     ///< The component chips
     50    pmHDU *hdu;                         ///< FITS header data unit of interest, or NULL
    6051}
    6152pmFPA;
    6253
    63 /** Chip data structure
    64  *
    65  *  A chip consists of one or more cells (according to the number of amplifiers
    66  *  on the device). The chip contains metadata containers for the concepts and
    67  *  analysis, a link to the parent, and pointers to the pointers to the various
    68  *  FITS data, if that corresponds to this level. For astrometry, in addition to
    69  *  the rough positioning information, it contains a coordinate transform from
    70  *  the chip to the focal plane. It is expected that this transform will consist
    71  *  of two second-order 2D polynomials; hence we think that it is prudent to
    72  *  include a reverse transformation which will be derived from numerically
    73  *  inverting the forward transformation. A boolean indicates whether the chip is
    74  *  of interest, allowing it to be excluded from analysis.
    75  *
    76  */
     54/// A chip (contiguous detector element)
     55///
     56/// The chip is the mid-level camera structure, being part of an FPA, and consisting of one or more cells
     57/// (e.g., a CCD).  It also contains the concepts metadata appropriate to this level, a summary of analysis
     58/// tasks that have been performed, status flags, any HDU that corresponds to this level for the file of
     59/// interest, and astrometric transformations.  The astrometric transformations are of two types: rough
     60/// (indicating an offset from the origin of the FPA) and precise (transformations between the chip and FPA
     61/// coordinates).
    7762typedef struct
    7863{
    79 # if FPA_ASTROM
     64    #if FPA_ASTROM
    8065    // Offset specifying position on focal plane
    8166    int col0;                           ///< Offset from the left of FPA.
    82 int row0;                           ///< Offset from the bottom of FPA.
    83 // Astrometric transformations
    84 psPlaneTransform* toFPA;            ///< Transformation from chip to FPA coordinates
    85 psPlaneTransform* fromFPA;          ///< Transformation from FPA to chip coordinates
    86 # endif
    87 // Information
    88 psMetadata *concepts;               ///< Cache for PS concepts
    89 unsigned int conceptsRead;          ///< Which concepts have been read
    90 psMetadata *analysis;               ///< Chip-level analysis metadata
    91 psArray *cells;                     ///< The cells (referred to by name)
    92 pmFPA *parent;                      ///< Parent FPA
    93 bool process;                       ///< Do we bother about reading and working with this chip?
    94 bool file_exists;                   ///< Does the file for this chip exist (read case only)?
    95 bool data_exists;                   ///< Does the data for this chip exist (read case only)?
    96 pmHDU *hdu;                         ///< FITS data
    97 struct pmCell *mosaic;              ///< A mosaic cell
     67    int row0;                           ///< Offset from the bottom of FPA.
     68    // Astrometric transformations
     69    psPlaneTransform *toFPA;            ///< Transformation from chip to FPA coordinates, or NULL
     70    psPlaneTransform *fromFPA;          ///< Transformation from FPA to chip coordinates, or NULL
     71    #endif
     72    // Information
     73    psMetadata *concepts;               ///< Chip-level concepts
     74    unsigned int conceptsRead;          ///< Which concepts have been read; see pmConceptsSource
     75    psMetadata *analysis;               ///< Chip-level analysis metadata
     76    psArray *cells;                     ///< The component cells
     77    pmFPA *parent;                      ///< Parent FPA
     78    bool process;                       ///< Do we bother about reading and working with this chip?
     79    bool file_exists;                   ///< Does the file for this chip exist (read case only)?
     80    bool data_exists;                   ///< Does the data for this chip exist (read case only)?
     81    pmHDU *hdu;                         ///< FITS header data unit of interest,
    9882}
    9983pmChip;
     84
     85/// A cell (smallest logical unit)
     86///
     87/// A cell is the lowest-level camera structure, being part of a chip (e.g., an amplifier).  It may consist of
     88/// one or more readouts, which are individual reads of the cell.  It also contains the concepts metadata
     89/// appropriate to this level, the cell configuration information (for convenience) from the camera
     90/// configuration, a summary of analysis tasks that have been performed, status flags, and any HDU that
     91/// corresponds to this level for the file of interest
    10092
    10193/** Cell data structure
     
    110102typedef struct
    111103{
    112 psMetadata *concepts;               ///< Cache for PS concepts
    113 unsigned int conceptsRead;          ///< Which concepts have been read
    114 psMetadata *config;                 ///< Cell configuration info
    115 psMetadata *analysis;               ///< Cell-level analysis metadata
    116 psArray *readouts;                  ///< The readouts (referred to by number)
    117 pmChip *parent;                     ///< Parent chip
    118 bool process;                       ///< Do we bother about reading and working with this cell?
    119 bool file_exists;                   ///< Does the file for this cell exist (read case only)?
    120 bool data_exists;                   ///< Does the data for this cell exist (read case only)?
    121 pmHDU *hdu;                         ///< FITS data
     104    psMetadata *concepts;               ///< Cell-level concepts
     105    unsigned int conceptsRead;          ///< Which concepts have been read; see pmConceptsSource
     106    psMetadata *config;                 ///< Cell configuration information (from CELLS in the camera config)
     107    psMetadata *analysis;               ///< Cell-level analysis metadata
     108    psArray *readouts;                  ///< The component readouts
     109    pmChip *parent;                     ///< Parent chip
     110    bool process;                       ///< Do we bother about reading and working with this cell?
     111    bool file_exists;                   ///< Does the file for this cell exist (read case only)?
     112    bool data_exists;                   ///< Does the data for this cell exist (read case only)?
     113    pmHDU *hdu;                         ///< FITS header data unit of interest
    122114}
    123115pmCell;
    124116
    125 /** Readout data structure.
    126  *
    127  *  A readout is the result of a single read of a cell (or a portion thereof).
    128  *  It contains the offset from the lower-left corner of the chip, in the case
    129  *  that the CCD was windowed, as well as the binning factors and parity (if the
    130  *  binning value is negative, then the parity is reversed). It also contains the
    131  *  pixel data, metadata containers for the concepts and analysis, and a link to
    132  *  the parent.
    133  *
    134  */
     117/// A readout (individual read of a cell)
     118///
     119/// A readout corresponds to an individual read of a cell (e.g., a single image as part of a video sequence,
     120/// or one of multiple coadds).  It contains the actual pixels used in analysis (along with mask and weight
     121/// maps).  When reading from a FITS file, the images are subimages (from CELL.TRIMSEC) of the pixels read
     122/// from the appropriate HDU (at the FPA, chip or cell level).  The readout also contains a list of bias
     123/// sections (prescans or overscans, or otherwise), a summary of analysis tasks that have been performed,
     124/// status flags, and the offsets used for reading a FITS file incrementally.
    135125typedef struct
    136126{
    137 int col0;                           ///< Column offset; non-zero if reading in columns bit by bit
    138 int row0;                           ///< Row offset; non-zero if reading in rows bit by bit
    139 psImage *image;                     ///< Imaging area of readout
    140 psImage *mask;                      ///< Mask of input image
    141 psImage *weight;                    ///< Weight of input image
    142 psList *bias;                       ///< Overscan images
    143 psMetadata *analysis;               ///< Readout-level analysis metadata
    144 pmCell *parent;                     ///< Parent cell
    145 bool process;                       ///< Do we bother about reading and working with this readout?
    146 bool file_exists;                   ///< Does the file for this readout exist (read case only)?
    147 bool data_exists;                   ///< Does the data for this readout exist (read case only)?
     127    int col0;                           ///< Column offset; non-zero if reading in columns incrementally
     128    int row0;                           ///< Row offset; non-zero if reading in rows incrementally
     129    psImage *image;                     ///< Imaging area of readout (corresponds to CELL.TRIMSEC region)
     130    psImage *mask;                      ///< Mask of input image (corresponds to CELL.TRIMSEC region)
     131    psImage *weight;                    ///< Weight of input image (corresponds to CELL.TRIMSEC region)
     132    psList *bias;                       ///< List of bias (prescan/overscan) images
     133    psMetadata *analysis;               ///< Readout-level analysis metadata
     134    pmCell *parent;                     ///< Parent cell
     135    bool process;                       ///< Do we bother about reading and working with this readout?
     136    bool file_exists;                   ///< Does the file for this readout exist (read case only)?
     137    bool data_exists;                   ///< Does the data for this readout exist (read case only)?
    148138}
    149139pmReadout;
    150140
    151 void pmCellFreeReadouts(pmCell *cell);
    152 void pmChipFreeCells(pmChip *chip);
     141/// Free all readouts within a cell
     142void pmCellFreeReadouts(pmCell *cell    ///< Cell for which to free readouts
     143                       );
    153144
    154 void pmReadoutFreeData (pmReadout *readout);
    155 void pmCellFreeData(pmCell *cell);
    156 void pmChipFreeData(pmChip *chip);
    157 void pmFPAFreeData(pmFPA *fpa);
     145/// Free all cells within a chip
     146void pmChipFreeCells(pmChip *chip       ///< Chip for which to free cells
     147                    );
    158148
    159 /** Allocates a pmReadout
    160  *
    161  *  The constructor shall make an empty pmReadout. If the parent cell is not
    162  *  NULL, the parent link is made and the readout shall be placed in the
    163  *  parents array of readouts. The metadata containers shall be allocated. All
    164  *  other pointers in the structure shall be initialized to NULL.
    165  *
    166  *  @return pmReadout*    newly allocated pmReadout with all internal pointers set to NULL
    167  */
    168 pmReadout *pmReadoutAlloc(
    169     pmCell *cell                        ///< Parent cell
    170 );
     149/// Free all data within a readout
     150void pmReadoutFreeData(pmReadout *readout ///< Readout for which to free data
     151                      );
    171152
    172 /** Allocates a pmCell
    173  *
    174  *  The constructor shall make an empty pmCell. If the parent chip is not NULL,
    175  *  the parent link is made and the cell shall be placed in the parents array of
    176  *  cells. The readouts array shall be allocated with a zero size, and the
    177  *  metadata containers constructed. All other pointers in the structure shall be
    178  *  initialized to NULL.
    179  *
    180  *  @return pmCell*    newly allocated pmCell
    181  */
    182 pmCell *pmCellAlloc(
    183     pmChip *chip,       ///< Parent chip
    184     const char *name    ///< Name of cell
    185 );
     153/// Free all data within a cell (all readouts as well as metadata)
     154void pmCellFreeData(pmCell *cell        ///< Cell for which to free data
     155                   );
    186156
    187 /** Allocates a pmChip
    188  *
    189  *  The constructor shall make an empty pmChip. If the parent fpa is not NULL,
    190  *  the parent link is made and the chip shall be placed in the parent's array
    191  *  of chips. The cells array shall be allocated with a zero size, and the
    192  *  metadata containers constructed. All other pointers in the structure shall be
    193  *  initialized to NULL.
    194  *
    195  *  @return pmChip*    newly allocated pmChip
    196  */
    197 pmChip *pmChipAlloc(
    198     pmFPA *fpa,                         ///< FPA to which the chip belongs
    199     const char *name                    ///< Name of chip
    200 );
     157/// Free all data within a chip (all cells as well as metadata)
     158void pmChipFreeData(pmChip *chip        ///< Chip for which to free data
     159                   );
    201160
    202 /** Allocates a pmFPA
    203  *
    204  *  The constructor shall make an empty pmFPA. The chips array shall be
    205  *  allocated with a zero size, the camera and db pointers set to the values
    206  *  provided, and the concepts metadata constructed. All other pointers in the
    207  *  structure shall be initialized to NULL.
    208  *
    209  */
    210 pmFPA *pmFPAAlloc(
    211     const psMetadata *camera            ///< Camera configuration
    212 );
     161/// Free all data within an FPA (all chips as well as metadata)
     162void pmFPAFreeData(pmFPA *fpa           ///< FPA for which to free data
     163                  );
     164
     165/// Allocate a readout associated with a cell
     166pmReadout *pmReadoutAlloc(pmCell *cell  ///< Parent cell, or NULL
     167                         );
     168
     169/// Allocate a cell associated with a chip
     170///
     171/// The name is used to set CELL.NAME within the concepts.
     172pmCell *pmCellAlloc(pmChip *chip,       ///< Parent chip, or NULL
     173                    const char *name    ///< Name of cell, for CELL.NAME
     174                   );
     175
     176/// Allocate a chip associated with an FPA
     177///
     178/// The name is used to set CHIP.NAME within the concepts
     179pmChip *pmChipAlloc(pmFPA *fpa,         ///< Parent FPA, or NULL
     180                    const char *name    ///< Name of chip, for CHIP.NAME
     181                   );
     182
     183/// Allocate an FPA
     184pmFPA *pmFPAAlloc(const psMetadata *camera ///< Camera configuration (to store in FPA)
     185                 );
    213186
    214187
    215 /** Verify parent links.
    216  *
    217  *  This function checks the validity of the parent links in the FPA hierarchy.
    218  *  If a parent link is not set (or not set correctly), it is corrected, and the
    219  *  function shall return false. If all the parent pointers were correct, the
    220  *  function shall return true.
    221  *
    222  */
    223 bool pmFPACheckParents(
    224     pmFPA *fpa
    225 );
    226 
    227 /* functions to turn on/off the file_exists flags */
    228 bool pmFPASetFileStatus (pmFPA *fpa, bool status);
    229 bool pmChipSetFileStatus (pmChip *chip, bool status);
    230 bool pmCellSetFileStatus (pmCell *cell, bool status);
    231 
    232 /* Functions to check the file_exists flags */
    233 bool pmFPACheckFileStatus(const pmFPA *fpa);
    234 bool pmChipCheckFileStatus(const pmChip *chip);
    235 bool pmCellCheckFileStatus(const pmCell *cell);
    236 
    237 /* functions to turn on/off the data_exists flags */
    238 bool pmFPASetDataStatus (pmFPA *fpa, bool status);
    239 bool pmChipSetDataStatus (pmChip *chip, bool status);
    240 bool pmCellSetDataStatus (pmCell *cell, bool status);
    241 
    242 /** Specify the level for an operation.
    243  */
    244 typedef enum {
    245     PM_FPA_LEVEL_NONE,                  ///< No particular level specified
    246     PM_FPA_LEVEL_FPA,                   ///< Level corresponds to an FPA
    247     PM_FPA_LEVEL_CHIP,                  ///< Level corresponds to a Chip
    248     PM_FPA_LEVEL_CELL,                  ///< Level corresponds to a Cell
    249     PM_FPA_LEVEL_READOUT                ///< Level corresponds to a Readout
    250 } pmFPALevel;
     188/// Check parent links within an FPA
     189///
     190/// Iterates through the FPA to verify that the "parent" links in the chip, cell and readout are set
     191/// correctly.  If there are any incorrect links, they are fixed, and the function returns false.
     192bool pmFPACheckParents(pmFPA *fpa       ///< FPA to check
     193                      );
    251194
    252195
    253 /**
    254  *
    255  * pmFPASelectChip shall set valid to true for the specified chip number
    256  * (chipNum), and all other chips shall have valid set to false. In the event
    257  * that the specified chip number does not exist within the fpa, the function
    258  * shall return false.
    259  *
    260  */
    261 bool pmFPASelectChip(
    262     pmFPA *fpa,
    263     int chipNum,
    264     bool exclusive
    265 );
    266 
    267 bool pmChipSelectCell(pmChip *chip,
    268                       int cellNum,
    269                       bool exclusive
    270                      );
    271 
    272 /**
    273  *
    274  * pmFPAExcludeChip shall set valid to false only for the specified chip
    275  * number (chipNum). In the event that the specified chip number does not exist
    276  * within the fpa, the function shall generate a warning, and perform no action.
    277  * The function shall return the number of chips within the fpa that have valid
    278  * set to true.
    279  *
    280  */
    281 int pmFPAExcludeChip(
    282     pmFPA *fpa,
    283     int chipNum
    284 );
    285 
    286 int pmChipExcludeCell(pmChip *chip,
    287                       int cellNum
    288                      );
    289 
    290 // Set the weights and masks within a cell, based on the gain and RN
    291 bool pmCellSetWeights(pmCell *cell // Cell for which to set weights
    292                      );
    293 
    294 
    295 char *pmFPALevelToName(pmFPALevel level);
    296 pmFPALevel pmFPALevelFromName(const char *name);
    297 
    298196#endif // #ifndef PM_FPA_H
  • trunk/psModules/src/camera/pmFPAConstruct.c

    r9570 r9584  
    99
    1010#include "pmFPA.h"
     11#include "pmFPALevel.h"
     12#include "pmFPAFlags.h"
    1113#include "pmConcepts.h"
    1214#include "pmFPAConstruct.h"
  • trunk/psModules/src/camera/pmFPAMosaic.c

    r8863 r9584  
    77#include <pslib.h>
    88#include "pmFPA.h"
     9#include "pmFPAFlags.h"
    910#include "pmHDU.h"
    1011#include "pmConceptsAverage.h"
  • trunk/psModules/src/camera/pmFPARead.c

    r9570 r9584  
    99
    1010#include "pmFPA.h"
     11#include "pmFPAFlags.h"
    1112#include "pmHDU.h"
    1213#include "pmHDUUtils.h"
  • trunk/psModules/src/camera/pmFPAview.h

    r8047 r9584  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-08-02 02:17:11 $
     9*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-10-17 00:33:56 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    1717
    1818#include "pmFPA.h"
     19#include "pmFPALevel.h"
    1920
    2021/// @addtogroup AstroImage
  • trunk/psModules/src/camera/pmHDUGenerate.c

    r9539 r9584  
    99
    1010#include "pmFPA.h"
     11#include "pmFPALevel.h"
    1112#include "pmHDU.h"
    1213#include "pmHDUUtils.h"
  • trunk/psModules/src/concepts/pmConcepts.h

    r9581 r9584  
    77/// @author Paul Price, IfA
    88///
    9 /// @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    10 /// @date $Date: 2006-10-16 22:03:56 $
     9/// @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     10/// @date $Date: 2006-10-17 00:33:56 $
    1111///
    1212/// Copyright 2005-2006 Institute for Astronomy, University of Hawaii
     
    1818#include <pslib.h>
    1919#include "pmFPA.h"
     20#include "pmFPALevel.h"
    2021
    2122/// Function to call to parse a concept once it has been read
  • trunk/psModules/src/detrend/pmDetrendDB.c

    r9461 r9584  
    77#include <pslib.h>
    88#include "pmFPA.h"
     9#include "pmFPALevel.h"
    910#include "pmDetrendDB.h"
    1011#include "psPipe.h"
  • trunk/psModules/src/detrend/pmDetrendDB.h

    r9433 r9584  
    66*  to the detrend database go through the external dettools functions.  this allows the modules
    77*  and directly dependent program to be sufficiently independent of the database schema that it
    8 *  can be used with any properly defined detrend database tables. 
     8*  can be used with any properly defined detrend database tables.
    99*
    1010*  XXX place the specific name of the detrend database query command in the configuration data
     
    1414*  @author EAM, IfA
    1515*
    16 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    17 *  @date $Date: 2006-10-10 01:02:25 $
     16*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     17*  @date $Date: 2006-10-17 00:33:57 $
    1818*
    1919*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    2222#ifndef PM_DETREND_DB_H
    2323#define PM_DETREND_DB_H
     24
     25#include "pmFPALevel.h"
    2426
    2527typedef enum {
  • trunk/psModules/src/psmodules.h

    r9434 r9584  
    1919#include <pmHDUGenerate.h>
    2020#include <pmFPA.h>
     21#include <pmFPALevel.h>
     22#include <pmFPAFlags.h>
    2123#include <pmFPAview.h>
    2224#include <pmFPAfile.h>
Note: See TracChangeset for help on using the changeset viewer.