IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42710


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

Location:
branches/eam_branches/ipp-20230313/psModules/src/objects
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/psModules/src/objects/pmPSF.h

    r36858 r42710  
    7979    bool          poissonErrorsParams; ///< use poission errors for model parameter fitting
    8080
     81    bool          fitPSFstarCoords; // Allow the PSF star positions to fit in the full fit? (pmPSFtryFitEXT)
    8182    bool          chiFluxTrend;         // Fit a trend in Chi2 as a function of flux?
    8283    pmSourceFitOptions *fitOptions;
  • branches/eam_branches/ipp-20230313/psModules/src/objects/pmPSFtryFitEXT.c

    r36856 r42710  
    7373
    7474    // in this segment, we are fitting the full PSF model class (shape unconstrained)
    75     options->fitOptions->mode = PM_SOURCE_FIT_EXT;
    76 
     75    if (options->fitPSFstarCoords) {
     76      options->fitOptions->mode = PM_SOURCE_FIT_FULL;
     77    } else {
     78      options->fitOptions->mode = PM_SOURCE_FIT_EXT;
     79    }
    7780    // maskVal is used to test for rejected pixels, and must include markVal
    7881    maskVal |= markVal;
  • 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;
  • branches/eam_branches/ipp-20230313/psModules/src/objects/pmSource.h

    r37321 r42710  
    245245    psF32 SX_MIN,
    246246    psF32 SY_MIN,
    247     psF32 AR_MAX
     247    psF32 AR_MAX,
     248    bool useClippedMean                 ///< use clipped mean & stdev to define clump, else robust
    248249);
    249250
  • branches/eam_branches/ipp-20230313/psModules/src/objects/pmSourceFitModel.c

    r42093 r42710  
    189189        constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_XPOS] = 0;
    190190        constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_YPOS] = 0;
     191        break;
     192      case PM_SOURCE_FIT_FULL:
     193        // PSFstar Full model fits all shape params and Xo, Yo, Io (not sky)
     194        nParams = params->n - 1;
     195        psVectorInit (constraint->paramMask, 0);
     196        constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[PM_PAR_SKY] = 1;
    191197        break;
    192198      case PM_SOURCE_FIT_EXT:
     
    270276    model->nPar = nParams;
    271277
    272     psTrace ("psModules.objects", 4, "niter: %d, chisq: %f", myMin->iter, myMin->value);
     278    psTrace ("psModules.objects", 4, "niter: %d, chisq: %f, status: %d", myMin->iter, myMin->value, fitStatus);
    273279
    274280    // save the resulting chisq, nDOF, nIter
  • branches/eam_branches/ipp-20230313/psModules/src/objects/pmSourceFitModel.h

    r42093 r42710  
    1818    PM_SOURCE_FIT_PSF,
    1919    PM_SOURCE_FIT_EXT,
     20    PM_SOURCE_FIT_FULL,
    2021    PM_SOURCE_FIT_PSF_AND_SKY,
    2122    PM_SOURCE_FIT_EXT_AND_SKY,
Note: See TracChangeset for help on using the changeset viewer.