IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5974


Ignore:
Timestamp:
Jan 13, 2006, 5:10:19 PM (21 years ago)
Author:
Paul Price
Message:

Reworked the \'concepts\'; altered FPA hierarchy slightly

Location:
branches/eam_rel9_p0/psModules/src/astrom
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel9_p0/psModules/src/astrom/Makefile.am

    r5795 r5974  
    66        pmAstrometry.c \
    77        pmAstrometryObjects.c \
    8         pmChipMosaic.c \
    9         pmFPAConceptsGet.c \
    10         pmFPAConceptsSet.c \
    118        pmFPAConstruct.c \
    129        pmFPARead.c \
    1310        pmFPAWrite.c \
    1411        pmReadout.c \
    15         psAdditionals.c
     12        psAdditionals.c \
     13        pmConcepts.c \
     14        pmConceptsRead.c \
     15        pmConceptsWrite.c \
     16        pmConceptsStandard.c \
     17        pmChipMosaic.c
     18###     pmFPAConceptsGet.c
     19###     pmFPAConceptsSet.c
    1620
    1721psmoduleincludedir = $(includedir)
     
    1923        pmAstrometry.h \
    2024        pmAstrometryObjects.h \
    21         pmChipMosaic.h \
    22         pmFPAConceptsGet.h \
    23         pmFPAConceptsSet.h \
    2425        pmFPAConstruct.h \
    2526        pmFPARead.h \
    2627        pmFPAWrite.h \
    2728        pmReadout.h \
    28         psAdditionals.h
     29        psAdditionals.h \
     30        pmConcepts.h \
     31        pmConceptsRead.h \
     32        pmConceptsWrite.h \
     33        pmConceptsStandard.h \
     34        pmChipMosaic.h
     35###     pmFPAConceptsGet.h
     36###     pmFPAConceptsSet.h
  • branches/eam_rel9_p0/psModules/src/astrom/pmAstrometry.c

    r5795 r5974  
    1313* XXX: Should we implement non-linear cell->chip transforms?
    1414*
    15 *  @version $Revision: 1.11.2.1 $ $Name: not supported by cvs2svn $
    16 *  @date $Date: 2005-12-17 03:18:38 $
     15*  @version $Revision: 1.11.2.1.2.1 $ $Name: not supported by cvs2svn $
     16*  @date $Date: 2006-01-14 03:10:19 $
    1717*
    1818*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include <math.h>
    2626#include "pslib.h"
     27
    2728#include "pmAstrometry.h"
     29#include "pmConcepts.h"
    2830
    2931/*****************************************************************************
     
    201203        chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell);
    202204    }
    203     tmpCell->valid = true;              // All cells are valid by default
     205    tmpCell->process = true;            // All cells are processed by default
     206    tmpCell->exists = false;            // Not yet read in
    204207    tmpCell->hdu = NULL;
     208
     209    pmConceptsBlankCell(tmpCell);
    205210
    206211    psMemSetDeallocator(tmpCell, (psFreeFunc) cellFree);
     
    231236        fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip);
    232237    }
    233     tmpChip->valid = true;              // Work on all chips, by default
     238    tmpChip->process = true;            // Work on all chips, by default
     239    tmpChip->exists = false;            // Not read in yet
    234240    tmpChip->hdu = NULL;
     241
     242    pmConceptsBlankChip(tmpChip);
    235243
    236244    psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree);
     
    251259    tmpFPA->hdu = NULL;
    252260    tmpFPA->phu = NULL;
     261
     262    pmConceptsBlankFPA(tmpFPA);
    253263
    254264    psMemSetDeallocator(tmpFPA, (psFreeFunc) FPAFree);
     
    817827 *****************************************************************************/
    818828
    819 // Set cells within a chip to a specified validity
    820 static bool setCellsValid(const pmChip *chip, // Chip of interest
    821                           bool valid    // Valid?
    822                          )
     829// Set cells within a chip to be processed or not
     830static bool setCellsProcess(const pmChip *chip, // Chip of interest
     831                            bool process  // Process this chip?
     832                           )
    823833{
    824834    PS_ASSERT_PTR_NON_NULL(chip, false);
     
    831841        pmCell *tmpCell = cells->data[i]; // Cell of interest
    832842        if (tmpCell) {
    833             tmpCell->valid = valid;
     843            tmpCell->process = process;
    834844        }
    835845    }
     
    857867        }
    858868        if (i == chipNum) {
    859             tmpChip->valid = true;
    860             setCellsValid(tmpChip, true);
     869            tmpChip->process = true;
     870            setCellsProcess(tmpChip, true);
    861871        } else {
    862             tmpChip->valid = false;
    863             setCellsValid(tmpChip, false);
     872            tmpChip->process = false;
     873            setCellsProcess(tmpChip, false);
    864874        }
    865875
     
    872882/*****************************************************************************
    873883XXX: The SDRS is ambiguous on a few things:
    874     Whether or not the other chips should be set valid=true. [PAP: No]
    875     Should we return the number of chip valid=true before or after they're set, [PAP: After]
     884    Whether or not the other chips should be set process=true. [PAP: No]
     885    Should we return the number of chip process=true before or after they're set, [PAP: After]
    876886 *****************************************************************************/
    877887/**
    878888 *
    879  * pmFPAExcludeChip shall set valid to false only for the specified chip
     889 * pmFPAExcludeChip shall set process to false only for the specified chip
    880890 * number (chipNum). In the event that the specified chip number does not exist
    881891 * within the fpa, the function shall generate a warning, and perform no action.
    882  * The function shall return the number of chips within the fpa that have valid
     892 * The function shall return the number of chips within the fpa that have process
    883893 * set to true.
    884894 *
     
    900910    }
    901911
    902     int numChips = 0;                   // Number of valid chips
     912    int numChips = 0;                   // Number of chips to be processed
    903913    for (int i = 0 ; i < chips->n ; i++) {
    904914        pmChip *tmpChip = (pmChip *) chips->data[i]; // Chip of interest
    905915        if (tmpChip != NULL) {
    906916            if (i == chipNum) {
    907                 tmpChip->valid = false;
    908                 setCellsValid(tmpChip, false); // Wipe out the cell as well
    909             } else if (tmpChip->valid) {
     917                tmpChip->process = false;
     918                setCellsProcess(tmpChip, false); // Wipe out the cell as well
     919            } else if (tmpChip->process) {
    910920                numChips++;
    911921            }
  • branches/eam_rel9_p0/psModules/src/astrom/pmAstrometry.h

    r5795 r5974  
    88*  @author GLG, MHPCC
    99*
    10 *  @version $Revision: 1.5.2.1 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-12-17 03:18:38 $
     10*  @version $Revision: 1.5.2.1.2.1 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-01-14 03:10:19 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9696    psArray *cells;                     ///< The cells (referred to by name)
    9797    pmFPA *parent;                      ///< Parent FPA
    98     bool valid;                         ///< Do we bother about reading and working with this chip?
     98    bool process;                       ///< Do we bother about reading and working with this chip?
     99    bool exists;                        ///< Does the chip exist --- has it been read in?
    99100    p_pmHDU *hdu;                       ///< FITS data
    100101}
     
    125126    psArray *readouts;                  ///< The readouts (referred to by number)
    126127    pmChip *parent;                     ///< Parent chip
    127     bool valid;                         ///< Do we bother about reading and working with this cell?
     128    bool process;                       ///< Do we bother about reading and working with this cell?
     129    bool exists;                        ///< Does the cell exist --- has it been read in?
    128130    p_pmHDU *hdu;                       ///< FITS data
    129131}
  • branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.c

    r5796 r5974  
    106106}
    107107
    108 psImage *pmChipMosaic(pmChip *chip,     // Chip to mosaic
    109                       int xBinChip, int yBinChip // Binning of mosaic image in x and y
    110                      )
     108// Mosaic a chip together into a single image
     109static psImage *mosaicChip(pmChip *chip,// Chip to mosaic
     110                           int xBinChip, int yBinChip // Binning of mosaic image in x and y
     111                          )
    111112{
     113
    112114    psArray *cells = chip->cells;       // The array of cells
    113115    psArray *images = psArrayAlloc(cells->n); // Array of images that will be mosaicked
     
    174176    return mosaic;
    175177}
     178
     179
     180int pmFPAMosaicChips(pmFPA *fpa,        // FPA
     181                     int xBinChip, int yBinChip // Binning of mosaic image in x and y
     182                    )
     183{
     184    assert(fpa);
     185
     186    int numChips = 0;
     187    psArray *chips = fpa->chips;        // Component chips
     188    for (int i = 0; i < chips->n; i++) {
     189        pmChip *chip = chips->data[i];  // The chip of interest
     190        if (! chip || ! chip->exists || ! chip->process) {
     191            continue;
     192        }
     193
     194        numChips++;
     195        psImage *mosaic = mosaicChip(chip, xBinChip, yBinChip); // Mosaic of cells within the chip
     196
     197        // Chop off all the component cells, and put in a new one
     198        psArrayElementsFree(chip->cells);
     199        chip->cells = psArrayRealloc(chip->cells, 1);
     200        pmCell *cell = pmCellAlloc(chip, NULL, __func__); // New cell
     201        pmReadout *readout = pmReadoutAlloc(cell); // New readout
     202        readout->image = mosaic;
     203        psFree(readout);
     204    }
     205
     206    return numChips;
     207
     208}
  • branches/eam_rel9_p0/psModules/src/astrom/pmChipMosaic.h

    r5796 r5974  
    1414                        );
    1515
    16 // Mosaic all the cells in a chip together (neglecting the overscans)
    17 psImage *pmChipMosaic(pmChip *chip,     // Chip to mosaic
    18                       int xBinChip, int yBinChip // Binning of mosaic image in x and y
    19                      );
    20 
     16// Mosaic all the cells in all (valid) chips together (neglecting the overscans); return number of chips
     17int pmFPAMosaicChips(pmFPA *fpa,        // FPA
     18                     int xBinChip, int yBinChip // Binning of mosaic image in x and y
     19                    );
    2120
    2221#endif
  • branches/eam_rel9_p0/psModules/src/astrom/pmFPAConstruct.c

    r5939 r5974  
    6262                     )
    6363{
    64     pmFPA *fpa = pmFPAAlloc(camera); // The FPA to fill out
     64    pmFPA *fpa = pmFPAAlloc(camera);    // The FPA to fill out
    6565    bool mdStatus = true;               // Status from metadata lookups
    6666    const char *phuType = psMetadataLookupStr(&mdStatus, camera, "PHU"); // What is the PHU?
     
    266266    }
    267267
    268     // Initialise with dummy concepts, until the real ones can be read.
    269     pmFPABlankConcepts(fpa);
    270 
    271268    return fpa;
    272269}
  • branches/eam_rel9_p0/psModules/src/astrom/pmFPARead.c

    r5796 r5974  
    44
    55#include "pmAstrometry.h"
    6 #include "pmFPAConceptsGet.h"
    76#include "pmFPARead.h"
     7#include "pmConcepts.h"
    88
    99//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    157157        }
    158158    }
    159     pmFPAIngestConcepts(fpa, db);
     159    pmConceptsReadFPA(fpa, db);
    160160
    161161    psArray *chips = fpa->chips;        // Array of chips
     
    164164        pmChip *chip = chips->data[i]; // The chip
    165165
    166         // Only read chips marked "valid"
    167         if (! chip->valid) {
     166        // Only read chips marked to "process"
     167        if (! chip->process) {
    168168            psTrace(__func__, 2, "Ignoring chip %d...\n", i);
    169169            continue;
     
    179179            }
    180180        }
    181         pmChipIngestConcepts(chip, db);
     181
     182        pmConceptsReadChip(chip, db);
    182183
    183184        // Iterate over the chip
     
    186187            pmCell *cell = cells->data[j]; // The cell
    187188
    188             // Only read cells marked "valid"
    189             if (! cell->valid) {
     189            // Only read cells marked to "process"
     190            if (! cell->process) {
    190191                psTrace(__func__, 3, "Ignoring chip %d...\n", i);
    191192                continue;
     
    203204                }
    204205            }
    205             pmCellIngestConcepts(cell, db);
     206            pmConceptsReadCell(cell, db);
    206207
    207208            psTrace(__func__, 5, "Allocating readouts for chip %d cell %d...\n",
    208209                    i, j);
    209210            generateReadouts(cell, hdu);
    210         }
     211
     212            cell->exists = true;
     213        }
     214        chip->exists = true;
    211215    }
    212216
     
    396400    for (int chipNum = 0; chipNum < chips->n; chipNum++) {
    397401        pmChip *chip = chips->data[chipNum]; // The current chip of interest
    398         if (chip->valid) {
     402        if (chip->process) {
    399403            if (chip->hdu) {
    400404                hdu = chip->hdu;
     
    403407            for (int cellNum = 0; cellNum < cells->n; cellNum++) {
    404408                pmCell *cell = cells->data[cellNum]; // The current cell of interest
    405                 if (cell->valid) {
     409                if (cell->process) {
    406410                    if (cell->hdu) {
    407411                        hdu = cell->hdu;
     
    534538    for (int chipNum = 0; chipNum < chips->n; chipNum++) {
    535539        pmChip *chip = chips->data[chipNum]; // The current chip of interest
    536         if (chip->valid) {
     540        if (chip->process) {
    537541            if (chip->hdu) {
    538542                hdu = chip->hdu;
     
    541545            for (int cellNum = 0; cellNum < cells->n; cellNum++) {
    542546                pmCell *cell = cells->data[cellNum]; // The current cell of interest
    543                 if (cell->valid) {
     547                if (cell->process) {
    544548                    if (cell->hdu) {
    545549                        hdu = cell->hdu;
  • branches/eam_rel9_p0/psModules/src/astrom/pmFPAWrite.c

    r5796 r5974  
    44
    55#include "pmAstrometry.h"
    6 #include "pmFPAConceptsSet.h"
    76#include "pmFPARead.h"
     7#include "pmConcepts.h"
    88
    99static bool writeHDU(psFits *fits,      // FITS file to which to write
     
    2929
    3030    psTrace(__func__, 7, "Outgesting FPA concepts...\n");
    31     pmFPAOutgestConcepts(fpa, db);
     31    pmConceptsWriteFPA(fpa, db);
    3232
    3333    // Write the primary header
     
    4040    for (int i = 0; i < chips->n; i++) {
    4141        pmChip *chip = chips->data[i];  // The component chip
    42         if (chip->valid) {
     42        if (chip->exists && chip->process) {
    4343            psTrace(__func__, 1, "Writing out chip %d...\n", i);
    4444
    45             pmChipOutgestConcepts(chip, db);
     45            pmConceptsWriteChip(chip, db);
    4646
    4747            psArray *cells = chip->cells;       // Array of component cells
    4848            for (int j = 0; j < cells->n; j++) {
    4949                pmCell *cell = cells->data[j]; // The component cell
    50                 if (cell->valid) {
     50                if (cell->exists && cell->process) {
    5151                    psTrace(__func__, 2, "Writing out cell, %d...\n", j);
    5252
    53                     pmCellOutgestConcepts(cell, db);
     53                    pmConceptsWriteCell(cell, db);
    5454
    5555                    if (cell->hdu && strlen(cell->hdu->extname) > 0) {
     
    107107    for (int chipNum = 0; chipNum < chips->n; chipNum++) {
    108108        pmChip *chip = chips->data[chipNum]; // The current chip of interest
    109         if (chip->valid) {
     109        if (chip->exists && chip->process) {
    110110            if (chip->hdu) {
    111111                hdu = chip->hdu;
     
    114114            for (int cellNum = 0; cellNum < cells->n; cellNum++) {
    115115                pmCell *cell = cells->data[cellNum]; // The current cell of interest
    116                 if (cell->valid) {
     116                if (cell->exists && cell->process) {
    117117                    if (cell->hdu) {
    118118                        hdu = cell->hdu;
     
    198198    for (int chipNum = 0; chipNum < chips->n; chipNum++) {
    199199        pmChip *chip = chips->data[chipNum]; // The current chip of interest
    200         if (chip->valid) {
     200        if (chip->exists && chip->process) {
    201201            if (chip->hdu) {
    202202                hdu = chip->hdu;
     
    205205            for (int cellNum = 0; cellNum < cells->n; cellNum++) {
    206206                pmCell *cell = cells->data[cellNum]; // The current cell of interest
    207                 if (cell->valid) {
     207                if (cell->exists && cell->process) {
    208208                    if (cell->hdu) {
    209209                        hdu = cell->hdu;
Note: See TracChangeset for help on using the changeset viewer.