00001 /* @file pmFPA.h 00002 * @brief Defines the focal plane hierarchy, along with functions for interacting with it 00003 * 00004 * @author George Gusciora, MHPCC 00005 * @author Paul Price, IfA 00006 * @author Eugene Magnier, IfA 00007 * 00008 * @version $Revision: 1.12 $ $Name: $ 00009 * @date $Date: 2007/01/24 02:54:14 $ 00010 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 00011 */ 00012 00013 #ifndef PM_FPA_H 00014 #define PM_FPA_H 00015 00016 /// @addtogroup Camera Camera Layout 00017 /// @{ 00018 00019 #include <pslib.h> 00020 #include "pmHDU.h" 00021 00022 #define FPA_ASTROM 1 ///< Include astrometry information in the structures? 00023 00024 /// Focal plane array (the entirety of the camera) 00025 /// 00026 /// The FPA is the top-level camera structure, and consists of one or more chips. It also contains the 00027 /// concepts metadata appropriate to this level, a summary of analysis tasks that have been performed, the 00028 /// camera configuration information, any HDU that corresponds to this level for the file of interest, and 00029 /// astrometric transformations. The astrometric transformations encode how to transform from the tangent 00030 /// plane to the sky, and back. 00031 typedef struct 00032 { 00033 #if FPA_ASTROM 00034 // Astrometric transformations 00035 psPlaneTransform *fromTPA; ///< Transformation from tangent plane to focal plane, or NULL 00036 psPlaneTransform *toTPA; ///< Transformation from focal plane to tangent plane, or NULL 00037 psProjection *toSky; ///< Projection from tangent plane to sky, or NULL 00038 #endif 00039 // Information 00040 psMetadata *concepts; ///< FPA-level concepts 00041 unsigned int conceptsRead; ///< Which concepts have been read; see pmConceptsSource 00042 psMetadata *analysis; ///< FPA-level analysis metadata 00043 const psMetadata *camera; ///< Camera configuration 00044 psArray *chips; ///< The component chips 00045 pmHDU *hdu; ///< FITS header data unit of interest, or NULL 00046 } 00047 pmFPA; 00048 00049 /// A chip (contiguous detector element) 00050 /// 00051 /// The chip is the mid-level camera structure, being part of an FPA, and consisting of one or more cells 00052 /// (e.g., a CCD). It also contains the concepts metadata appropriate to this level, a summary of analysis 00053 /// tasks that have been performed, status flags, any HDU that corresponds to this level for the file of 00054 /// interest, and astrometric transformations. The astrometric transformations provide transforms between the 00055 /// chip and FPA coordinates and back. 00056 typedef struct 00057 { 00058 #if FPA_ASTROM 00059 // Astrometric transformations 00060 psPlaneTransform *toFPA; ///< Transformation from chip to FPA coordinates, or NULL 00061 psPlaneTransform *fromFPA; ///< Transformation from FPA to chip coordinates, or NULL 00062 #endif 00063 // Information 00064 psMetadata *concepts; ///< Chip-level concepts 00065 unsigned int conceptsRead; ///< Which concepts have been read; see pmConceptsSource 00066 psMetadata *analysis; ///< Chip-level analysis metadata 00067 psArray *cells; ///< The component cells 00068 pmFPA *parent; ///< Parent FPA 00069 bool process; ///< Do we bother about reading and working with this chip? 00070 bool file_exists; ///< Does the file for this chip exist (read case only)? 00071 bool data_exists; ///< Does the data for this chip exist (read case only)? 00072 pmHDU *hdu; ///< FITS header data unit of interest, 00073 } 00074 pmChip; 00075 00076 /// A cell (smallest logical unit) 00077 /// 00078 /// A cell is the lowest-level camera structure, being part of a chip (e.g., an amplifier). It may consist of 00079 /// one or more readouts, which are individual reads of the cell. It also contains the concepts metadata 00080 /// appropriate to this level, the cell configuration information (for convenience) from the camera 00081 /// configuration, a summary of analysis tasks that have been performed, status flags, and any HDU that 00082 /// corresponds to this level for the file of interest 00083 00084 /** Cell data structure 00085 * 00086 * A cell consists of one or more readouts. It also contains a pointer to the 00087 * cell's metadata, and its parent chip. On the astrometry side, it also 00088 * contains coordinate transforms from the cell to chip, from the cell to 00089 * focal-plane, as well as a "quick and dirty" tranform from the cell to 00090 * sky coordinates. 00091 * 00092 */ 00093 typedef struct 00094 { 00095 psMetadata *concepts; ///< Cell-level concepts 00096 unsigned int conceptsRead; ///< Which concepts have been read; see pmConceptsSource 00097 psMetadata *config; ///< Cell configuration information (from CELLS in the camera config) 00098 psMetadata *analysis; ///< Cell-level analysis metadata 00099 psArray *readouts; ///< The component readouts 00100 pmChip *parent; ///< Parent chip 00101 bool process; ///< Do we bother about reading and working with this cell? 00102 bool file_exists; ///< Does the file for this cell exist (read case only)? 00103 bool data_exists; ///< Does the data for this cell exist (read case only)? 00104 pmHDU *hdu; ///< FITS header data unit of interest 00105 } 00106 pmCell; 00107 00108 /// A readout (individual read of a cell) 00109 /// 00110 /// A readout corresponds to an individual read of a cell (e.g., a single image as part of a video sequence, 00111 /// or one of multiple coadds). It contains the actual pixels used in analysis (along with mask and weight 00112 /// maps). When reading from a FITS file, the images are subimages (from CELL.TRIMSEC) of the pixels read 00113 /// from the appropriate HDU (at the FPA, chip or cell level). The readout also contains a list of bias 00114 /// sections (prescans or overscans, or otherwise), a summary of analysis tasks that have been performed, 00115 /// status flags, and the offsets used for reading a FITS file incrementally. 00116 typedef struct 00117 { 00118 int col0; ///< Column offset; non-zero if reading in columns incrementally 00119 int row0; ///< Row offset; non-zero if reading in rows incrementally 00120 psImage *image; ///< Imaging area of readout (corresponds to CELL.TRIMSEC region) 00121 psImage *mask; ///< Mask of input image (corresponds to CELL.TRIMSEC region) 00122 psImage *weight; ///< Weight of input image (corresponds to CELL.TRIMSEC region) 00123 psList *bias; ///< List of bias (prescan/overscan) images 00124 psMetadata *analysis; ///< Readout-level analysis metadata 00125 pmCell *parent; ///< Parent cell 00126 bool process; ///< Do we bother about reading and working with this readout? 00127 bool file_exists; ///< Does the file for this readout exist (read case only)? 00128 bool data_exists; ///< Does the data for this readout exist (read case only)? 00129 } 00130 pmReadout; 00131 00132 /// Free all readouts within a cell 00133 void pmCellFreeReadouts(pmCell *cell ///< Cell for which to free readouts 00134 ); 00135 00136 /// Free all cells within a chip 00137 void pmChipFreeCells(pmChip *chip ///< Chip for which to free cells 00138 ); 00139 00140 /// Free all data within a readout 00141 void pmReadoutFreeData(pmReadout *readout ///< Readout for which to free data 00142 ); 00143 00144 /// Free all data within a cell (all readouts as well as metadata) 00145 void pmCellFreeData(pmCell *cell ///< Cell for which to free data 00146 ); 00147 00148 /// Free all data within a chip (all cells as well as metadata) 00149 void pmChipFreeData(pmChip *chip ///< Chip for which to free data 00150 ); 00151 00152 /// Free all data within an FPA (all chips as well as metadata) 00153 void pmFPAFreeData(pmFPA *fpa ///< FPA for which to free data 00154 ); 00155 00156 /// Allocate a readout associated with a cell 00157 pmReadout *pmReadoutAlloc(pmCell *cell ///< Parent cell, or NULL 00158 ); 00159 00160 /// Allocate a cell associated with a chip 00161 /// 00162 /// The name is used to set CELL.NAME within the concepts. 00163 pmCell *pmCellAlloc(pmChip *chip, ///< Parent chip, or NULL 00164 const char *name ///< Name of cell, for CELL.NAME 00165 ); 00166 00167 /// Allocate a chip associated with an FPA 00168 /// 00169 /// The name is used to set CHIP.NAME within the concepts 00170 pmChip *pmChipAlloc(pmFPA *fpa, ///< Parent FPA, or NULL 00171 const char *name ///< Name of chip, for CHIP.NAME 00172 ); 00173 00174 /// Allocate an FPA 00175 pmFPA *pmFPAAlloc(const psMetadata *camera ///< Camera configuration (to store in FPA) 00176 ); 00177 00178 00179 /// Check parent links within an FPA 00180 /// 00181 /// Iterates through the FPA to verify that the "parent" links in the chip, cell and readout are set 00182 /// correctly. If there are any incorrect links, they are fixed, and the function returns false. 00183 bool pmFPACheckParents(pmFPA *fpa ///< FPA to check 00184 ); 00185 /// @} 00186 #endif // #ifndef PM_FPA_H
1.5.1