IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 22, 2005, 4:54:52 PM (21 years ago)
Author:
Paul Price
Message:

Working under pslib-0.7.0, but don't have the inner loop behaving yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/scripts/src/phase2/pmFPAConstruct.c

    r4820 r5104  
    3030        psError(PS_ERR_IO, false, "Unable to find specs for cell %s: ignored\n", cellName);
    3131    }
     32
     33#if 0
     34    // Need to create a new instance, so that each cell can work with its own
     35    psMetadata *copy = psMetadataAlloc();
     36    psMetadataIterator *iter = psMetadataIteratorAlloc(cellData, PS_LIST_HEAD, NULL); // Iterator
     37    psMetadataItem *item = NULL;        // Item from iteration
     38    while (item = psMetadataGetAndIncrement(iter)) {
     39        if (item->type == PS_META_MULTI || item->type == PS_META_META) {
     40            psLogMsg(__func__, PS_LOG_WARN, "PS_META_MULTI and PS_META_META are not supported in a cell "
     41                     "definition --- %s ignored.\n", item->name);
     42            continue;
     43        }
     44        if (! psMetadataAdd(copy, PS_LIST_TAIL, item->name, item->type, item->comment, item->data.V)) {
     45            psAbort(__func__, "Should never reach here!\n");
     46        }
     47    }
     48    psFree(iter);
     49
     50    return copy;
     51#else
    3252    return cellData;
     53#endif
     54
    3355}
    3456
     
    3860//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    3961
    40 pmFPA *pmFPAConstruct(const psMetadata *camera, // The camera configuration
    41                       psDB *db          // Database handle
     62pmFPA *pmFPAConstruct(const psMetadata *camera // The camera configuration
    4263    )
    4364{
    44     pmFPA *fpa = pmFPAAlloc(camera, db); // The FPA to fill out
     65    pmFPA *fpa = pmFPAAlloc(camera); // The FPA to fill out
    4566    bool mdStatus = true;               // Status from metadata lookups
    4667    const char *phuType = psMetadataLookupString(&mdStatus, camera, "PHU"); // What is the PHU?
     
    6788                psString extName = contentItem->name; // The name of the extension
    6889                pmChip *chip = pmChipAlloc(fpa, extName); // The chip
    69                 chip->extname = extName;// Mark chip to receive FITS data
     90                chip->private = p_pmHDUAlloc(extName); // Prepare chip to receive FITS data
    7091                if (contentItem->type != PS_META_STR) {
    7192                    psLogMsg(__func__, PS_LOG_WARN, "Type of content item (%x) is not string: ignored\n",
     
    83104                    psMetadata *cellData = getCellData(camera, cellName);
    84105                    pmCell *cell = pmCellAlloc(chip, cellData, cellName); // The cell
     106//                  psFree(cellData);
    85107                }
    86108                psFree(cellNamesIter);
     
    102124                const char *content = contentItem->data.V; // The content of the extension
    103125                psList *contents = papSplit(content, ": "); // Split the name from the type
    104                 if (contents->size != 2) {
     126                if (contents->n != 2) {
    105127                    psLogMsg(__func__, PS_LOG_WARN, "Unable to read contents of %s: ignored.\n", extName);
    106128                } else {
     
    123145                    psMetadata *cellData = getCellData(camera, cellType);
    124146                    pmCell *cell = pmCellAlloc(chip, cellData, extName); // The cell
    125                     cell->extname = extName; // Mark cell to receive FITS data
     147//                  psFree(cellData);
     148                    cell->private = p_pmHDUAlloc(extName); // Prepare cell to receive FITS data
    126149
    127150                    psFree(chip);
    128151                    psFree(cell);
    129                     psFree(chipName);
    130                     psFree(cellType);
    131152                }
    132153                psFree(contents);
     
    136157        } else if (strcasecmp(extType, "NONE") == 0) {
    137158            // No extensions; Content contains metadata, each entry is a chip with its component cells
    138             fpa->extname = "PHU";
     159            fpa->private = p_pmHDUAlloc("PHU"); // Prepare FPA to receive FITS data
    139160            while (contentItem = psMetadataGetAndIncrement(contentsIter)) {
    140161                psString chipName = contentItem->name; // The name of the chip
     
    155176                    psMetadata *cellData = getCellData(camera, cellName);
    156177                    pmCell *cell = pmCellAlloc(chip, cellData, cellName); // The cell
     178//                  psFree(cellData);
    157179                }
    158180                psFree(cellNamesIter);
     
    174196        if (strcasecmp(extType, "NONE") == 0) {
    175197            // There are no extensions --- only the PHU
    176             chip->extname = "PHU";
     198            chip->private = p_pmHDUAlloc("PHU");
    177199
    178200            const char *contents = psMetadataLookupString(&mdStatus, camera, "CONTENTS");
     
    188210                psMetadata *cellData = getCellData(camera, cellName);
    189211                pmCell *cell = pmCellAlloc(chip, cellData, cellName); // The cell
     212//              psFree(cellData);
    190213            }
    191214            psFree(cellIter);
     
    223246                psMetadata *cellData = getCellData(camera, cellType);
    224247                pmCell *cell = pmCellAlloc(chip, cellData, extName); // The cell
    225                 cell->extname = extName; // Mark cell to receive FITS data
     248//              psFree(cellData);
     249                cell->private = p_pmHDUAlloc(extName); // Prepare cell to receive FITS data
    226250            } // Iterating through contents
    227251            psFree(contentsIter);
     
    249273{
    250274    psTrace(__func__, 0, "FPA:\n");
    251     if (fpa->extname) {
    252         psTrace(__func__, 1, "---> FPA is extension %s.\n", fpa->extname);
    253         if (! fpa->pixels) {
    254             psTrace(__func__, 1, "---> NO PIXELS for extension %s\n", fpa->extname);
     275    if (fpa->private) {
     276        psTrace(__func__, 1, "---> FPA is extension %s.\n", fpa->private->extname);
     277        if (! fpa->private->pixels) {
     278            psTrace(__func__, 1, "---> NO PIXELS for extension %s\n", fpa->private->extname);
    255279        }
    256280    }
     
    261285        psTrace(__func__, 1, "Chip: %d\n", i);
    262286        pmChip *chip = chips->data[i]; // The chip
    263         if (chip->extname) {
    264             psTrace(__func__, 2, "---> Chip is extension %s.\n", chip->extname);
    265             if (! chip->pixels) {
    266                 psTrace(__func__, 2, "---> NO PIXELS for extension %s\n", chip->extname);
     287        if (chip->private) {
     288            psTrace(__func__, 2, "---> Chip is extension %s.\n", chip->private->extname);
     289            if (! chip->private->pixels) {
     290                psTrace(__func__, 2, "---> NO PIXELS for extension %s\n", chip->private->extname);
    267291            }
    268292        }
     
    272296            psTrace(__func__, 2, "Cell: %d\n", j);
    273297            pmCell *cell = cells->data[j]; // The cell
    274             if (cell->extname) {
    275                 psTrace(__func__, 3, "---> Cell is extension %s.\n", cell->extname);
    276                 if (! cell->pixels) {
    277                     psTrace(__func__, 3, "---> NO PIXELS for extension %s\n", cell->extname);
    278                 }
    279             }
    280             psMetadataPrint(cell->values, 3);
     298            if (cell->private) {
     299                psTrace(__func__, 3, "---> Cell is extension %s.\n", cell->private->extname);
     300                if (! cell->private->pixels) {
     301                    psTrace(__func__, 3, "---> NO PIXELS for extension %s\n", cell->private->extname);
     302                }
     303            }
     304            psMetadataPrint(cell->concepts, 3);
    281305            psTrace(__func__, 3, "Readouts:\n");
    282306            psArray *readouts = cell->readouts; // Array of readouts
Note: See TracChangeset for help on using the changeset viewer.