IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42830


Ignore:
Timestamp:
May 8, 2025, 4:53:16 PM (12 months ago)
Author:
eugene
Message:

add exp Weights for pmStackCombineByPercentile (UNIONS stacks)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmStack.c

    r42555 r42830  
    15271527            pixelVariances->data.F32[A] = pixelVariances->data.F32[B];  \
    15281528            pixelVariances->data.F32[B] = tempVar;                      \
     1529            psF32 tempWgt = expWeight->data.F32[A];             \
     1530            expWeight->data.F32[A] = expWeight->data.F32[B];    \
     1531            expWeight->data.F32[B] = tempWgt;                                   \
    15291532            if (expTime) {                                              \
    15301533                psF32 tempExp = expTime->data.F32[A];                   \
     
    15891592    psVector *pixelVariances = psVectorAlloc(stackData->n, PS_TYPE_F32);
    15901593
     1594    // storage vector for exposures weights (for pixels with few inputs)
     1595    psVector *expWeight = psVectorAlloc(stackData->n, PS_TYPE_F32);
     1596
    15911597    // if we are asking for the exptime maps, generate a storage vector expTime
    15921598    psVector *expTime        = expmaps && expmaps->image ? psVectorAlloc(stackData->n, PS_TYPE_F32) : NULL;
     
    16401646                // accumulate exposure times if required
    16411647                if (expTime)  { expTime->data.F32[nGood] = data->exp; }
     1648                expWeight->data.F32[nGood] = data->exp;
    16421649                nGood ++;
    16431650            }
     
    17291736            }
    17301737
     1738            // XXX should I use the expWeight regardless of the number of inputs??
     1739
    17311740            float sum = 0.0;
    17321741            float varSum = 0.0;
     1742            float wtSum = 0.0;
    17331743            for (int n = Ns; n < Ne; n++) {
    1734                 sum += pixelData->data.F32[n];
    1735                 varSum += pixelVariances->data.F32[n];
    1736             }
    1737             float mean = sum / (float) Npt;
    1738             float varValue = varSum / (float) (nGoodClip*nGoodClip);
     1744                psF32 wt = expWeight->data.F32[n];
     1745                psF32 wt2 = wt*wt;
     1746                sum += pixelData->data.F32[n]*wt;
     1747                varSum += pixelVariances->data.F32[n]*wt2;
     1748                wtSum += wt;
     1749            }
     1750            // float mean = sum / (float) Npt;
     1751            // float varValue = varSum / (float) (nGoodClip*nGoodClip);
     1752            float mean = sum / wtSum;
     1753            float varValue = varSum / PS_SQR(wtSum);
    17391754
    17401755            // alternative: calculate the stdev of the pixel values
Note: See TracChangeset for help on using the changeset viewer.