Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

pmFPA.h

Go to the documentation of this file.
00001 /** @file  pmFPA.h
00002 *
00003 *  @brief This file defines the basic types the focal plane hierarchy.
00004 *
00005 *  @ingroup AstroImage
00006 *
00007 *  @author GLG, MHPCC
00008 *
00009 *  @version $Revision: 1.5 $ $Name: rel12 $
00010 *  @date $Date: 2006/06/22 20:03:50 $
00011 *
00012 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00013 */
00014 
00015 #ifndef PM_FPA_H
00016 #define PM_FPA_H
00017 #if HAVE_CONFIG_H
00018 #include <config.h>
00019 #endif
00020 
00021 #include "pslib.h"
00022 #include "pmHDU.h"
00023 
00024 # define FPA_ASTROM 1
00025 
00026 /// @addtogroup AstroImage
00027 /// @{
00028 
00029 /** Focal plane data structure
00030  *
00031  *  A focal plane consists of one or more chips (according to the number of
00032  *  pieces of contiguous silicon). It contains metadata containers for the
00033  *  concepts and analysis, a link to the parent, and pointers to the FITS header,
00034  *  if that corresponds to this level (the FPA may be the PHU, but will not ever
00035  *  contain pixels). For astrometry, it contains a transformation from the focal
00036  *  plane to the tangent plane and the fixed pattern residuals. It is expected
00037  *  that the transformation will consist of two 4D polynomials (i.e. a function
00038  *  of two coordinates in position, the magnitude of the object, and the color of
00039  *  the object) in order to correct for optical distortions and the effects of
00040  *  the atmosphere; hence we think that it is prudent to include a reverse
00041  *  transformation which will be derived from numerically inverting the forward
00042  *  transformation.
00043  *
00044  */
00045 typedef struct
00046 {
00047     # if FPA_ASTROM
00048     // Astrometric transformations
00049     psPlaneDistort* fromTangentPlane;   ///< Transformation from tangent plane to focal plane
00050 psPlaneDistort* toTangentPlane;     ///< Transformation from focal plane to tangent plane
00051 psProjection *projection;           ///< Projection from tangent plane to sky
00052 # endif
00053 // Information
00054 psMetadata *concepts;               ///< Cache for PS concepts
00055 unsigned int conceptsRead;          ///< Which concepts have been read
00056 psMetadata *analysis;               ///< FPA-level analysis metadata
00057 const psMetadata *camera;           ///< Camera configuration
00058 psArray *chips;                     ///< The chips
00059 pmHDU *hdu;                         ///< FITS data
00060 }
00061 pmFPA;
00062 
00063 /** Chip data structure
00064  *
00065  *  A chip consists of one or more cells (according to the number of amplifiers
00066  *  on the device). The chip contains metadata containers for the concepts and
00067  *  analysis, a link to the parent, and pointers to the pointers to the various
00068  *  FITS data, if that corresponds to this level. For astrometry, in addition to
00069  *  the rough positioning information, it contains a coordinate transform from
00070  *  the chip to the focal plane. It is expected that this transform will consist
00071  *  of two second-order 2D polynomials; hence we think that it is prudent to
00072  *  include a reverse transformation which will be derived from numerically
00073  *  inverting the forward transformation. A boolean indicates whether the chip is
00074  *  of interest, allowing it to be excluded from analysis.
00075  *
00076  */
00077 typedef struct
00078 {
00079 # if FPA_ASTROM
00080     // Offset specifying position on focal plane
00081     int col0;                           ///< Offset from the left of FPA.
00082 int row0;                           ///< Offset from the bottom of FPA.
00083 // Astrometric transformations
00084 psPlaneTransform* toFPA;            ///< Transformation from chip to FPA coordinates
00085 psPlaneTransform* fromFPA;          ///< Transformation from FPA to chip coordinates
00086 # endif
00087 // Information
00088 psMetadata *concepts;               ///< Cache for PS concepts
00089 unsigned int conceptsRead;          ///< Which concepts have been read
00090 psMetadata *analysis;               ///< Chip-level analysis metadata
00091 psArray *cells;                     ///< The cells (referred to by name)
00092 pmFPA *parent;                      ///< Parent FPA
00093 bool process;                       ///< Do we bother about reading and working with this chip?
00094 bool file_exists;                   ///< Does the file for this chip exist (read case only)?
00095 bool data_exists;                   ///< Does the data for this chip exist (read case only)?
00096 pmHDU *hdu;                         ///< FITS data
00097 struct pmCell *mosaic;              ///< A mosaic cell
00098 }
00099 pmChip;
00100 
00101 /** Cell data structure
00102  *
00103  *  A cell consists of one or more readouts.  It also contains a pointer to the
00104  *  cell's metadata, and its parent chip.  On the astrometry side, it also
00105  *  contains coordinate transforms from the cell to chip, from the cell to
00106  *  focal-plane, as well as a "quick and dirty" tranform from the cell to
00107  *  sky coordinates.
00108  *
00109  */
00110 typedef struct
00111 {
00112 psMetadata *concepts;               ///< Cache for PS concepts
00113 unsigned int conceptsRead;          ///< Which concepts have been read
00114 psMetadata *config;                 ///< Cell configuration info
00115 psMetadata *analysis;               ///< Cell-level analysis metadata
00116 psArray *readouts;                  ///< The readouts (referred to by number)
00117 pmChip *parent;                     ///< Parent chip
00118 bool process;                       ///< Do we bother about reading and working with this cell?
00119 bool file_exists;                   ///< Does the file for this cell exist (read case only)?
00120 bool data_exists;                   ///< Does the data for this cell exist (read case only)?
00121 pmHDU *hdu;                         ///< FITS data
00122 }
00123 pmCell;
00124 
00125 /** Readout data structure.
00126  *
00127  *  A readout is the result of a single read of a cell (or a portion thereof).
00128  *  It contains the offset from the lower-left corner of the chip, in the case
00129  *  that the CCD was windowed, as well as the binning factors and parity (if the
00130  *  binning value is negative, then the parity is reversed). It also contains the
00131  *  pixel data, metadata containers for the concepts and analysis, and a link to
00132  *  the parent.
00133  *
00134  */
00135 typedef struct
00136 {
00137 int col0;                           ///< Column offset; non-zero if reading in columns bit by bit
00138 int row0;                           ///< Row offset; non-zero if reading in rows bit by bit
00139 psImage *image;                     ///< Imaging area of readout
00140 psImage *mask;                      ///< Mask of input image
00141 psImage *weight;                    ///< Weight of input image
00142 psList *bias;                       ///< Overscan images
00143 psMetadata *analysis;               ///< Readout-level analysis metadata
00144 pmCell *parent;                     ///< Parent cell
00145 bool process;                       ///< Do we bother about reading and working with this readout?
00146 bool file_exists;                   ///< Does the file for this readout exist (read case only)?
00147 bool data_exists;                   ///< Does the data for this readout exist (read case only)?
00148 }
00149 pmReadout;
00150 
00151 void pmCellFreeReadouts(pmCell *cell);
00152 void pmChipFreeCells(pmChip *chip);
00153 
00154 void pmReadoutFreeData (pmReadout *readout);
00155 void pmCellFreeData(pmCell *cell);
00156 void pmChipFreeData(pmChip *chip);
00157 void pmFPAFreeData(pmFPA *fpa);
00158 
00159 /** Allocates a pmReadout
00160  *
00161  *  The constructor shall make an empty pmReadout. If the parent cell is not
00162  *  NULL, the parent link is made and the readout shall be placed in the
00163  *  parents array of readouts. The metadata containers shall be allocated. All
00164  *  other pointers in the structure shall be initialized to NULL.
00165  *
00166  *  @return pmReadout*    newly allocated pmReadout with all internal pointers set to NULL
00167  */
00168 pmReadout *pmReadoutAlloc(
00169     pmCell *cell                        ///< Parent cell
00170 );
00171 
00172 /** Allocates a pmCell
00173  *
00174  *  The constructor shall make an empty pmCell. If the parent chip is not NULL,
00175  *  the parent link is made and the cell shall be placed in the parents array of
00176  *  cells. The readouts array shall be allocated with a zero size, and the
00177  *  metadata containers constructed. All other pointers in the structure shall be
00178  *  initialized to NULL.
00179  *
00180  *  @return pmCell*    newly allocated pmCell
00181  */
00182 pmCell *pmCellAlloc(
00183     pmChip *chip,       ///< Parent chip
00184     const char *name    ///< Name of cell
00185 );
00186 
00187 /** Allocates a pmChip
00188  *
00189  *  The constructor shall make an empty pmChip. If the parent fpa is not NULL,
00190  *  the parent link is made and the chip shall be placed in the parent's array
00191  *  of chips. The cells array shall be allocated with a zero size, and the
00192  *  metadata containers constructed. All other pointers in the structure shall be
00193  *  initialized to NULL.
00194  *
00195  *  @return pmChip*    newly allocated pmChip
00196  */
00197 pmChip *pmChipAlloc(
00198     pmFPA *fpa,                         ///< FPA to which the chip belongs
00199     const char *name                    ///< Name of chip
00200 );
00201 
00202 /** Allocates a pmFPA
00203  *
00204  *  The constructor shall make an empty pmFPA. The chips array shall be
00205  *  allocated with a zero size, the camera and db pointers set to the values
00206  *  provided, and the concepts metadata constructed. All other pointers in the
00207  *  structure shall be initialized to NULL.
00208  *
00209  */
00210 pmFPA *pmFPAAlloc(
00211     const psMetadata *camera            ///< Camera configuration
00212 );
00213 
00214 
00215 /** Verify parent links.
00216  *
00217  *  This function checks the validity of the parent links in the FPA hierarchy.
00218  *  If a parent link is not set (or not set correctly), it is corrected, and the
00219  *  function shall return false. If all the parent pointers were correct, the
00220  *  function shall return true.
00221  *
00222  */
00223 bool pmFPACheckParents(
00224     pmFPA *fpa
00225 );
00226 
00227 /* functions to turn on/off the file_exists flags */
00228 bool pmFPASetFileStatus (pmFPA *fpa, bool status);
00229 bool pmChipSetFileStatus (pmChip *chip, bool status);
00230 bool pmCellSetFileStatus (pmCell *cell, bool status);
00231 
00232 /* functions to turn on/off the data_exists flags */
00233 bool pmFPASetDataStatus (pmFPA *fpa, bool status);
00234 bool pmChipSetDataStatus (pmChip *chip, bool status);
00235 bool pmCellSetDataStatus (pmCell *cell, bool status);
00236 
00237 /** Specify the level for an operation.
00238  */
00239 typedef enum {
00240     PM_FPA_LEVEL_NONE,                  ///< No particular level specified
00241     PM_FPA_LEVEL_FPA,                   ///< Level corresponds to an FPA
00242     PM_FPA_LEVEL_CHIP,                  ///< Level corresponds to a Chip
00243     PM_FPA_LEVEL_CELL,                  ///< Level corresponds to a Cell
00244     PM_FPA_LEVEL_READOUT                ///< Level corresponds to a Readout
00245 } pmFPALevel;
00246 
00247 
00248 /**
00249  *
00250  * pmFPASelectChip shall set valid to true for the specified chip number
00251  * (chipNum), and all other chips shall have valid set to false. In the event
00252  * that the specified chip number does not exist within the fpa, the function
00253  * shall return false.
00254  *
00255  */
00256 bool pmFPASelectChip(
00257     pmFPA *fpa,
00258     int chipNum,
00259     bool exclusive
00260 );
00261 
00262 bool pmChipSelectCell(pmChip *chip,
00263                       int cellNum,
00264                       bool exclusive
00265                      );
00266 
00267 /**
00268  *
00269  * pmFPAExcludeChip shall set valid to false only for the specified chip
00270  * number (chipNum). In the event that the specified chip number does not exist
00271  * within the fpa, the function shall generate a warning, and perform no action.
00272  * The function shall return the number of chips within the fpa that have valid
00273  * set to true.
00274  *
00275  */
00276 int pmFPAExcludeChip(
00277     pmFPA *fpa,
00278     int chipNum
00279 );
00280 
00281 int pmChipExcludeCell(pmChip *chip,
00282                       int cellNum
00283                      );
00284 
00285 // Set the weights and masks within a cell, based on the gain and RN
00286 bool pmCellSetWeights(pmCell *cell // Cell for which to set weights
00287                      );
00288 
00289 
00290 char *pmFPALevelToName(pmFPALevel level);
00291 pmFPALevel pmFPALevelFromName(const char *name);
00292 
00293 #endif // #ifndef PM_FPA_H

Generated on Mon Jul 3 14:24:27 2006 for Pan-STARRS Module Library by  doxygen 1.4.4