IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 1, 2005, 2:21:14 PM (21 years ago)
Author:
Paul Price
Message:

Rough draft of pmFPAMorph working

File:
1 edited

Legend:

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

    r4594 r4694  
    8181            // Extensions are chips; Content contains a list of cells
    8282            while (contentItem = psMetadataGetAndIncrement(contentsIter)) {
    83                 const char *extName = contentItem->name; // The name of the extension
    84                 papChip *chip = papChipAlloc(fpa); // The chip
     83                psString extName = contentItem->name; // The name of the extension
     84                papChip *chip = papChipAlloc(fpa, extName); // The chip
    8585                chip->extname = extName;// Mark chip to receive FITS data
    8686                if (contentItem->type != PS_META_STR) {
     
    9797                while (cellName = psListGetAndIncrement(cellNamesIter)) {
    9898                    // Get the cell data
    99                     papCell *cell = papCellAlloc(chip); // The cell
     99                    papCell *cell = papCellAlloc(chip, cellName); // The cell
    100100                    psMetadata *cellData = getCellData(camera, cellName);
    101101                    metadataCopy(cell->values, cellData);
     
    109109            psMetadata *chips = psMetadataAlloc(); // Given a chip name, holds the chip number
    110110            while (contentItem = psMetadataGetAndIncrement(contentsIter)) {
    111                 const char *extName = contentItem->name; // The name of the extension
     111                psString extName = contentItem->name; // The name of the extension
    112112                psTrace(__func__, 1, "Getting %s....\n", extName);
    113113
     
    122122                    psLogMsg(__func__, PS_LOG_WARN, "Unable to read contents of %s: ignored.\n", extName);
    123123                } else {
    124                     const char *chipName = psListGet(contents, 0); // The name of the chip
    125                     const char *cellType = psListGet(contents, 1); // The type of cell
     124                    psString chipName = psListGet(contents, 0); // The name of the chip
     125                    psString cellType = psListGet(contents, 1); // The type of cell
    126126                    psTrace(__func__, 7, "Extension is cell of type %s, from chip %s\n", cellType,
    127127                            chipName);
     
    129129                    papChip *chip = psMetadataLookupChip(&mdStatus, chips, chipName); // The chip
    130130                    if (! mdStatus && ! chip) {
    131                         chip = papChipAlloc(fpa);
     131                        chip = papChipAlloc(fpa, chipName);
    132132                        psMetadataAdd(chips, PS_LIST_TAIL, chipName, PS_META_CHIP, "", chip);
    133133                    }
     
    135135                    psArray *images = NULL;
    136136                    psMetadata *header = NULL;
    137                     papCell *cell = papCellAlloc(chip); // The cell
     137                    papCell *cell = papCellAlloc(chip, extName); // The cell
    138138                    cell->extname = extName; // Mark cell to receive FITS data
    139139                    psMetadata *cellData = getCellData(camera, cellType);
     
    147147            fpa->extname = "PHU";
    148148            while (contentItem = psMetadataGetAndIncrement(contentsIter)) {
    149                 const char *chipName = contentItem->name; // The name of the chip
     149                psString chipName = contentItem->name; // The name of the chip
    150150
    151151                if (contentItem->type != PS_META_STR) {
     
    154154                    continue;
    155155                }
    156                 const char *content = contentItem->data.V; // The content of the extension
     156                psString content = contentItem->data.V; // The content of the extension
    157157                psTrace(__func__, 5, "Component cells are: %s\n", content);
    158                 papChip *chip = papChipAlloc(fpa); // The chip
     158                papChip *chip = papChipAlloc(fpa, chipName); // The chip
    159159                psList *cellNames = papSplit(content, ", "); // Split the list of cells
    160160                psListIterator *cellNamesIter = psListIteratorAlloc(cellNames, PS_LIST_HEAD, false);
     
    162162                while (cellName = psListGetAndIncrement(cellNamesIter)) {
    163163                    psTrace(__func__, 7, "Processing cell %s....\n", cellName);
    164                     papCell *cell = papCellAlloc(chip); // The cell
     164                    papCell *cell = papCellAlloc(chip, cellName); // The cell
    165165                    psMetadata *cellData = getCellData(camera, cellName);
    166166                    metadataCopy(cell->values, cellData);
     
    179179    } else if (strncmp(phuType, "CHIP", 4) == 0) {
    180180        // The FITS file contains a single chip only
    181         papChip *chip = papChipAlloc(fpa); // The chip
     181        psString chipName = psStringCopy("CHIP"); // Name for chip
     182        papChip *chip = papChipAlloc(fpa, chipName); // The chip
    182183
    183184        if (strncmp(extType, "NONE", 4) == 0) {
     
    193194            psList *cellNames = papSplit(contents, " ,"); // Names of cells
    194195            psListIterator *cellIter = psListIteratorAlloc(cellNames, PS_LIST_HEAD, false); // Iterator
    195             const char *cellName = NULL;
     196            psString cellName = NULL;
    196197            while (cellName = psListGetAndIncrement(cellIter)) {
    197                 papCell *cell = papCellAlloc(chip); // The cell
     198                papCell *cell = papCellAlloc(chip, cellName); // The cell
    198199                psMetadata *cellData = getCellData(camera, cellName);
    199200                metadataCopy(cell->values, cellData);
     
    219220            psMetadataItem *contentItem = NULL; // Item from metadata
    220221            while (contentItem = psMetadataGetAndIncrement(contentsIter)) {
    221                 const char *extName = contentItem->name; // The name of the extension
    222 
    223                 psMemCheckCorruption(true);
    224                
    225                 psTrace(__func__, 1, "Getting %s....\n", extName);
    226 
     222                psString extName = contentItem->name; // The name of the extension
    227223                // Content is a cell type
    228224                if (contentItem->type != PS_META_STR) {
     
    233229                }
    234230                const char *cellType = contentItem->data.V; // The type of cell
    235                 psTrace(__func__, 2, "Cell type is %s\n", cellType);
     231                psTrace(__func__, 5, "Cell type is %s\n", cellType);
    236232                psArray *images = NULL;
    237233                psMetadata *header = NULL;
    238                 papCell *cell = papCellAlloc(chip); // The cell
     234                papCell *cell = papCellAlloc(chip, extName); // The cell
    239235                cell->extname = extName; // Mark cell to receive FITS data
    240236                psMetadata *cellData = getCellData(camera, cellType);
     
    266262{
    267263    psTrace(__func__, 0, "FPA:\n");
    268     if (fpa->pixels) {
    269         psTrace(__func__, 1, "---> FPA contains pixels.\n");
     264    if (fpa->extname) {
     265        psTrace(__func__, 1, "---> FPA is extension %s.\n", fpa->extname);
     266        if (! fpa->pixels) {
     267            psTrace(__func__, 1, "---> NO PIXELS for extension %s\n", fpa->extname);
     268        }
    270269    }
    271270
     
    275274        psTrace(__func__, 1, "Chip: %d\n", i);
    276275        papChip *chip = chips->data[i]; // The chip
    277         if (chip->pixels) {
    278             psTrace(__func__, 2, "---> Chip contains pixels.\n");
     276        if (chip->extname) {
     277            psTrace(__func__, 2, "---> Chip is extension %s.\n", chip->extname);
     278            if (! chip->pixels) {
     279                psTrace(__func__, 2, "---> NO PIXELS for extension %s\n", chip->extname);
     280            }
    279281        }
    280282        // Iterate over the chip
     
    283285            psTrace(__func__, 2, "Cell: %d\n", j);
    284286            papCell *cell = cells->data[j]; // The cell
    285             if (cell->pixels) {
    286                 psTrace(__func__, 3, "---> Cell contains pixels.\n");
     287            if (cell->extname) {
     288                psTrace(__func__, 3, "---> Cell is extension %s.\n", cell->extname);
     289                if (! cell->pixels) {
     290                    psTrace(__func__, 3, "---> NO PIXELS for extension %s\n", cell->extname);
     291                }
    287292            }
    288293            psMetadataPrint(cell->values, 3);
     
    292297                papReadout *readout = readouts->data[k]; // The readout
    293298                psImage *image = readout->image; // The image
    294                 psTrace(__func__, 4, "Image: [%d:%d,%d:%d]\n", image->col0, image->col0 +
    295                         image->numCols, image->row0, image->row0 + image->numRows);
     299                psTrace(__func__, 4, "Image: [%d:%d,%d:%d] (%dx%d)\n", image->col0, image->col0 +
     300                        image->numCols, image->row0, image->row0 + image->numRows, image->numCols,
     301                        image->numRows);
    296302                psList *overscans = readout->overscans; // The list of overscans
    297303                psListIterator *overscansIter = psListIteratorAlloc(overscans, PS_LIST_HEAD, false);
    298304                while (image = psListGetAndIncrement(overscansIter)) {
    299                     psTrace(__func__, 4, "Overscan: [%d:%d,%d:%d]\n", image->col0, image->col0 +
    300                             image->numCols, image->row0, image->row0 + image->numRows);
     305                    psTrace(__func__, 4, "Overscan: [%d:%d,%d:%d] (%dx%d)\n", image->col0, image->col0 +
     306                            image->numCols, image->row0, image->row0 + image->numRows, image->numCols,
     307                            image->numRows);
    301308                }
    302309                psFree(overscansIter);
Note: See TracChangeset for help on using the changeset viewer.