IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34311


Ignore:
Timestamp:
Aug 14, 2012, 5:04:45 PM (14 years ago)
Author:
bills
Message:

Fix bug in psphotKronIterate_Threaded where it was incorrectly applying the
maximum radius based on surface brightness. Only apply that cut if we trust
the current kron radius measurement.
Also fix bug in flux calculation when non-finite radius was measured. If that
happens leave the current values unchanged

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotKronIterate.c

    r33964 r34311  
    160160
    161161    // generate the window image: multiply the flux by this to downweight neighbors
     162    // XXX: we don't need this image if we aren't going to apply the window
    162163    psImage *kronWindow = psImageAlloc (readout->image->numCols, readout->image->numRows, PS_TYPE_F32);
    163164    psImageInit (kronWindow, 1.0);
     
    329330            } else {
    330331                if (KRON_SB_MIN_DIVISOR) {
    331                     if (isfinite(source->moments->KronFlux) && (source->moments->KronFlux > 0)) {
    332                         // Limit window radius based on surface brightness
     332                    // Limit window radius based on surface brightness if we have a good measurement of kron flux
     333                    if (isfinite(source->moments->Mrf) && source->moments->Mrf > 0 &&
     334                        isfinite(source->moments->KronFlux)  && (source->moments->KronFlux > 0)) {
    333335                        float Rmax = sqrt(source->moments->KronFlux) / KRON_SB_MIN_DIVISOR;
    334336
    335                         if (source->moments->Mrf > 0) {
    336                             maxWindow = PS_MIN(6.0*source->moments->Mrf, Rmax);
    337                         } else {
    338                             maxWindow = Rmax;
    339                         }
     337                        maxWindow = PS_MIN(6.0*source->moments->Mrf, Rmax);
    340338                    } else {
    341339                        maxWindow = RADIUS;
    342340                    }
    343341                } else {
    344                     // old code
     342                    // old recipe, no surface brightness cut
    345343                    maxWindow = isfinite(source->moments->Mrf) ? 6.0*source->moments->Mrf : RADIUS;
    346344                }
     
    491489    }
    492490
     491    float MrfTry = RF/RS;
     492    if (!isfinite(MrfTry)) {
     493        // We did not get a successul measurement of the kron radius.
     494        // Leave the current values unchanged.
     495        return false;
     496    }
     497
     498    float Mrf = MAX(minKronRadius, MrfTry);
    493499    // Saturate the 1st radial moment
    494     float Mrf = MAX(minKronRadius, RF/RS);
    495500    if (sqrt(source->peak->detValue) < 10.0) {
    496501        Mrf = MIN (radius, Mrf);
     
    559564    psAssert(kronWindow, "need a window");
    560565
     566    // If we are not applying the window then we don't need to check for valid Mrf here.
     567    // We should give the this module a chance to measure a good value.
     568    // Not yet though. We need to test the effect of this
    561569    if (!isfinite(source->moments->Mrf) || source->moments->Mrf < 0 ) return false;
    562570
Note: See TracChangeset for help on using the changeset viewer.