IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 22, 2010, 8:34:28 PM (16 years ago)
Author:
Paul Price
Message:

Adding exposure map (both exposure time and number of inputs) to the outputs of ppStack. These are calculated both for the regular (convolved) and unconvolved stacks. These should compress pretty well, but I haven't enabled the compression yet. I also plan to add a weighted exposure time output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackReadout.c

    r27319 r27400  
    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
    41     psArray *reject = args->data[2];    // Rejected pixels for each image
    42     ppStackOptions *options = args->data[3]; // Options
    43     pmConfig *config = args->data[4];   // Configuration
    44     bool safety = PS_SCALAR_VALUE(args->data[5], U8);    // Safety switch on?
    45     bool normalise = PS_SCALAR_VALUE(args->data[6], U8); // Normalise images?
     40    ppStackThread *thread = args->data[0]; // Thread
     41    psArray *reject = args->data[1];    // Rejected pixels for each image
     42    ppStackOptions *options = args->data[2]; // Options
     43    pmConfig *config = args->data[3];   // Configuration
     44    bool safety = PS_SCALAR_VALUE(args->data[4], U8);    // Safety switch on?
     45    bool normalise = PS_SCALAR_VALUE(args->data[5], U8); // Normalise images?
    4646
    4747    psVector *mask = options->inputMask; // Mask for inputs
    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, reject,
    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);
     
    149153        }
    150154
    151         stack->data[i] = pmStackDataAlloc(ro, weightings->data.F32[i], addVariance->data.F32[i]);
    152     }
    153 
    154     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,
    155160                        combineRej, combineSys, combineDiscard, useVariance, safe, false)) {
    156161        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
     
    187192
    188193
    189 bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
     194bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, pmReadout *expRO, const psArray *readouts,
    190195                         const psVector *mask, const psArray *rejected, const psVector *weightings,
    191                          const psVector *addVariance, bool safety, const psVector *norm)
     196                         const psVector *exposures, const psVector *addVariance, bool safety,
     197                         const psVector *norm)
    192198{
    193199    assert(config);
    194200    assert(outRO);
     201    assert(expRO);
    195202    assert(readouts);
    196203    assert(!rejected || readouts->n == rejected->n);
     
    238245        }
    239246
    240         pmStackData *data = pmStackDataAlloc(ro, weightings->data.F32[i],
     247        pmStackData *data = pmStackDataAlloc(ro, weightings->data.F32[i], exposures->data.F32[i],
    241248                                             addVariance ? addVariance->data.F32[i] : NAN);
    242249        data->reject = rejected ? psMemIncrRefCounter(rejected->data[i]) : NULL;
     
    250257    }
    251258
    252     if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej,
     259    if (!pmStackCombine(outRO, expRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej,
    253260                        combineSys, combineDiscard, useVariance, safe, rejected)) {
    254261        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
     
    259266    pmCell *outCell = outRO->parent;    // Output cell
    260267    pmChip *outChip = outCell->parent;  // Output chip
    261 
    262268    outRO->data_exists = true;
    263269    outCell->data_exists = true;
    264270    outChip->data_exists = true;
    265271
     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
    266278    psFree(stack);
    267279
Note: See TracChangeset for help on using the changeset viewer.