IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 17, 2014, 12:32:26 PM (12 years ago)
Author:
eugene
Message:

merge changes (from past YEAR) into trunk

Location:
branches/eam_branches/ipp-ops-20130712/ppStack/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-ops-20130712/ppStack/src

  • branches/eam_branches/ipp-ops-20130712/ppStack/src/ppStackReadout.c

    r34800 r37067  
    3434    bool safety = PS_SCALAR_VALUE(args->data[4], U8);    // Safety switch on?
    3535    bool normalise = PS_SCALAR_VALUE(args->data[5], U8); // Normalise images?
     36    bool bscaleoffset = PS_SCALAR_VALUE(args->data[6], U8); // Apply bscale offset?
    3637
    3738    psVector *mask = options->inputMask; // Mask for inputs
     
    4041    psVector *addVariance = options->matchChi2; // Additional variance when rejecting
    4142    psVector *norm = normalise ? options->norm : NULL; // Normalisations to apply to images
     43    psVector *bscaleApplyOffset = bscaleoffset ? options->bscaleOffset : NULL; // BSCALE offset to apply to images
    4244
    4345    bool status = ppStackReadoutFinal(config, options->outRO, options->expRO, thread->readouts, mask, reject,
    44                                       weightings, exposures, addVariance, safety, norm); // Status of operation
     46                                      weightings, exposures, addVariance, safety, norm, bscaleApplyOffset); // Status of operation
    4547
    4648    thread->busy = false;
     
    116118    bool useVariance = psMetadataLookupBool(&mdok, recipe, "VARIANCE"); // Use variance for rejection?
    117119    bool safe = psMetadataLookupBool(&mdok, recipe, "SAFE"); // Be safe when combining small numbers of pixels
     120   
     121    int nminpix = psMetadataLookupS32(&mdok, recipe, "NMINPIX"); // Minimum input per pixel to combine with
    118122
    119123    psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe
     
    161165
    162166    if (!pmStackCombine(outRO, NULL, stack, maskBad, maskSuspect, maskBlank, kernelSize, iter,
    163                         combineRej, combineSys, combineDiscard, useVariance, safe, false)) {
     167                        combineRej, combineSys, combineDiscard, useVariance, safe, nminpix, false)) {
    164168        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
    165169        psFree(stack);
     
    184188    psFree(stack);
    185189
     190    //MEH change to trace
     191    //psLogMsg("ppStack", PS_LOG_INFO, "initial stack image sectionNum %d", sectionNum);
     192
    186193    sectionNum++;
    187194
     
    197204                         const psVector *mask, const psArray *rejected, const psVector *weightings,
    198205                         const psVector *exposures, const psVector *addVariance, bool safety,
    199                          const psVector *norm)
     206                         const psVector *norm, const psVector *bscaleApplyOffset)
    200207{
    201208    assert(config);
     
    216223    bool useVariance = psMetadataLookupBool(&mdok, recipe, "VARIANCE"); // Use variance for rejection?
    217224    bool safe = psMetadataLookupBool(&mdok, recipe, "SAFE"); // Be safe when combining small numbers of pixels
     225
     226    int nminpix = psMetadataLookupS32(&mdok, recipe, "NMINPIX"); // Minimum input per pixel to combine with
    218227
    219228    psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of bits to mask for bad
     
    265274        stack->data[i] = data;
    266275
     276        //MEH -- apply bscale offset before norm   
     277        if (bscaleApplyOffset) {
     278            //MEH change to trace
     279            //psLogMsg("ppStack", PS_LOG_INFO, "bscaleApplyOffset: %d %f", i, bscaleApplyOffset->data.F32[i]);
     280            psBinaryOp(ro->image, ro->image, "-", psScalarAlloc(bscaleApplyOffset->data.F32[i], PS_TYPE_F32));
     281        }
     282
    267283        if (norm) {
    268284            float normalise = powf(10.0, -0.4 * norm->data.F32[i]); // Normalisation
     
    273289
    274290    if (!pmStackCombine(outRO, expRO, stack, maskBad, maskSuspect, maskBlank, 0, iter, combineRej,
    275                         combineSys, combineDiscard, useVariance, safe, rejected)) {
     291                        combineSys, combineDiscard, useVariance, safe, nminpix, rejected)) {
    276292        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
    277293        psFree(stack);
     
    293309    psFree(stack);
    294310
     311    //MEH change to trace
     312    //psLogMsg("ppStack", PS_LOG_INFO, "final stack image sectionNum %d", sectionNum);
     313
    295314    sectionNum++;
    296315
Note: See TracChangeset for help on using the changeset viewer.