IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6589


Ignore:
Timestamp:
Mar 14, 2006, 5:30:54 PM (20 years ago)
Author:
Paul Price
Message:

Making camera construction a bit more solid (error checking).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c

    r6582 r6589  
    2424
    2525    psMetadata *cellData = psMetadataLookupMD(&status, cells, cellName); // The data for the particular cell
    26     if (! status) {
    27         psError(PS_ERR_IO, false, "Unable to find specs for cell %s: ignored\n", cellName);
     26    if (!status || !cellData) {
     27        psLogMsg(__func__, PS_LOG_WARN, "Unable to find specs for cell %s: ignored\n", cellName);
    2828    }
    2929
     
    244244            psString cellName = values->data[i]; // The name of the cell
    245245            pmChip *chip = findChip(fpa, chipName); // The chip we're looking for
     246            if (!chip) {
     247                psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in fpa --- ignored.\n", chipName);
     248                continue;
     249            }
    246250            pmCell *cell = findCell(chip, cellName); // The cell we're looking for
     251            if (!cell) {
     252                psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored.\n", cellName,
     253                         chipName);
     254                continue;
     255            }
    247256            psMetadata *cellData = getCellData(format, cellName); // Data for this cell
    248             if (! cellData) {
    249                 psLogMsg(__func__, PS_LOG_WARN, "Unable to find data for %s in CELLS --- ignored.\n",
    250                          cellName);
    251                 continue;
    252             }
    253257
    254258            // Have already plugged in the PHU
     
    263267            pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS, NULL);
    264268        }
     269        return true;
    265270    }
    266271
     
    291296                psString cellName = values->data[i]; // The name of the cell
    292297                pmChip *chip = findChip(fpa, chipName); // The chip we're looking for
     298                if (!chip) {
     299                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", chipName);
     300                    continue;
     301                }
    293302                pmCell *cell = findCell(chip, cellName); // The cell we're looking for
     303                if (!cell) {
     304                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored\n",
     305                             cellName, chipName);
     306                    continue;
     307                }
    294308                psMetadata *cellData = getCellData(format, cellName); // Data for this cell
    295                 if (! cellData) {
    296                     psLogMsg(__func__, PS_LOG_WARN, "Unable to find data for %s in CELLS --- ignored.\n",
    297                              cellName);
    298                     continue;
    299                 }
    300309
    301310                // Put in the extension
    302                 if (chip->hdu) {
     311                if (chip->hdu && chip->hdu != hdu) {
    303312                    psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s\n", chipName);
    304313                    psFree(chip->hdu);  // Make way!
     
    324333                chipName = chipNameFromHeader(formatSpec, phu);
    325334                chip = findChip(fpa, chipName);
     335                if (!chip) {
     336                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", chipName);
     337                    continue;
     338                }
    326339            }
    327340            for (int i = 0; i < names->n; i++) {
     
    333346                    cellName = cellType;
    334347                    chip = findChip(fpa, chipName);
     348                    if (! chip) {
     349                        psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n",
     350                                 chipName);
     351                        continue;
     352                    }
    335353                } else {
    336354                    // We've got cellName:cellType and the chipName comes from before
    337355                    cellName = names->data[i];
    338356                }
     357                pmCell *cell = findCell(chip, cellName); // The cell we're looking for
     358                if (!cell) {
     359                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored.\n",
     360                             cellName, chipName);
     361                    continue;
     362                }
    339363                psMetadata *cellData = getCellData(format, cellType); // Data for this cell
    340                 pmCell *cell = findCell(chip, cellName); // The cell we're looking for
    341364
    342365                // Put in the extension
Note: See TracChangeset for help on using the changeset viewer.