IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11229


Ignore:
Timestamp:
Jan 21, 2007, 3:13:00 PM (19 years ago)
Author:
magnier
Message:

allocate a readout if needed, use EXTDATA in header for CMF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO.c

    r10920 r11229  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-01-05 20:19:23 $
     5 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-01-22 01:13:00 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    396396bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config)
    397397{
    398     // determine the number of readouts:
    399     switch (file->type) {
    400     case PM_FPA_FILE_CMP: {
    401             pmReadout *readout;
    402             readout = pmReadoutAlloc (cell);
    403             psFree (readout);
    404             break;
    405         }
    406     default:
    407         psAbort ("pmSourceIO", "n readouts is not yet defined\n");
    408     }
     398    // multiple readout mode is not yet defined for CMP or CMF files
     399    // if they have not been allocated, allocate a single readout
     400    if (!cell->readouts || !cell->readouts->n) {
     401        pmReadout *readout = pmReadoutAlloc (cell);
     402        psFree (readout);
     403    }
     404
    409405    for (int i = 0; i < cell->readouts->n; i++) {
    410406        pmReadout *readout = cell->readouts->data[i];
     
    477473        }
    478474
    479         char *dataname = pmFPAfileNameFromRule (file->extrule, file, view);
    480         psFitsMoveExtName (file->fits, dataname);
     475        // we need to find the corresponding table EXTNAME.
     476        // first check the header
     477        char *dataname = psMetadataLookupStr (NULL, hdu->header, "EXTDATA");
     478        psMemIncrRefCounter (dataname); // so free below is safe
     479        if (!dataname) {
     480            // if it is not defined in the header, try the value in the filerule
     481            dataname = pmFPAfileNameFromRule (file->extrule, file, view);
     482            if (!dataname)
     483                psAbort ("pmSourceIO", "cannot determine data EXTNAME");
     484        }
     485        if (!psFitsMoveExtName (file->fits, dataname)) {
     486            psAbort ("pmSourceIO", "cannot find data extension %s in %s", dataname, file->filename);
     487        }
    481488        sources = pmSourcesReadCMF (file->fits, hdu->header);
    482489        psFree (dataname);
Note: See TracChangeset for help on using the changeset viewer.