IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2010, 3:55:49 PM (16 years ago)
Author:
eugene
Message:

update merges from trunk

Location:
branches/eam_branches/20100225
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20100225

  • branches/eam_branches/20100225/ppStack/src/ppStackReadout.c

    r26898 r27517  
    2323    psVector *mask = options->inputMask; // Mask for inputs
    2424    psVector *weightings = options->weightings; // Weightings (1/noise^2) for each image
     25    psVector *exposures = options->exposures;   // Exposure times for each image
    2526    psVector *addVariance = options->matchChi2; // Additional variance when rejecting
    2627
    2728    job->results = ppStackReadoutInitial(config, outRO, thread->readouts, mask,
    28                                          weightings, addVariance);
     29                                         weightings, exposures, addVariance);
    2930    thread->busy = false;
    3031
     
    3738
    3839    psArray *args = job->args;          // Arguments
    39     pmReadout *target = args->data[0];  // Output readout
    40     ppStackThread *thread = args->data[1]; // Thread
     40    ppStackThread *thread = args->data[0]; // Thread
     41    psArray *reject = args->data[1];    // Rejected pixels for each image
    4142    ppStackOptions *options = args->data[2]; // Options
    4243    pmConfig *config = args->data[3];   // Configuration
     
    4546
    4647    psVector *mask = options->inputMask; // Mask for inputs
    47     psArray *rejected = options->rejected; // Rejected pixels
    4848    psVector *weightings = options->weightings; // Weightings (1/noise^2) for each image
     49    psVector *exposures = options->exposures;   // Exposure times for each image
    4950    psVector *addVariance = options->matchChi2; // Additional variance when rejecting
    5051    psVector *norm = normalise ? options->norm : NULL; // Normalisations to apply to images
    5152
    52     bool status = ppStackReadoutFinal(config, target, thread->readouts, mask, rejected,
    53                                       weightings, addVariance, safety, norm); // Status of operation
     53    bool status = ppStackReadoutFinal(config, options->outRO, options->expRO, thread->readouts, mask, reject,
     54                                      weightings, exposures, addVariance, safety, norm); // Status of operation
    5455
    5556    thread->busy = false;
     57
     58    psAssert(status, "Stacking failed.");
    5659
    5760    return status;
     
    101104
    102105psArray *ppStackReadoutInitial(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
    103                                const psVector *mask, const psVector *weightings, const psVector *addVariance)
     106                               const psVector *mask, const psVector *weightings, const psVector *exposures,
     107                               const psVector *addVariance)
    104108{
    105109    assert(config);
     
    143147        }
    144148
    145 #if 0
    146         // This doesn't seem to work, so getting the weightings directly from a vector
    147         float weighting = psMetadataLookupF32(&mdok, ro->analysis, "PPSTACK.WEIGHTING"); // Relative weight
    148         if (!mdok || !isfinite(weighting)) {
    149             psWarning("No weighting supplied for image %d --- set to unity.", i);
    150             weighting = 1.0;
    151         } else {
    152             psLogMsg("ppStack", PS_LOG_INFO, "Weighting for image %d is %f", i, weighting);
    153         }
    154 #endif
    155 
    156149        // Ensure there is a mask, or pmStackCombine will complain
    157150        if (!ro->mask) {
     
    160153        }
    161154
    162         stack->data[i] = pmStackDataAlloc(ro, weightings->data.F32[i], addVariance->data.F32[i]);
    163     }
    164 
    165     if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, kernelSize, iter,
     155        stack->data[i] = pmStackDataAlloc(ro, weightings->data.F32[i], exposures->data.F32[i],
     156                                          addVariance->data.F32[i]);
     157    }
     158
     159    if (!pmStackCombine(outRO, NULL, stack, maskVal | maskBad, maskSuspect, maskBad, kernelSize, iter,
    166160                        combineRej, combineSys, combineDiscard, useVariance, safe, false)) {
    167161        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
     
    198192
    199193
    200 bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
     194bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, pmReadout *expRO, const psArray *readouts,
    201195                         const psVector *mask, const psArray *rejected, const psVector *weightings,
    202                          const psVector *addVariance, bool safety, const psVector *norm)
     196                         const psVector *exposures, const psVector *addVariance, bool safety,
     197                         const psVector *norm)
    203198{
    204199    assert(config);
    205200    assert(outRO);
     201    assert(expRO);
    206202    assert(readouts);
    207203    assert(!rejected || readouts->n == rejected->n);
     
    243239        }
    244240
    245 #if 0
    246         // This doesn't seem to work, so getting the weightings directly from a vector
    247         bool mdok;                      // Status of MD lookup
    248         float weighting = psMetadataLookupF32(&mdok, ro->analysis, "PPSTACK.WEIGHTING"); // Relative weight
    249         if (!mdok || !isfinite(weighting)) {
    250             psWarning("No WEIGHTING supplied for image %d --- set to unity.", i);
    251             weighting = 1.0;
    252         }
    253 #endif
    254 
    255241        // Ensure there is a mask, or pmStackCombine will complain
    256242        if (!ro->mask) {
     
    259245        }
    260246
    261         pmStackData *data = pmStackDataAlloc(ro, weightings->data.F32[i],
     247        pmStackData *data = pmStackDataAlloc(ro, weightings->data.F32[i], exposures->data.F32[i],
    262248                                             addVariance ? addVariance->data.F32[i] : NAN);
    263249        data->reject = rejected ? psMemIncrRefCounter(rejected->data[i]) : NULL;
     
    271257    }
    272258
    273     if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej,
     259    if (!pmStackCombine(outRO, expRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej,
    274260                        combineSys, combineDiscard, useVariance, safe, rejected)) {
    275261        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
     
    280266    pmCell *outCell = outRO->parent;    // Output cell
    281267    pmChip *outChip = outCell->parent;  // Output chip
    282 
    283268    outRO->data_exists = true;
    284269    outCell->data_exists = true;
    285270    outChip->data_exists = true;
    286271
     272    pmCell *expCell = expRO->parent;    // Exposure cell
     273    pmChip *expChip = expCell->parent;  // Exposure chip
     274    expRO->data_exists = true;
     275    expCell->data_exists = true;
     276    expChip->data_exists = true;
     277
    287278    psFree(stack);
    288279
Note: See TracChangeset for help on using the changeset viewer.