IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24317


Ignore:
Timestamp:
Jun 3, 2009, 5:51:01 PM (17 years ago)
Author:
Paul Price
Message:

If moments couldn't be measured, then can't determine if DEFECT vs
EXTENDED vs STAR. This was preventing photometry of faint sources
(S/N ~ 10) because they were marked as DEFECT, even though we know
the moments can't be trusted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSource.c

    r23989 r24317  
    480480
    481481        if (!psVectorStats (stats, tmpSx, NULL, NULL, 0)) {
    482             psError(PS_ERR_UNKNOWN, false, "failed to measure Sx stats");
     482            psError(PS_ERR_UNKNOWN, false, "failed to measure Sx stats");
    483483            return (emptyClump);
    484         }
     484        }
    485485        psfClump.X  = stats->clippedMean;
    486486        psfClump.dX = stats->clippedStdev;
    487487
    488488        if (!psVectorStats (stats, tmpSy, NULL, NULL, 0)) {
    489             psError(PS_ERR_UNKNOWN, false, "failed to measure Sy stats");
     489            psError(PS_ERR_UNKNOWN, false, "failed to measure Sy stats");
    490490            return (emptyClump);
    491         }
     491        }
    492492        psfClump.Y  = stats->clippedMean;
    493493        psfClump.dY = stats->clippedStdev;
     
    549549        pmSource *source = (pmSource *) sources->data[i];
    550550
    551         // psf clumps are found for image subregions:
    552         // skip sources not in this region
     551        // psf clumps are found for image subregions:
     552        // skip sources not in this region
    553553        if (source->peak->x <  region->x0) continue;
    554554        if (source->peak->x >= region->x1) continue;
    555555        if (source->peak->y <  region->y0) continue;
    556         if (source->peak->y >= region->y1) continue;
    557 
    558         // should be set by pmSourceAlloc
     556        if (source->peak->y >= region->y1) continue;
     557
     558        // should be set by pmSourceAlloc
    559559        psAssert (source->type == PM_SOURCE_TYPE_UNKNOWN, "source type was not init-ed?");
    560560
     
    562562        if (!source->moments) {
    563563            source->type = PM_SOURCE_TYPE_STAR;
    564             psAssert (source->mode & noMoments, "why is this source missing moments?");
     564            psAssert (source->mode & noMoments, "why is this source missing moments?");
    565565            Nstar++;
    566566            continue;
     
    596596        }
    597597
    598         // likely defect (too small to be stellar) (push out to 3 sigma)
    599         // low S/N objects which are small are probably stellar
    600         // only set candidate defects if
    601         // XXX these limits are quite arbitrary
    602         if ((sigX < 0.05) || (sigY < 0.05)) {
    603             source->type = PM_SOURCE_TYPE_DEFECT;
    604             source->mode |= PM_SOURCE_MODE_DEFECT;
    605             Ncr ++;
    606             continue;
    607         }
    608 
    609         // likely unsaturated extended source (too large to be stellar)
    610         if ((sigX > (clump.X + 3*clump.dX)) || (sigY > (clump.Y + 3*clump.dY))) {
    611             source->type = PM_SOURCE_TYPE_EXTENDED;
    612             Next ++;
    613             continue;
    614         }
    615 
    616         // the rest are probable stellar objects
    617         starsn_moments->data.F32[starsn_moments->n] = source->moments->SN;
    618         starsn_moments->n ++;
    619         starsn_peaks->data.F32[starsn_peaks->n] = source->peak->SN;
    620         starsn_peaks->n ++;
    621         Nstar ++;
    622 
    623         // PSF star (within 1.5 sigma of clump center, S/N > limit)
    624         psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY);
    625         if ((source->moments->SN > PSF_SN_LIM) && (radius < PSF_CLUMP_NSIGMA)) {
    626             source->type = PM_SOURCE_TYPE_STAR;
    627             source->mode |= PM_SOURCE_MODE_PSFSTAR;
    628             Npsf ++;
    629             continue;
     598        // The following determinations require the use of moments
     599        if (!(source->mode & noMoments)) {
     600            // likely defect (too small to be stellar) (push out to 3 sigma)
     601            // low S/N objects which are small are probably stellar
     602            // XXX these limits are quite arbitrary
     603            if (sigX < 0.05 || sigY < 0.05) {
     604                source->type = PM_SOURCE_TYPE_DEFECT;
     605                source->mode |= PM_SOURCE_MODE_DEFECT;
     606                Ncr ++;
     607                continue;
     608            }
     609
     610            // likely unsaturated extended source (too large to be stellar)
     611            if (sigX > clump.X + 3*clump.dX || sigY > clump.Y + 3*clump.dY) {
     612                source->type = PM_SOURCE_TYPE_EXTENDED;
     613                Next ++;
     614                continue;
     615            }
     616
     617            // the rest are probable stellar objects
     618            starsn_moments->data.F32[starsn_moments->n] = source->moments->SN;
     619            starsn_moments->n ++;
     620            starsn_peaks->data.F32[starsn_peaks->n] = source->peak->SN;
     621            starsn_peaks->n ++;
     622            Nstar ++;
     623
     624            // PSF star (within 1.5 sigma of clump center, S/N > limit)
     625            psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY);
     626            if ((source->moments->SN > PSF_SN_LIM) && (radius < PSF_CLUMP_NSIGMA)) {
     627                source->type = PM_SOURCE_TYPE_STAR;
     628                source->mode |= PM_SOURCE_MODE_PSFSTAR;
     629                Npsf ++;
     630                continue;
     631            }
    630632        }
    631633
     
    642644
    643645        if (!psVectorStats (stats, starsn_moments, NULL, NULL, 0)) {
    644             psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats");
    645             psFree (stats);
    646             psFree (starsn_peaks);
    647             return false;
     646            psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats");
     647            psFree (stats);
     648            psFree (starsn_peaks);
     649            return false;
    648650        }
    649651        psLogMsg ("pmObjects", 3, "SN range (moments): %f - %f\n", stats->min, stats->max);
     
    656658        stats = psStatsAlloc (PS_STAT_MIN | PS_STAT_MAX);
    657659        if (!psVectorStats (stats, starsn_peaks, NULL, NULL, 0)) {
    658             psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats");
    659             psFree (stats);
    660             psFree (starsn_peaks);
    661             return false;
     660            psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats");
     661            psFree (stats);
     662            psFree (starsn_peaks);
     663            return false;
    662664        }
    663665        psLogMsg ("psModules.objects", 3, "SN range (peaks)  : %f - %f (%ld)\n",
Note: See TracChangeset for help on using the changeset viewer.