IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2024, 12:29:41 PM (2 years ago)
Author:
eugene
Message:

add option in psphot to fit the PSF star positions as well as shapes (default is false); add option to use robustMedian vs clippedMean for moments-based source sizes and PSF star selection; reduce chance of choosing galaxies for PSF stars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/psModules/src/objects/pmSource.c

    r42439 r42710  
    407407*****************************************************************************/
    408408
    409 pmPSFClump pmSourcePSFClump(psImage **savedImage, psRegion *region, psArray *sources, float PSF_SN_LIM, float PSF_CLUMP_GRID_SCALE, psF32 SX_MAX, psF32 SY_MAX, psF32 SX_MIN, psF32 SY_MIN, psF32 AR_MAX)
     409pmPSFClump pmSourcePSFClump(psImage **savedImage, psRegion *region, psArray *sources, float PSF_SN_LIM, float PSF_CLUMP_GRID_SCALE, psF32 SX_MAX, psF32 SY_MAX, psF32 SX_MIN, psF32 SY_MIN, psF32 AR_MAX, bool useClippedMean)
    410410{
    411411    psTrace("psModules.objects", 10, "---- begin ----\n");
     
    601601        }
    602602
    603         // measures stats of Sx, Sy
    604         stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
    605 
    606         if (!psVectorStats (stats, tmpSx, NULL, NULL, 0)) {
    607             psError(PS_ERR_UNKNOWN, false, "failed to measure Sx stats");
    608             return (emptyClump);
    609         }
    610         psfClump.X  = stats->clippedMean;
    611         psfClump.dX = hypot(stats->clippedStdev, PSF_CLUMP_GRID_SCALE);
    612 
    613         if (!psVectorStats (stats, tmpSy, NULL, NULL, 0)) {
    614             psError(PS_ERR_UNKNOWN, false, "failed to measure Sy stats");
    615             return (emptyClump);
    616         }
    617         psfClump.Y  = stats->clippedMean;
    618         psfClump.dY = hypot(stats->clippedStdev, PSF_CLUMP_GRID_SCALE);
     603        // measures stats of Sx, Sy
     604        if (useClippedMean) {
     605          stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV);
     606        } else {
     607          stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
     608        }
     609
     610        if (!psVectorStats (stats, tmpSx, NULL, NULL, 0)) {
     611          psError(PS_ERR_UNKNOWN, false, "failed to measure Sx stats");
     612          return (emptyClump);
     613        }
     614        psfClump.X  = psStatsGetValue (stats, psStatsMeanOption (stats->options));
     615        psfClump.dX = psStatsGetValue (stats, psStatsStdevOption (stats->options));
     616        psfClump.dX = hypot(psfClump.dX, PSF_CLUMP_GRID_SCALE);
     617
     618        if (!psVectorStats (stats, tmpSy, NULL, NULL, 0)) {
     619          psError(PS_ERR_UNKNOWN, false, "failed to measure Sy stats");
     620          return (emptyClump);
     621        }
     622        psfClump.Y  = psStatsGetValue (stats, psStatsMeanOption (stats->options));
     623        psfClump.dY = psStatsGetValue (stats, psStatsStdevOption (stats->options));
     624        psfClump.dY = hypot(psfClump.dX, PSF_CLUMP_GRID_SCALE);             
    619625
    620626        psTrace ("psModules.objects", 2, "clump  X,  Y: %f, %f\n", psfClump.X, psfClump.Y);
     
    749755            }
    750756
     757            psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY);
     758
     759            // XXX this is crude cut to avoid using extended sources in the PSF model
     760            // psphot will update this analysis based on the PSF - Kron mags
    751761            // likely unsaturated extended source (too large to be stellar)
    752             if (sigX > clump.X + 3*clump.dX || sigY > clump.Y + 3*clump.dY) {
     762            // XXX old test: if (sigX > clump.X + 3*clump.dX || sigY > clump.Y + 3*clump.dY) {
     763
     764            if (radius > 2.0) {
    753765                source->type = PM_SOURCE_TYPE_EXTENDED;
    754766                Next ++;
     
    768780
    769781            // PSF star (within 1.5 sigma of clump center, S/N > limit)
    770             psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY);
    771782            if ((source->moments->SN > PSF_SN_LIM) && (radius < PSF_CLUMP_NSIGMA)) {
    772783                source->type = PM_SOURCE_TYPE_STAR;
Note: See TracChangeset for help on using the changeset viewer.