IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 16, 2006, 3:47:44 PM (20 years ago)
Author:
Paul Price
Message:

PHU=NONE (i.e., megacam split) now working, with concept ingest; changed definition of pmFPAAddSource to return a pmFPAview

File:
1 edited

Legend:

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

    r6582 r6618  
    137137#endif
    138138
     139static bool badRegion(const psRegion *region)
     140{
     141    return isnan(region->x0) || isnan(region->x1) || isnan(region->y0) || isnan(region->y1);
     142}
    139143
    140144// Carve a readout from the image pixels
     
    148152
    149153    // The image corresponding to the trim region
     154    if (badRegion(trimsec)) {
     155        psString regionString = psRegionToString(*trimsec);
     156        psError(PS_ERR_IO, true, "Invalid trim section: %s\n", regionString);
     157        psFree(regionString);
     158        psFree(readout);
     159        return NULL;
     160    }
    150161    readout->image = psMemIncrRefCounter(psImageSubset(image, *trimsec));
    151162
     
    154165    psRegion *biassec = NULL;       // A BIASSEC region from the list
    155166    while ((biassec = psListGetAndIncrement(iter))) {
     167        if (badRegion(trimsec)) {
     168            psString regionString = psRegionToString(*biassec);
     169            psError(PS_ERR_IO, true, "Invalid bias section: %s\n", regionString);
     170            psFree(regionString);
     171            psFree(readout);
     172            return NULL;
     173        }
    156174        psImage *overscan = psMemIncrRefCounter(psImageSubset(image, *biassec));
    157175        psListAdd(readout->bias, PS_LIST_TAIL, overscan);
     
    192210    }
    193211
    194     pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, NULL);
     212    pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, false, NULL);
    195213
    196214    // Having read the cell, we now have to cut it up
     
    216234               )
    217235{
     236    bool success = false;               // Were we able to read at least one HDU?
    218237    psArray *cells = chip->cells;       // Array of cells
    219238    for (int i = 0; i < cells->n; i++) {
    220239        pmCell *cell = cells->data[i];  // The cell of interest
    221         if (!pmCellRead(cell, fits, db)) {
    222             psError(PS_ERR_IO, false, "Unable to read cell %d.\n", i);
    223             return false;
    224         }
    225         pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, NULL);
    226     }
    227 
    228     return true;
     240        success |= pmCellRead(cell, fits, db);
     241    }
     242    if (success) {
     243        pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, false, NULL);
     244    }
     245
     246    return success;
    229247}
    230248
     
    235253              )
    236254{
    237     psArray *chips = fpa->chips;       // Array of chips
     255    bool success = false;               // Were we able to read at least one HDU?
     256    psArray *chips = fpa->chips;        // Array of chips
    238257    for (int i = 0; i < chips->n; i++) {
    239258        pmChip *chip = chips->data[i];  // The cell of interest
    240         if (!pmChipRead(chip, fits, db)) {
    241             psError(PS_ERR_IO, false, "Unable to read chip %d.\n", i);
    242             return false;
    243         }
     259        success |= pmChipRead(chip, fits, db);
     260    }
     261    if (success) {
    244262        pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL);
    245     }
    246 
    247     return true;
     263    } else {
     264        psLogMsg(__func__, PS_LOG_WARN, "Unable to read any chips in FPA.\n");
     265    }
     266
     267    return success;
    248268}
    249269
Note: See TracChangeset for help on using the changeset viewer.