IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6552


Ignore:
Timestamp:
Mar 8, 2006, 5:08:08 PM (20 years ago)
Author:
Paul Price
Message:

Broad changes to introduce pmHDU, and allow read/write at any level. Modified the camera configuration to use camera config (components of the camera) and format descriptions (FITS file layout).

Location:
branches/rel10_ifa/psModules/src/astrom
Files:
15 edited

Legend:

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

    r6521 r6552  
    55libpsmoduleastrom_la_SOURCES  = \
    66        pmFPA.c \
    7         pmFPAAstrometry.c \
    8         pmAstrometryObjects.c \
    97        pmFPAConstruct.c \
    108        pmFPARead.c \
    11         pmFPAWrite.c \
    12         pmFPAfile.c \
    13         pmFPAview.c \
     9        pmHDU.c \
    1410        pmReadout.c \
    15         psAdditionals.c \
    1611        pmConcepts.c \
    1712        pmConceptsRead.c \
    1813        pmConceptsWrite.c \
    19         pmConceptsStandard.c \
    20         pmChipMosaic.c
     14        pmConceptsStandard.c
     15#       pmChipMosaic.c
     16#       pmFPAfile.c
     17#       pmFPAview.c
     18#       pmFPAWrite.c
     19#       pmFPAAstrometry.c
     20#       pmAstrometryObjects.c
    2121
    2222psmoduleincludedir = $(includedir)
    2323psmoduleinclude_HEADERS = \
    2424        pmFPA.h \
    25         pmFPAAstrometry.h \
    26         pmAstrometryObjects.h \
    2725        pmFPAConstruct.h \
    2826        pmFPARead.h \
    29         pmFPAWrite.h \
    30         pmFPAfile.c \
    31         pmFPAview.c \
     27        pmHDU.h \
    3228        pmReadout.h \
    3329        psAdditionals.h \
     
    3531        pmConceptsRead.h \
    3632        pmConceptsWrite.h \
    37         pmConceptsStandard.h \
    38         pmChipMosaic.h
     33        pmConceptsStandard.h
     34#       pmChipMosaic.h
     35#       pmFPAfile.c
     36#       pmFPAview.c
     37#       pmFPAWrite.h
     38#       pmFPAAstrometry.h
     39#       pmAstrometryObjects.h
  • branches/rel10_ifa/psModules/src/astrom/pmConcepts.c

    r6448 r6552  
    154154            }
    155155        }
    156         psMetadataAddItem(target, conceptItem, PS_LIST_TAIL, PS_META_REPLACE);
    157         psFree(conceptItem);            // Drop reference
     156        if (conceptItem) {
     157            psMetadataAddItem(target, conceptItem, PS_LIST_TAIL, PS_META_REPLACE);
     158            psFree(conceptItem);        // Drop reference
     159        }
     160        // No error if conceptItem is NULL, since that may only mean that the required information isn't
     161        // present yet.
    158162    }
    159163    psFree(specsIter);
     
    537541{
    538542    // Copy FPA concepts
    539     target->concepts = pap_psMetadataCopy(target->concepts, source->concepts);
     543    target->concepts = psMetadataCopy(target->concepts, source->concepts);
    540544
    541545    // Copy chip concepts
     
    553557            continue;
    554558        }
    555         targetChip->concepts = pap_psMetadataCopy(targetChip->concepts, sourceChip->concepts);
     559        targetChip->concepts = psMetadataCopy(targetChip->concepts, sourceChip->concepts);
    556560
    557561        // Copy cell concepts
     
    569573                continue;
    570574            }
    571             targetCell->concepts = pap_psMetadataCopy(targetCell->concepts, sourceCell->concepts);
     575            targetCell->concepts = psMetadataCopy(targetCell->concepts, sourceCell->concepts);
    572576        }
    573577    }
  • branches/rel10_ifa/psModules/src/astrom/pmConcepts.h

    r6448 r6552  
    4040                      );
    4141
     42#if 0
     43// Some specificity to reading and writing concepts
     44typedef enum {
     45    PM_CONCEPT_SOURCE_ALL      = 0x00,  // Do all sources
     46    PM_CONCEPT_SOURCE_CAMERA   = 0x01,  // Do concepts that come from the camera information
     47    PM_CONCEPT_SOURCE_DEFAULTS = 0x02,  // Do concepts that come from defaults
     48    PM_CONCEPT_SOURCE_HEADER   = 0x04,  // Do concepts that come from FITS header
     49    PM_CONCEPT_SOURCE_DATABASE = 0x08   // Do concepts that come from database
     50} pmConceptSource;
     51#endif
     52
    4253// Set blanks, read or write concepts at the appropriate level
    43 bool pmConceptsBlankFPA(pmFPA *fpa    // FPA for which to set blank concepts
     54bool pmConceptsBlankFPA(pmFPA *fpa      // FPA for which to set blank concepts
    4455                       );
    4556bool pmConceptsReadFPA(pmFPA *fpa,      // FPA for which to read concepts
     
    4960                        psDB *db        // Database handle
    5061                       );
    51 bool pmConceptsBlankChip(pmChip *chip // FPA for which to set blank concepts
     62bool pmConceptsBlankChip(pmChip *chip   // FPA for which to set blank concepts
    5263                        );
    5364bool pmConceptsReadChip(pmChip *chip,   // Chip for which to read concepts
     
    5566                       );
    5667bool pmConceptsWriteChip(pmChip *chip,  // Chip for which to write concepts
    57                          psDB *db        // Database handle
     68                         psDB *db       // Database handle
    5869                        );
    59 bool pmConceptsBlankCell(pmCell *cell // Cell for which to set blank concepts
     70bool pmConceptsBlankCell(pmCell *cell   // Cell for which to set blank concepts
    6071                        );
    6172bool pmConceptsReadCell(pmCell *cell,   // Cell for which to read concepts
  • branches/rel10_ifa/psModules/src/astrom/pmConceptsRead.c

    r6448 r6552  
    1313{
    1414    if (cell) {
    15         psMetadata *camera = cell->camera;      // Camera data
     15        psMetadata *camera = cell->config; // Camera configuration
    1616        psMetadataItem *item = psMetadataLookup(camera, concept);
    1717        return item;
     
    5555        if (fpa->hdu) {
    5656            psMetadataItem *fpaItem = psMetadataLookup(fpa->hdu->header, keyword);
    57             if (fpaItem) {
    58                 // XXX: Need to clean up before returning
    59                 return fpaItem;
    60             }
    61         }
    62 
    63         if (fpa->phu) {
    64             psMetadataItem *fpaItem = psMetadataLookup(fpa->phu, keyword);
    6557            if (fpaItem) {
    6658                // XXX: Need to clean up before returning
  • branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c

    r6448 r6552  
    663663    if (strcasecmp(source, "VALUE") == 0) {
    664664        // Check that it's the same value as stored in the camera
    665         psString checkString = psMetadataLookupStr(NULL, cell->camera, "CELL.TRIMSEC");
     665        psString checkString = psMetadataLookupStr(NULL, cell->config, "CELL.TRIMSEC");
    666666        psRegion checkRegion = psRegionFromString(checkString);
    667667        if (! COMPARE_REGIONS(&checkRegion, trimsec)) {
     
    709709    if (strcasecmp(source, "VALUE") == 0) {
    710710        // Check that it's the same value as stored in the camera
    711         psString checkString = psMetadataLookupStr(NULL, cell->camera, "CELL.BIASSEC");
     711        psString checkString = psMetadataLookupStr(NULL, cell->config, "CELL.BIASSEC");
    712712        psList *checkList = psStringSplit(checkString, " ;");
    713713        if (biassecs->n != checkList->n) {
     
    763763
    764764    if (strcasecmp(source, "HEADER") == 0) {
    765         psString keywordsString = psMetadataLookupStr(NULL, cell->camera, "CELL.BIASSEC");
     765        psString keywordsString = psMetadataLookupStr(NULL, cell->config, "CELL.BIASSEC");
    766766        psList *keywords = psStringSplit(keywordsString, " ,;");
    767767        if (biassecs->n != keywords->n) {
  • branches/rel10_ifa/psModules/src/astrom/pmConceptsWrite.c

    r6448 r6552  
    7373                           )
    7474{
    75     if (! cell->camera) {
     75    if (! cell->config) {
    7676        return false;
    7777    }
    7878    if (cell) {
    79         psMetadataItem *item = psMetadataLookup(cell->camera, concept->name); // Info we want
     79        psMetadataItem *item = psMetadataLookup(cell->config, concept->name); // Info we want
    8080        return compareConcepts(item, concept);
    8181    }
     
    138138            psTrace(__func__, 7, "Adding to the FPA level header...\n");
    139139            psMetadataAddItem(fpa->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE);
    140             status = true;
    141         } else {
    142             // In desperation, add to the PHU --- it HAS to be in the header somewhere!
    143             if (! fpa->phu) {
    144                 fpa->phu = psMetadataAlloc();
    145             }
    146             psTrace(__func__, 7, "Adding to the PHU...\n");
    147             psMetadataAddItem(fpa->phu, headerItem, PS_LIST_TAIL, PS_META_REPLACE);
    148140            status = true;
    149141        }
  • branches/rel10_ifa/psModules/src/astrom/pmFPA.c

    r6448 r6552  
    1212* XXX: Should we implement non-linear cell->chip transforms?
    1313*
    14 *  @version $Revision: 1.1.4.1 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2006-02-17 17:13:41 $
     14*  @version $Revision: 1.1.4.2 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2006-03-09 03:08:08 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "pslib.h"
    2727
     28#include "pmHDU.h"
    2829#include "pmFPA.h"
    2930#include "pmConcepts.h"
     
    9798        #endif
    9899
    99         psFree(cell->toChip);
    100         psFree(cell->toFPA);
    101         psFree(cell->toSky);
    102100        psFree(cell->concepts);
    103101        psFree(cell->analysis);
    104         psFree(cell->camera);
     102        psFree(cell->config);
    105103        psFree(cell->hdu);
    106104    }
     
    135133        #endif
    136134
     135        #if 0
     136
    137137        psFree(chip->toFPA);
    138138        psFree(chip->fromFPA);
     139        #endif
     140
    139141        psFree(chip->concepts);
    140142        psFree(chip->analysis);
     
    148150    if (fpa != NULL) {
    149151        psTrace(__func__, 9, "Freeing fpa %lx\n", (size_t)fpa);
     152        #if 0
     153
    150154        psFree(fpa->fromTangentPlane);
    151155        psFree(fpa->toTangentPlane);
    152156        psFree(fpa->projection);
     157        #endif
     158
    153159        psFree(fpa->concepts);
    154160        psFree(fpa->analysis);
     
    172178        psFree(fpa->chips);
    173179        psFree(fpa->hdu);
    174         psFree(fpa->phu);
    175180    }
    176181}
     
    230235
    231236
    232 
    233 void p_pmHDUFree(p_pmHDU *hdu)
    234 {
    235     if (hdu) {
    236         psFree(hdu->extname);
    237         psFree(hdu->header);
    238         psFree(hdu->images);
    239         psFree(hdu->masks);
    240         psFree(hdu->weights);
    241     }
    242 }
    243 
    244 // XXX: Verify these default values for row0, col0, rowBins, colBins
    245 // PAP: These values may disappear in the future in favour of values in parent->concepts?
    246237pmReadout *pmReadoutAlloc(pmCell *cell)
    247238{
    248239    pmReadout *tmpReadout = (pmReadout *) psAlloc(sizeof(pmReadout));
    249240
    250     tmpReadout->col0 = 0;
    251     tmpReadout->row0 = 0;
    252     tmpReadout->colBins = 0;
    253     tmpReadout->rowBins = 0;
    254241    tmpReadout->image = NULL;
    255242    tmpReadout->mask = NULL;
     
    276263pmCell *pmCellAlloc(
    277264    pmChip *chip,
    278     psMetadata *cameraData,
    279265    const char *name)
    280266{
    281267    pmCell *tmpCell = (pmCell *) psAlloc(sizeof(pmCell));
    282268
    283     tmpCell->col0 = 0;
    284     tmpCell->row0 = 0;
    285     tmpCell->toChip = NULL;
    286     tmpCell->toFPA = NULL;
    287     tmpCell->toSky = NULL;
    288269    tmpCell->concepts = psMetadataAlloc();
    289270    psBool rc = psMetadataAddStr(tmpCell->concepts, PS_LIST_HEAD, "CELL.NAME", 0, NULL, name);
     
    291272        psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not add CELL.NAME to metadata.\n");
    292273    }
    293     tmpCell->camera = psMemIncrRefCounter(cameraData);
     274    tmpCell->config = NULL;
    294275    tmpCell->analysis = psMetadataAlloc();
    295276    tmpCell->readouts = psArrayAlloc(0);
     
    323304    pmChip *tmpChip = (pmChip *) psAlloc(sizeof(pmChip));
    324305
     306    #if 0
     307
    325308    tmpChip->col0 = 0;
    326309    tmpChip->row0 = 0;
    327310    tmpChip->toFPA = NULL;
    328311    tmpChip->fromFPA = NULL;
     312    #endif
     313
    329314    tmpChip->concepts = psMetadataAlloc();
    330315    psBool rc = psMetadataAddStr(tmpChip->concepts, PS_LIST_HEAD, "CHIP.NAME", 0, NULL, name);
     
    359344    pmFPA *tmpFPA = (pmFPA *) psAlloc(sizeof(pmFPA));
    360345
     346    #if 0
     347
    361348    tmpFPA->fromTangentPlane = NULL;
    362349    tmpFPA->toTangentPlane = NULL;
    363350    tmpFPA->projection = NULL;
     351    #endif
     352
    364353    tmpFPA->concepts = psMetadataAlloc();
    365354    tmpFPA->analysis = NULL;
     
    367356    tmpFPA->chips = psArrayAlloc(0);
    368357    tmpFPA->hdu = NULL;
    369     tmpFPA->phu = NULL;
    370358
    371359    pmConceptsBlankFPA(tmpFPA);
     
    375363}
    376364
    377 p_pmHDU *p_pmHDUAlloc(const char *extname)
    378 {
    379     p_pmHDU *hdu = psAlloc(sizeof(p_pmHDU));
    380     psMemSetDeallocator(hdu, (psFreeFunc)p_pmHDUFree);
    381 
    382     hdu->extname = psStringCopy(extname);
    383     hdu->header = NULL;
    384     hdu->images = NULL;
    385     hdu->masks = NULL;
    386     hdu->weights = NULL;
     365pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
     366                   )
     367{
     368    return fpa->hdu;
     369}
     370
     371pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
     372                    )
     373{
     374    pmHDU *hdu = chip->hdu;             // The HDU information
     375    if (!hdu) {
     376        hdu = pmHDUFromFPA(chip->parent); // Grab HDU info from the FPA
     377    }
     378
     379    return hdu;
     380}
     381
     382pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
     383                    )
     384{
     385    pmHDU *hdu = cell->hdu;             // The HDU information
     386    if (!hdu) {
     387        hdu = pmHDUFromChip(cell->parent); // Grab HDU info from the chip
     388    }
    387389
    388390    return hdu;
     
    599601}
    600602
    601 
     603#if 0
    602604bool pmCellSetWeights(pmCell *cell // Cell for which to set weights
    603605                     )
     
    609611    float bad = psMetadataLookupF32(NULL, cell->concepts, "CELL.BAD"); // Bad level
    610612
    611     p_pmHDU *hdu = cell->hdu;           // The data unit, containing the weight and mask originals
     613    pmHDU *hdu = cell->hdu;             // The data unit, containing the weight and mask originals
    612614    if (!hdu) {
    613615        pmChip *chip = cell->parent;    // The parent chip
     
    682684}
    683685
    684 
     686#endif
  • branches/rel10_ifa/psModules/src/astrom/pmFPA.h

    r6518 r6552  
    77*  @author GLG, MHPCC
    88*
    9 *  @version $Revision: 1.1.4.2 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-03-04 03:03:28 $
     9*  @version $Revision: 1.1.4.3 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-03-09 03:08:08 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <config.h>
    1919#endif
     20
    2021#include "pslib.h"
    21 #include "psDB.h"
     22#include "pmHDU.h"
    2223
    2324/// @addtogroup AstroImage
    2425/// @{
    25 
    2626
    2727/** Focal plane data structure
     
    4343typedef struct
    4444{
     45    #if 0
    4546    // Astrometric transformations
    4647    psPlaneDistort* fromTangentPlane;   ///< Transformation from tangent plane to focal plane
    4748    psPlaneDistort* toTangentPlane;     ///< Transformation from focal plane to tangent plane
    4849    psProjection *projection;           ///< Projection from tangent plane to sky
     50    #endif
    4951    // Information
    5052    psMetadata *concepts;               ///< Cache for PS concepts
     
    7274typedef struct
    7375{
     76    #if 0
    7477    // Offset specifying position on focal plane
    7578    int col0;                           ///< Offset from the left of FPA.
     
    7881    psPlaneTransform* toFPA;            ///< Transformation from chip to FPA coordinates
    7982    psPlaneTransform* fromFPA;          ///< Transformation from FPA to chip coordinates
     83    #endif
    8084    // Information
    8185    psMetadata *concepts;               ///< Cache for PS concepts
     
    100104typedef struct
    101105{
    102     // Offset specifying position on chip
    103     int col0;                           ///< Offset from the left of chip.
    104     int row0;                           ///< Offset from the bottom of chip.
    105     // Astrometric transformations
    106     psPlaneTransform* toChip;           ///< Transformations from cell to chip coordinates
    107     psPlaneTransform* toFPA;            ///< Transformations from cell to FPA coordinates
    108     psPlaneTransform* toSky;            ///< Transformations from cell to sky coordinates
    109     // Information
    110106    psMetadata *concepts;               ///< Cache for PS concepts
    111     psMetadata *camera;                 ///< Camera Info
     107    psMetadata *config;                 ///< Cell configuration info
    112108    psMetadata *analysis;               ///< Cell-level analysis metadata
    113109    psArray *readouts;                  ///< The readouts (referred to by number)
     
    168164pmCell *pmCellAlloc(
    169165    pmChip *chip,       ///< Parent chip
    170     psMetadata *cameraData, ///< Camera data
    171166    const char *name    ///< Name of cell
    172167);
     
    199194);
    200195
    201 /** Allocates a p_pmHDU
    202  *
    203  * XXX: More detailed description
    204  *
    205  * @return p_pmHDU*    newly allocated p_pmHDU
    206  */
    207 p_pmHDU *p_pmHDUAlloc(const char *extname // Extension name
    208                      );
    209 
     196// Find the HDU in the FPA hierarchy
     197pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
     198                   );
     199pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
     200                    );
     201pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
     202                    );
    210203
    211204/** Verify parent links.
  • branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c

    r6448 r6552  
    1111//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1212
    13 // Read data for a particular cell from the camera configuration
    14 static psMetadata *getCellData(const psMetadata *camera, // The camera configuration
     13// Read data for a particular cell from the camera format description
     14static psMetadata *getCellData(const psMetadata *format, // The camera format description
    1515                               const char *cellName // The name of the cell
    1616                              )
    1717{
    1818    bool status = true;                 // Result of MD lookup
    19     psMetadata *cells = psMetadataLookupMD(&status, camera, "CELLS"); // The CELLS
     19    psMetadata *cells = psMetadataLookupMD(&status, format, "CELLS"); // The CELLS
    2020    if (! status) {
    2121        psError(PS_ERR_IO, false, "Unable to determine CELLS of camera.\n");
     
    2828    }
    2929
    30     #if 0
    31     // Need to create a new instance, so that each cell can work with its own
    32     psMetadata *copy = psMetadataAlloc();
    33     psMetadataIterator *iter = psMetadataIteratorAlloc(cellData, PS_LIST_HEAD, NULL); // Iterator
    34     psMetadataItem *item = NULL;        // Item from iteration
    35     while (item = psMetadataGetAndIncrement(iter)) {
    36         if (item->type == PS_DATA_METADATA_MULTI || item->type == PS_DATA_METADATA) {
    37             psLogMsg(__func__, PS_LOG_WARN, "PS_DATA_METADATA_MULTI and PS_DATA_METADATA are not supported "
    38                      "in a cell definition --- %s ignored.\n", item->name);
     30    return cellData;
     31}
     32
     33// Find a chip by name
     34static pmChip *findChip(pmFPA *fpa, // FPA in which to find the chip
     35                        const char *name // Name of the chip
     36                       )
     37{
     38    psArray *chips = fpa->chips;    // Array of chips
     39    for (int i = 0; i < chips->n; i++) {
     40        pmChip *chip = chips->data[i]; // The chip of interest
     41        psString testName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of this chip
     42        if (strcmp(name, testName) == 0) {
     43            return chip;
     44        }
     45    }
     46
     47    psError(PS_ERR_IO, true, "Unable to find chip %s\n", name);
     48    return NULL;
     49}
     50
     51// Find a cell by name
     52static pmCell *findCell(pmChip *chip, // Chip in which to find the cell
     53                        const char *name // Name of the cell
     54                       )
     55{
     56    psArray *cells = chip->cells;    // Array of cells
     57    for (int i = 0; i < cells->n; i++) {
     58        pmCell *cell = cells->data[i]; // The cell of interest
     59        psString testName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of this cell
     60        if (strcmp(name, testName) == 0) {
     61            return cell;
     62        }
     63    }
     64
     65    psError(PS_ERR_IO, true, "Unable to find cell %s\n", name);
     66    return NULL;
     67}
     68
     69// Parse a list of first:second pairs in a string
     70static bool parsePairs(psArray **first, // Array of the first values
     71                       psArray **second, // Array of the second values
     72                       const char *string // The string to parse
     73                      )
     74{
     75    bool allOK = true;                  // Everything was OK?
     76    psList *pairs = psStringSplit(string, " ,;"); // List of the pairs
     77    *first = psArrayAlloc(pairs->n);
     78    *second = psArrayAlloc(pairs->n);
     79    int num = 0;
     80    psListIterator *pairsIter = psListIteratorAlloc(pairs, PS_LIST_HEAD, false); // Iterator for pairs
     81    psString pair = NULL;               // "first:second" pair string
     82    while ((pair = psListGetAndIncrement(pairsIter))) {
     83        psList *firstSecond = psStringSplit(pair, ":"); // List containing the first and second
     84        if (firstSecond->n != 2) {
     85            psLogMsg(__func__, PS_LOG_WARN, "Badly formated first:second pair: %s --- ignored.\n", pair);
     86            allOK = false;
    3987            continue;
    4088        }
    41         if (! psMetadataAdd(copy, PS_LIST_TAIL, item->name, item->type, item->comment, item->data.V)) {
    42             psAbort(__func__, "Should never reach here!\n");
    43         }
    44     }
    45     psFree(iter);
    46 
    47     return copy;
    48     #else
    49 
    50     return cellData;
    51     #endif
    52 
    53 }
    54 
     89        psString firstBit = psListGet(firstSecond, PS_LIST_HEAD); // The first bit
     90        psString secondBit = psListGet(firstSecond, PS_LIST_TAIL); // The second bit
     91        psArraySet(*first, num, firstBit);
     92        psArraySet(*second, num, secondBit);
     93        num++;
     94        psFree(firstSecond);
     95    }
     96    psFree(pairsIter);
     97    psFree(pairs);
     98
     99    return allOK;
     100}
     101
     102// Get the chip name from a primary header lookup
     103static psString chipNameFromHeader(const psMetadata *format, // FORMAT within the camera format description
     104                                   const psMetadata *header // Primary header
     105                                  )
     106{
     107    bool mdok = true;                   // Result of MD lookup
     108    psString chipNameHeader = psMetadataLookupStr(&mdok, format, "CHIP.NAME");
     109    if (!mdok || strlen(chipNameHeader) == 0) {
     110        psError(PS_ERR_IO, false, "Unable to find CHIP.NAME in the FORMAT.\n");
     111        return false;
     112    }
     113    psString chipName = psMetadataLookupStr(&mdok, header, chipNameHeader);
     114    if (!chipName || strlen(chipName) == 0) {
     115        psError(PS_ERR_IO, false, "Unable to find %s in primary header to identify chip name.\n", chipName);
     116        return NULL;
     117    }
     118
     119    return chipName;
     120}
    55121
    56122//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    58124//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    59125
     126// Construct an FPA instance on the basis of a camera configuration
     127pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
     128                     )
     129{
     130    pmFPA *fpa = pmFPAAlloc(camera);    // The FPA to fill out
     131
     132    bool mdok = true;                   // Status from MD lookups
     133    psMetadata *components = psMetadataLookupMD(&mdok, camera, "FPA"); // FPA components
     134    psMetadataIterator *componentsIter = psMetadataIteratorAlloc(components, PS_LIST_HEAD, NULL);
     135    psMetadataItem *componentsItem = NULL; // Item from components
     136    while ((componentsItem = psMetadataGetAndIncrement(componentsIter))) {
     137        const char *chipName = componentsItem->name; // Name of the chip
     138        if (componentsItem->type != PS_DATA_STRING) {
     139            psLogMsg(__func__, PS_LOG_WARN, "Element %s in FPA within the camera configuration is not of "
     140                     "type STR (type=%x) --- ignored.\n", chipName, componentsItem->type);
     141            continue;
     142        }
     143        pmChip *chip = pmChipAlloc(fpa, chipName); // The chip
     144        psList *cellNames = psStringSplit(componentsItem->data.V, " ,;"); // List of cell names
     145        psListIterator *cellNamesIter = psListIteratorAlloc(cellNames, PS_LIST_HEAD, false); // Iterator
     146        psString cellName = NULL;       // Name of cell
     147        while ((cellName = psListGetAndIncrement(cellNamesIter))) {
     148            pmCell *cell = pmCellAlloc(chip, cellName); // New cell
     149            psFree(cell);               // Drop reference
     150        }
     151        psFree(chip);                   // Drop reference
     152        psFree(cellNamesIter);
     153    }
     154    psFree(componentsIter);
     155
     156    return fpa;
     157}
     158
     159
     160// Add an input file to the FPA
     161bool pmFPAAddSource(pmFPA *fpa,         // FPA to which to add
     162                    pmChip *chip,       // Chip to which to add, or NULL
     163                    pmCell *cell,       // Cell to which to add, or NULL
     164                    psMetadata *phu,    // Primary header of file
     165                    const psMetadata *format // Format of file
     166                   )
     167{
     168    // Just in case someone's playing silly billy...
     169    if (cell && !chip) {
     170        chip = cell->parent;
     171    }
     172    if (chip && !fpa) {
     173        fpa = chip->parent;
     174    }
     175
     176    bool mdok = true;                   // Status from metadata lookups
     177    psMetadata *formatSpec = psMetadataLookupMD(&mdok, format, "FORMAT"); // The format specification
     178    if (!mdok || !formatSpec) {
     179        psError(PS_ERR_IO, false, "Unable to find FORMAT in the camera format configuration.\n");
     180        return false;
     181    }
     182
     183    // Where does the PHU go?
     184    const char *phuType = psMetadataLookupStr(&mdok, formatSpec, "PHU"); // What is the PHU?
     185    if (!mdok || strlen(phuType) == 0) {
     186        psError(PS_ERR_IO, false, "Unable to find PHU in the format specification.\n");
     187        return false;
     188    }
     189    pmHDU *phdu = pmHDUAlloc("PHU");    // The primary header data unit
     190    phdu->header = psMemIncrRefCounter(phu);
     191    if (fpa && !fpa->hdu && strcasecmp(phuType, "FPA") == 0) {
     192        fpa->hdu = phdu;
     193    } else if (chip && !chip->hdu && strcasecmp(phuType, "CHIP") == 0) {
     194        chip->hdu = phdu;
     195    } else if (cell && !cell->hdu && strcasecmp(phuType, "CELL") == 0) {
     196        // cell->hdu = phdu;
     197        psError(PS_ERR_IO, true, "The case of PHU == CELL has not been written yet!\n");
     198        return false;
     199    }
     200
     201    // And the individual extensions?
     202    const char *extType = psMetadataLookupStr(&mdok, formatSpec, "EXTENSIONS"); // What's in the extns?
     203    if (!mdok || strlen(extType) == 0) {
     204        psError(PS_ERR_IO, false, "Unable to find EXTENSIONS in the format specification.\n");
     205        return false;
     206    }
     207    psMetadata *contents = psMetadataLookupMD(&mdok, format, "CONTENTS"); // The contents of the FITS file
     208    if (!mdok || !contents) {
     209        psError(PS_ERR_IO, false, "Unable to find CONTENTS in the camera format configuration.\n");
     210        return false;
     211    }
     212
     213    if (strcasecmp(extType, "NONE") == 0) {
     214        // No extensions --- it's all in the PHU
     215        psString chipType = chipNameFromHeader(formatSpec, phu); // Type of chip
     216        psString content = psMetadataLookupStr(&mdok, contents, chipType); // The content line
     217
     218        // Parse the list of first:second
     219        psArray *names = NULL;          // The first bits
     220        psArray *values = NULL;         // The second bits
     221        parsePairs(&names, &values, content);
     222        for (int i = 0; i < names->n; i++) {
     223            psString chipName = names->data[i]; // The name of the chip
     224            psString cellName = values->data[i]; // The name of the cell
     225            pmChip *chip = findChip(fpa, chipName); // The chip we're looking for
     226            pmCell *cell = findCell(chip, cellName); // The cell we're looking for
     227            psMetadata *cellData = getCellData(format, cellName); // Data for this cell
     228            if (! cellData) {
     229                psLogMsg(__func__, PS_LOG_WARN, "Unable to find data for %s in CELLS --- ignored.\n",
     230                         cellName);
     231                continue;
     232            }
     233
     234            // Have already plugged in the PHU
     235
     236            // Put in the cell data
     237            if (cell->config) {
     238                psLogMsg(__func__, PS_LOG_WARN, "Overwriting cell data in chip %s, cell %s\n", chipName,
     239                         cellName);
     240                psFree(cell->config); // Make way!
     241            }
     242            cell->config = psMemIncrRefCounter(cellData);
     243        }
     244    }
     245
     246
     247    // Go through the contents
     248    psMetadataIterator *contentsIter = psMetadataIteratorAlloc(contents, PS_LIST_HEAD, NULL);
     249    psMetadataItem *contentsItem = NULL; // Item from contents
     250    while ((contentsItem = psMetadataGetAndIncrement(contentsIter))) {
     251        const char *extName = contentsItem->name;
     252        if (contentsItem->type != PS_DATA_STRING) {
     253            psLogMsg(__func__, PS_LOG_WARN, "CONTENTS item %s is not of type STR --- ignored.\n", extName);
     254            continue;
     255        }
     256
     257        pmHDU *hdu = pmHDUAlloc(extName); // The extension
     258
     259        // Parse the list of first:second
     260        psArray *names = NULL;          // The first bits
     261        psArray *values = NULL;         // The second bits
     262        parsePairs(&names, &values, contentsItem->data.V);
     263
     264        // XXX Memory problems in here --> leaks and/or double frees???
     265        if (strcasecmp(extType, "CHIP") == 0) {
     266            // Extensions are chips
     267            for (int i = 0; i < names->n; i++) {
     268                psString chipName = names->data[i]; // The name of the chip
     269                psString cellName = values->data[i]; // The name of the cell
     270                pmChip *chip = findChip(fpa, chipName); // The chip we're looking for
     271                pmCell *cell = findCell(chip, cellName); // The cell we're looking for
     272                psMetadata *cellData = getCellData(format, cellName); // Data for this cell
     273                if (! cellData) {
     274                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find data for %s in CELLS --- ignored.\n",
     275                             cellName);
     276                    continue;
     277                }
     278
     279                // Put in the extension
     280                if (chip->hdu) {
     281                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s\n", chipName);
     282                    psFree(chip->hdu);  // Make way!
     283                }
     284                chip->hdu = psMemIncrRefCounter(hdu);
     285
     286                // Put in the cell data
     287                if (cell->config) {
     288                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting cell data in chip %s, cell %s\n", chipName,
     289                             cellName);
     290                    psFree(cell->config); // Make way!
     291                }
     292                cell->config = psMemIncrRefCounter(cellData);
     293            }
     294
     295        } else if (strcasecmp(extType, "CELL") == 0) {
     296            // Extensions are cells
     297            psString chipName = NULL;   // Name of chip under consideration
     298            pmChip *chip = NULL;        // The chip we're looking for
     299            if (! fpa->hdu->phu) {
     300                // Need to look up the name of the chip
     301                chipName = chipNameFromHeader(formatSpec, phu);
     302                chip = findChip(fpa, chipName);
     303            }
     304            for (int i = 0; i < names->n; i++) {
     305                psString cellType = values->data[i]; // The type of the cell
     306                psString cellName = NULL; // The name of the cell
     307                if (fpa->hdu->phu) {
     308                    // We've got chipName:cellType with cellType == cellName
     309                    chipName = names->data[i];
     310                    cellName = cellType;
     311                    chip = findChip(fpa, chipName);
     312                } else {
     313                    // We've got cellName:cellType and the chipName comes from before
     314                    cellName = names->data[i];
     315                }
     316                psMetadata *cellData = getCellData(format, cellType); // Data for this cell
     317                pmCell *cell = findCell(chip, cellName); // The cell we're looking for
     318
     319                // Put in the extension
     320                if (cell->hdu) {
     321                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s, cell %s\n", chipName,
     322                             cellName);
     323                    psFree(cell->hdu);
     324                }
     325                cell->hdu = psMemIncrRefCounter(hdu);
     326
     327                // Put in the cell data
     328                if (cell->config) {
     329                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting cell data in chip %s, cell %s\n", chipName,
     330                             cellName);
     331                    psFree(cell->config);
     332                }
     333                cell->config = psMemIncrRefCounter(cellData);
     334            }
     335
     336        }
     337        psFree(hdu);
     338        psFree(names);
     339        psFree(values);
     340    }
     341    psFree(contentsIter);
     342
     343    return true;
     344}
     345
     346
     347
     348
     349#if 0
    60350pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
    61351                     )
     
    270560    return fpa;
    271561}
     562#endif
     563
    272564
    273565// Print out the focal plane structure
    274 void pmFPAPrint(pmFPA *fpa              // FPA to print
     566void pmFPAPrint(pmFPA *fpa,             // FPA to print
     567                bool concepts           // Print concepts?
    275568               )
    276569{
     
    279572        psTrace(__func__, 2, "---> FPA is extension %s.\n", fpa->hdu->extname);
    280573        if (! fpa->hdu->images) {
    281             psTrace(__func__, 2, "---> NO PIXELS for extension %s\n", fpa->hdu->extname);
    282         }
    283     }
    284     psMetadataPrint(fpa->concepts, 2);
     574            psTrace(__func__, 2, "---> NO PIXELS read in for extension %s\n", fpa->hdu->extname);
     575        }
     576    }
     577    if (concepts) {
     578        psMetadataPrint(fpa->concepts, 2);
     579    }
    285580
    286581    psArray *chips = fpa->chips;        // Array of chips
     
    292587            psTrace(__func__, 4, "---> Chip is extension %s.\n", chip->hdu->extname);
    293588            if (! chip->hdu->images) {
    294                 psTrace(__func__, 4, "---> NO PIXELS for extension %s\n", chip->hdu->extname);
    295             }
    296         }
    297         psMetadataPrint(chip->concepts, 4);
     589                psTrace(__func__, 4, "---> NO PIXELS read in for extension %s\n", chip->hdu->extname);
     590            }
     591        }
     592        if (concepts) {
     593            psMetadataPrint(chip->concepts, 4);
     594        }
    298595
    299596        // Iterate over the chip
     
    305602                psTrace(__func__, 6, "---> Cell is extension %s.\n", cell->hdu->extname);
    306603                if (! cell->hdu->images) {
    307                     psTrace(__func__, 6, "---> NO PIXELS for extension %s\n", cell->hdu->extname);
    308                 }
    309             }
    310             psMetadataPrint(cell->concepts, 6);
     604                    psTrace(__func__, 6, "---> NO PIXELS read in for extension %s\n", cell->hdu->extname);
     605                }
     606            }
     607            if (concepts) {
     608                psMetadataPrint(cell->concepts, 6);
     609            }
    311610
    312611            psTrace(__func__, 7, "Readouts:\n");
  • branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.h

    r6448 r6552  
    55#include "pmFPA.h"
    66
    7 // Read the contents of a FITS file (format specified by the camera configuration) into memory
     7// Construct an FPA instance on the basis of a camera configuration
    88pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
    99                     );
    1010
     11// Add an input file to the FPA
     12bool pmFPAAddSource(pmFPA *fpa,         // FPA to which to add
     13                    pmChip *chip,       // Chip to which to add, or NULL
     14                    pmCell *cell,       // Cell to which to add, or NULL
     15                    psMetadata *phu,    // Primary header of file
     16                    const psMetadata *format // Format of file
     17                   );
     18
    1119// Print out the FPA
    12 void pmFPAPrint(pmFPA *fpa              // FPA to print
     20void pmFPAPrint(pmFPA *fpa,             // FPA to print
     21                bool concepts           // Print concepts?
    1322               );
    1423
  • branches/rel10_ifa/psModules/src/astrom/pmFPARead.c

    r6520 r6552  
    1212//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1313
    14 
     14#if 0
    1515// Read a FITS extension into a chip
    1616static bool readExtension(p_pmHDU *hdu, // Pixel data into which to read
     
    135135    return true;
    136136}
    137 
    138 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    139 // Public functions
    140 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    141 
    142 
    143 bool pmReadoutRead(pmReadout *readout,  // Readout to read into
    144                    psFits *fits         // FITS file from which to read
    145                   )
    146 {
    147     //
    148 
    149 }
     137#endif
     138
    150139
    151140// Carve a readout from the image pixels
     
    162151
    163152    // Get the list of overscans
    164     psListIterator *iter = psListIteratorAlloc(biassecs, PS_LIST_HEAD, false); // Iterator
     153    psListIterator *iter = psListIteratorAlloc((psList*)biassecs, PS_LIST_HEAD, false); // Iterator
    165154    psRegion *biassec = NULL;       // A BIASSEC region from the list
    166155    while ((biassec = psListGetAndIncrement(iter))) {
     
    174163}
    175164
    176 
     165//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     166// Public functions
     167//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     168
     169
     170#if 0
     171bool pmReadoutRead(pmReadout *readout,  // Readout to read into
     172                   psFits *fits         // FITS file from which to read
     173                  )
     174{
     175    // This is very very different
     176}
     177#endif
     178
     179// Read in the cell, and allocate the readouts
    177180bool pmCellRead(pmCell *cell,           // Cell to read into
    178181                psFits *fits,           // FITS file from which to read
     
    185188        return false;
    186189    }
    187 
    188     // Read the "concepts"
    189     pmConceptsReadCell(cell, db);
    190190
    191191    // Having read the cell, we now have to cut it up
     
    205205}
    206206
    207 
     207// Read in the component cells
    208208bool pmChipRead(pmChip *chip,           // Chip to read into
    209209                psFits *fits,           // FITS file from which to read
     
    223223}
    224224
     225// Read in the component chips
    225226bool pmFPARead(pmFPA *fpa,              // FPA to read into
    226227               psFits *fits,            // FITS file from which to read
     
    228229              )
    229230{
    230     psArray *chips = fpa->cells;       // Array of cells
     231    psArray *chips = fpa->chips;       // Array of chips
    231232    for (int i = 0; i < chips->n; i++) {
    232         pmCell *chip = chips->data[i];  // The cell of interest
     233        pmChip *chip = chips->data[i];  // The cell of interest
    233234        if (!pmChipRead(chip, fits, db)) {
    234235            psError(PS_ERR_IO, false, "Unable to read chip %d.\n", i);
     
    239240    return true;
    240241}
     242
     243// Read the PHU into the nominated HDU
     244static bool readPHU(pmHDU *hdu,         // HDU to read into
     245                    psFits *fits        // FITS file from which to read
     246                   )
     247{
     248    if (! hdu || ! hdu->phu) {
     249        return false;                   // Nothing to see here, move along
     250    }
     251    if (hdu->header) {
     252        return true;                    // Already something to see here, no need to gawk at it...  (;
     253    }
     254    // Read the PHU
     255    psFitsMoveExtNum(fits, 0, false);
     256    hdu->header = psFitsReadHeader(hdu->header, fits);
     257    return true;
     258}
     259
     260// Read the PHU into a cell
     261bool pmCellReadPHU(pmCell *cell,        // Cell to read into
     262                   psFits *fits         // FITS file from which to read
     263                  )
     264{
     265    return readPHU(cell->hdu, fits) || readPHU(cell->parent->hdu, fits) ||
     266           readPHU(cell->parent->parent->hdu, fits);
     267
     268}
     269
     270// Read the PHU into a chip
     271bool pmChipReadPHU(pmChip *chip,        // Chip to read into
     272                   psFits *fits         // FITS file from which to read
     273                  )
     274{
     275    return readPHU(chip->hdu, fits) || readPHU(chip->parent->hdu, fits);
     276}
     277
     278// Read the PHU into an FPA
     279bool pmFPAReadPHU(pmFPA *fpa,           // FPA to read into
     280                  psFits *fits          // FITS file from which to read
     281                 )
     282{
     283    return readPHU(fpa->hdu, fits);
     284}
     285
     286
     287
    241288
    242289#if 0
  • branches/rel10_ifa/psModules/src/astrom/pmFPARead.h

    r6448 r6552  
    55#include "pmFPA.h"
    66
     7
     8bool pmCellRead(pmCell *cell,           // Cell to read into
     9                psFits *fits,           // FITS file from which to read
     10                psDB *db                // Database handle, for "concepts" ingest
     11               );
     12
     13bool pmChipRead(pmChip *chip,           // Chip to read into
     14                psFits *fits,           // FITS file from which to read
     15                psDB *db                // Database handle, for "concepts" ingest
     16               );
     17
     18bool pmFPARead(pmFPA *fpa,              // FPA to read into
     19               psFits *fits,            // FITS file from which to read
     20               psDB *db                 // Database handle, for "concepts" ingest
     21              );
     22
     23bool pmCellReadPHU(pmCell *cell,        // Cell to read into
     24                   psFits *fits         // FITS file from which to read
     25                  );
     26
     27bool pmChipReadPHU(pmChip *chip,        // Chip to read into
     28                   psFits *fits         // FITS file from which to read
     29                  );
     30
     31bool pmFPAReadPHU(pmFPA *fpa,           // FPA to read into
     32                  psFits *fits          // FITS file from which to read
     33                 );
     34
     35
     36#if 0
    737bool pmFPARead(pmFPA *fpa,              // FPA to read into
    838               psFits *fits,            // FITS file from which to read
     
    2757                     psFits *source     // Source FITS file (for the original data)
    2858                    );
    29 
     59#endif
    3060
    3161#endif
  • branches/rel10_ifa/psModules/src/astrom/pmFPAWrite.c

    r6448 r6552  
    88
    99static bool writeHDU(psFits *fits,      // FITS file to which to write
    10                      p_pmHDU *hdu       // Pixel data to write
     10                     pmHDU *hdu         // Pixel data to write
    1111                    )
    1212{
  • branches/rel10_ifa/psModules/src/astrom/pmHDU.c

    r6519 r6552  
    99{
    1010    psFree(hdu->extname);
     11    psFree(hdu->format);
    1112    psFree(hdu->header);
    1213    psFree(hdu->images);
     
    3233        hdu->extname = psStringCopy(extname);
    3334    }
     35    hdu->format = NULL;
    3436    hdu->header = NULL;
    3537    hdu->images = NULL;
    3638    hdu->table  = NULL;
    3739
    38     return file;
     40    return hdu;
    3941}
    4042
     
    5456            return false;
    5557        }
    56     } else if (! psFitsMoveExtName(fits, hdu->extname)) {
    57         psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
     58        hdu->phu = true;
     59    } else {
     60        if (! psFitsMoveExtName(fits, hdu->extname)) {
     61            psError(PS_ERR_IO, false, "Unable to move to extension %s\n", hdu->extname);
     62        }
     63        // Now, just in case for some reason the PHU has an extension name that we've moved to....
     64        if (psFitsGetExtNum(fits) == 0) {
     65            hdu->phu = true;
     66        } else {
     67            hdu->phu = false;
     68        }
    5869    }
    5970
     
    6374    }
    6475
     76    #ifdef FITS_TABLES
    6577    // What type is it?
    6678    if (psFitsIsImage(hdu->header)) {
     79        #endif
    6780        if (hdu->images) {
    6881            psFree(hdu->images);        // Blow away anything existing
     
    7083        hdu->images = psFitsReadImageCube(fits, psRegionSet(0,0,0,0));
    7184        return true;
     85        #ifdef FITS_TABLES
     86
    7287    }
    7388    if (psFitsIsTable(hdu->table)) {
     
    8297    psError(PS_ERR_UNKNOWN, true, "No idea what this HDU consists of!\n");
    8398    return false;
     99    #endif
    84100}
    85101
     
    99115    }
    100116
     117    #ifdef FITS_TABLES
    101118    if (hdu->images && (!hdu->table || psFitsIsImage(hdu->header))) {
     119        #endif
    102120        psFitsWriteImageCube(fits, hdu->header, hdu->images, hdu->extname);
    103121        return true;
     122        #ifdef FITS_TABLES
     123
    104124    }
    105125
     
    111131    psError(PS_ERR_IO, true, "No idea what this HDU consists of!\n");
    112132    return false;
    113 }
    114 
    115 
    116 pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
    117                    )
    118 {
    119     return fpa->hdu;
    120 }
    121 
    122 pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
    123                     )
    124 {
    125     pmHDU *hdu = chip->hdu;             // The HDU information
    126     if (!hdu) {
    127         hdu = pmHDUFromFPA(chip->parent); // Grab HDU info from the FPA
    128     }
    129 
    130     return hdu;
    131 }
    132 
    133 pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
    134                     )
    135 {
    136     pmHDU *hdu = cell->hdu;             // The HDU information
    137     if (!hdu) {
    138         hdu = pmHDUFromChip(cell->parent); // Grab HDU info from the chip
    139     }
    140 
    141     return hdu;
    142 }
    143 
     133    #endif
     134}
    144135
    145136
  • branches/rel10_ifa/psModules/src/astrom/pmHDU.h

    r6517 r6552  
    11#ifndef PM_HDU_H
    22#define PM_HDU_H
    3 
    4 #include "pslib.h"
    5 #include "pmFPA.h"
    63
    74// An instance of the FITS Header Data Unit
     
    107    psString extname;                   // The extension name
    118    bool phu;                           // Is this the FITS Primary Header Unit
     9    psMetadata *format;                 // The camera format
    1210    psMetadata *header;                 // The FITS header, or NULL if primary for FITS; or section info
    1311    psArray *images;                    // The pixel data
     
    2119
    2220// Read the HDU
    23 bool pmHDURead(pmHDU *hdu);
    24 
    25 
    26 // Find the HDU in the FPA hierarchy
    27 pmHDU *pmHDUFromFPA(pmFPA *fpa          // FPA for which to find HDU
    28                    );
    29 pmHDU *pmHDUFromChip(pmChip *chip       // Chip for which to find HDU
    30                     );
    31 pmHDU *pmHDUFromCell(pmCell *cell       // Cell for which to find HDU
    32                     );
     21bool pmHDURead(pmHDU *hdu,              // HDU to read
     22               psFits *fits             // FITS file to read from
     23              );
    3324
    3425#endif
Note: See TracChangeset for help on using the changeset viewer.