IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 28, 2009, 2:33:51 PM (17 years ago)
Author:
Paul Price
Message:

Changing pmReadout.weight to variance. Adding pmReadout.covariance which will carry around a covariance pseudo-matrix, allowing us to calculate the pixel-to-pixel variance. pmReadout.covariance now exists and is set, but no mechanism yet to read/write, or use it.

File:
1 edited

Legend:

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

    r18227 r21211  
    274274        pmReadout *readout = cell->readouts->data[0]; // The first readout, as representative
    275275        // The proper image, used to get the size
    276         psImage *image = readout->image ? readout->image : (readout->mask ? readout->mask : readout->weight);
     276        psImage *image = readout->image ? readout->image : (readout->mask ? readout->mask : readout->variance);
    277277        if (!image) {
    278278            continue;
     
    283283                     image->numCols, image->numRows, readout->mask->numCols, readout->mask->numRows);
    284284        }
    285         if (readout->weight &&
    286                 (readout->weight->numCols != image->numCols || readout->weight->numRows != image->numRows)) {
    287             psWarning("Image and weight have different sizes (%dx%d vs %dx%d)!\n",
    288                      image->numCols, image->numRows, readout->weight->numCols, readout->weight->numRows);
     285        if (readout->variance &&
     286                (readout->variance->numCols != image->numCols || readout->variance->numRows != image->numRows)) {
     287            psWarning("Image and variance have different sizes (%dx%d vs %dx%d)!\n",
     288                     image->numCols, image->numRows, readout->variance->numCols, readout->variance->numRows);
    289289        }
    290290        // New reference
     
    355355    psElemType imageType = 0;           // Type of readout images
    356356    psElemType maskType = 0;            // Type of readout masks
    357     psElemType weightType = 0;          // Type of readout weights
     357    psElemType varianceType = 0;          // Type of readout variances
    358358    {
    359359        psListIterator *iter = psListIteratorAlloc(cells, PS_LIST_HEAD, false); // Iterator for cells
     
    381381                    maskType = checkTypes(maskType, readout->mask->type.type);
    382382                }
    383                 if (!hdu->weights && readout->weight) {
    384                     weightType = checkTypes(weightType, readout->weight->type.type);
     383                if (!hdu->variances && readout->variance) {
     384                    varianceType = checkTypes(varianceType, readout->variance->type.type);
    385385                }
    386386            }
     
    388388        psFree(iter);
    389389    }
    390     if (numReadouts == 0 || (imageType == 0 && maskType == 0 && weightType == 0)) {
     390    if (numReadouts == 0 || (imageType == 0 && maskType == 0 && varianceType == 0)) {
    391391        // Nothing from which to create an HDU
    392392        psFree(cells);
     
    421421        }
    422422    }
    423     if (weightType) {
    424         hdu->weights = psArrayAlloc(numReadouts);
     423    if (varianceType) {
     424        hdu->variances = psArrayAlloc(numReadouts);
    425425        for (int i = 0; i < numReadouts; i++) {
    426             psImage *weight = psImageAlloc(xSize, ySize, weightType);
    427             psImageInit(weight, 0.0);
    428             hdu->weights->data[i] = weight;
     426            psImage *variance = psImageAlloc(xSize, ySize, varianceType);
     427            psImageInit(variance, 0.0);
     428            hdu->variances->data[i] = variance;
    429429        }
    430430    }
     
    450450            psArray *hduImages = hdu->images; // Array of images in the HDU
    451451            psArray *hduMasks = hdu->masks; // Array of masks in the HDU
    452             psArray *hduWeights = hdu->weights; // Array of weights in the HDU
     452            psArray *hduVariances = hdu->variances; // Array of variances in the HDU
    453453            for (int i = 0; i < readouts->n; i++) {
    454454                pmReadout *readout = readouts->data[i]; // The readout of interest
     
    467467                    readout->mask = new;
    468468                }
    469                 if (readout->weight) {
    470                     psImage *new = pasteImage(hduWeights->data[i], readout->weight, trimsec);
    471                     psFree(readout->weight);
    472                     readout->weight = new;
     469                if (readout->variance) {
     470                    psImage *new = pasteImage(hduVariances->data[i], readout->variance, trimsec);
     471                    psFree(readout->variance);
     472                    readout->variance = new;
    473473                }
    474474
     
    581581        return false;
    582582    }
    583     if (hdu->images && hdu->masks && hdu->weights) {
     583    if (hdu->images && hdu->masks && hdu->variances) {
    584584        // It's already here!
    585585        return true;
     
    631631        return generateForCells(chip);
    632632    }
    633     if (hdu->images && hdu->masks && hdu->weights) {
     633    if (hdu->images && hdu->masks && hdu->variances) {
    634634        // It's already here!
    635635        return true;
     
    680680        return generateForChips(fpa);
    681681    }
    682     if (hdu->images && hdu->masks && hdu->weights) {
     682    if (hdu->images && hdu->masks && hdu->variances) {
    683683        // It's already here!
    684684        return true;
Note: See TracChangeset for help on using the changeset viewer.