IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 4:31:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmShutterCorrection.c

    r21183 r21363  
    383383    psArray *images = psArrayAlloc(num);// Array of images
    384384    psArray *masks = NULL; // Array of masks
    385     psArray *weights = NULL; // Array of weights
     385    psArray *variances = NULL; // Array of variances
    386386    psVector *exptimes = psVectorAlloc(num, PS_TYPE_F32); // Vector of exposure times
    387387
     
    392392            masks = psArrayAlloc(num);
    393393        }
    394         if (readout->weight)
     394        if (readout->variance)
    395395        {
    396             weights = psArrayAlloc(num);
     396            variances = psArrayAlloc(num);
    397397        }
    398398    }
     
    472472        }
    473473
    474         psImage *weight = readout->weight; // Weight map of interest
    475         if (weight) {
    476             if (!weights) {
    477                 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Not all readouts have weights.\n");
     474        psImage *variance = readout->variance; // Variance map of interest
     475        if (variance) {
     476            if (!variances) {
     477                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Not all readouts have variances.\n");
    478478                goto MEASURE_ERROR;
    479479            }
    480             weights->data[i] = psMemIncrRefCounter(weight);
    481 
    482             if (weight->type.type != PS_TYPE_F32) {
    483                 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Bad type for weights: %x\n", weight->type.type);
     480            variances->data[i] = psMemIncrRefCounter(variance);
     481
     482            if (variance->type.type != PS_TYPE_F32) {
     483                psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Bad type for variances: %x\n", variance->type.type);
    484484                goto MEASURE_ERROR;
    485485            }
    486             if (weight->numRows != numRows || weight->numCols != numCols) {
     486            if (variance->numRows != numRows || variance->numCols != numCols) {
    487487                psError(PS_ERR_BAD_PARAMETER_SIZE, true,
    488                         "Weight sizes don't match: %dx%d vs %dx%d\n", weight->numCols, weight->numRows,
     488                        "Variance sizes don't match: %dx%d vs %dx%d\n", variance->numCols, variance->numRows,
    489489                        numCols, numRows);
    490490                goto MEASURE_ERROR;
    491491            }
    492         } else if (weights) {
    493             psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Not all readouts have weights.\n");
     492        } else if (variances) {
     493            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Not all readouts have variances.\n");
    494494            goto MEASURE_ERROR;
    495495        }
     
    566566    psTrace("psModules.detrend", 3, "Mean reference value: %f\n", meanRef);
    567567
    568     // Check the weights
    569     if (weights && nIter > 1) {
    570         for (int i = 0; i < weights->n && nIter > 1; i++) {
    571             psImage *weight = weights->data[i]; // Weight image
    572             if (!weight) {
    573                 // We don't have weights, so no realistic errors: turn off iteration
     568    // Check the variances
     569    if (variances && nIter > 1) {
     570        for (int i = 0; i < variances->n && nIter > 1; i++) {
     571            psImage *variance = variances->data[i]; // Variance image
     572            if (!variance) {
     573                // We don't have variances, so no realistic errors: turn off iteration
    574574                if (nIter > 0) {
    575                     psWarning("Not all images have weights --- turning iteration off.\n");
     575                    psWarning("Not all images have variances --- turning iteration off.\n");
    576576                }
    577577                nIter = 1;
     
    594594                    mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = (maskImage->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal);
    595595                }
    596                 psImage *weight;        // Weight image
    597                 if (weights && (weight = weights->data[i])) {
    598                     errors->data.F32[i] = sqrtf(weight->data.F32[y][x]) * refs->data.F32[i];
     596                psImage *variance;        // Variance image
     597                if (variances && (variance = variances->data[i])) {
     598                    errors->data.F32[i] = sqrtf(variance->data.F32[y][x]) * refs->data.F32[i];
    599599                } else {
    600600                    errors->data.F32[i] = sqrtf(image->data.F32[y][x]) * refs->data.F32[i];
     
    645645    psFree(images);
    646646    psFree(masks);
    647     psFree(weights);
     647    psFree(variances);
    648648    psFree(refs);
    649649    psFree(regions);
     
    878878        PS_ASSERT_IMAGE_SIZE(readout->mask, data->numCols, data->numRows, NULL);
    879879    }
    880     if (readout->weight) {
    881         PS_ASSERT_IMAGE_NON_NULL(readout->weight, NULL);
    882         PS_ASSERT_IMAGE_TYPE(readout->weight, PS_TYPE_F32, NULL);
    883         PS_ASSERT_IMAGE_SIZE(readout->weight, data->numCols, data->numRows, NULL);
     880    if (readout->variance) {
     881        PS_ASSERT_IMAGE_NON_NULL(readout->variance, NULL);
     882        PS_ASSERT_IMAGE_TYPE(readout->variance, PS_TYPE_F32, NULL);
     883        PS_ASSERT_IMAGE_SIZE(readout->variance, data->numCols, data->numRows, NULL);
    884884    }
    885885
     
    11331133                    mask->data.PS_TYPE_VECTOR_MASK_DATA[r] = (readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & maskVal);
    11341134                }
    1135                 if (readout->weight) {
    1136                     errors->data.F32[r] = sqrtf(readout->weight->data.F32[yIn][xIn]) * ref;
     1135                if (readout->variance) {
     1136                    errors->data.F32[r] = sqrtf(readout->variance->data.F32[yIn][xIn]) * ref;
    11371137                } else {
    11381138                    // XXX guess that the input data is Poisson distributed; if we go negative, force high
Note: See TracChangeset for help on using the changeset viewer.