IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25489


Ignore:
Timestamp:
Sep 22, 2009, 5:28:06 PM (17 years ago)
Author:
Paul Price
Message:

Normalise by the peak, not the centre.

File:
1 edited

Legend:

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

    r25488 r25489  
    170170            float y = source->peak->yf + yOffset->data.S32[j]; // y coordinate of source
    171171
    172             double flux = fakeRO->image->data.F32[(int)y][(int)x];
     172            // Perhaps I'm being paranoid, but specify a range to check
     173            int uMax = PS_MIN(x + radius, numCols - 1), uMin = PS_MAX(x - radius, 0);
     174            int vMax = PS_MIN(y + radius, numRows - 1), vMin = PS_MAX(y - radius, 0);
     175
     176            double flux = -INFINITY;    // Peak flux
     177            for (int v = vMin; v <= vMax; v++) {
     178                for (int u = uMin; u <= uMax; u++) {
     179                    if (fakeRO->image->data.F32[v][u] > flux) {
     180                        flux = fakeRO->image->data.F32[v][u];
     181                    }
     182                }
     183            }
     184
    173185            if (!isfinite(flux) || flux < 0) {
    174186                continue;
     
    240252        int xFake = source->peak->x + xOffset->data.S32[i];
    241253        int yFake = source->peak->y + yOffset->data.S32[i];
    242         psRegion region = psRegionSet(xFake - radius, xFake + radius,
    243                                       yFake - radius, yFake + radius); // PSF region
     254        psRegion region = psRegionSet(xFake - maxRadius, xFake + maxRadius,
     255                                      yFake - maxRadius, yFake + maxRadius); // PSF region
    244256        psImage *subImage = psImageSubset(envelope, region); // Subimage of fake PSF
    245257
Note: See TracChangeset for help on using the changeset viewer.