IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 2, 2009, 8:05:38 AM (17 years ago)
Author:
Paul Price
Message:

Adding work on integrating covariances into the read/write system. Not sure I like this framework (putting covariances for an HDU into a common table); might rework to write a covariance image for each cell. I think I started doing that and ran into problems, but I can't remember what they were and how they stopped me.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_20090128/psModules/src/camera/pmFPARead.c

    r21211 r21264  
    2828    FPA_READ_TYPE_IMAGE,                // Read image
    2929    FPA_READ_TYPE_MASK,                 // Read mask
    30     FPA_READ_TYPE_VARIANCE,               // Read variance map
     30    FPA_READ_TYPE_VARIANCE,             // Read variance map
    3131    FPA_READ_TYPE_HEADER                // Read header
    3232} fpaReadType;
     
    515515    }
    516516
    517     // XXX for IMAGE, we need the CELL.BAD value, but for MASK, we need the BAD mask value
    518 
    519     float bad = 0;
    520     if (type == FPA_READ_TYPE_MASK) {
    521       bad = 1.0;
    522     } else {
    523       bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level
     517    // Need to set the invalid (unread) pixels appropriately, and to read the mask bits
     518    float bad = 0;                      // Bad level
     519    switch (type) {
     520      case FPA_READ_TYPE_MASK: {
     521          pmHDU *phu = pmHDUGetHighest(cell->parent->parent, cell->parent, cell); // Primary header
     522          if (!pmConfigMaskReadHeader(config, phu->header)) {
     523              psError(PS_ERR_IO, false, "Unable to determine mask bits");
     524              return false;
     525          }
     526          bad = pmConfigMaskGet("BAD", config);
     527          break;
     528      }
     529      case FPA_READ_TYPE_IMAGE:
     530      case FPA_READ_TYPE_VARIANCE:
     531        bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD");
     532        break;
     533      default:
     534        psAbort("Unrecognised type: %x", type);
    524535    }
    525536
     
    721732            return NULL;
    722733        }
     734
     735        if (type == FPA_READ_TYPE_VARIANCE && hdu->covariances) {
     736            psArray *covariances = hdu->covariances; // Covariances in HDU
     737            for (int i = 0; i < covariances->n; i++) {
     738                pmHDUCovariances *covar = covariances->data[i]; // Covariance information
     739
    723740        psFree(readout);                // Drop reference
    724741    }
     
    852869    float bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level
    853870    if (!mdok) {
    854         psLogMsg(__func__, PS_LOG_WARN, "CELL.BAD is not set --- assuming zero.\n");
     871        psWarning("CELL.BAD is not set --- assuming zero.\n");
    855872        bad = 0.0;
    856873    }
Note: See TracChangeset for help on using the changeset viewer.