IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42435


Ignore:
Timestamp:
Mar 24, 2023, 9:45:49 AM (3 years ago)
Author:
eugene
Message:

use a selected subset of sources to calculate source stats; new feature detection code to remove streaks from the sources used to set the PSF stars

Location:
branches/eam_branches/ipp-20230313/psphot/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/psphot/src/Makefile.am

    r38386 r42435  
    247247        psphotSetNFrames.c             \
    248248        psphotSourceMemory.c           \
     249        psphotFindFeatures.c           \
    249250        psphotChipParams.c              \
    250251        psphotGalaxyParams.c
  • branches/eam_branches/ipp-20230313/psphot/src/psphot.h

    r42088 r42435  
    592592extern bool psphotINpsphotStack;
    593593
     594bool psphotFindFeatures (psArray *sources);
     595
    594596
    595597#endif
  • branches/eam_branches/ipp-20230313/psphot/src/psphotSourceStats.c

    r41359 r42435  
    120120        source->moments = pmMomentsAlloc();
    121121
     122        // XXX can this ever be set at this point? (we just allocated the source and moments)
    122123        if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) {
    123124            fprintf (stderr, "moment failure\n");
     
    142143        return true;
    143144    }
     145
     146    // XXX I want to identify sources which are on lines.  these can be excluded from
     147    // the Moments and PSF analysis
     148
     149    psphotFindFeatures (sources);
    144150
    145151    if (setWindow) {
     
    539545    sources = psArraySort (sources, pmSourceSortByFlux);
    540546
     547    // generate an array of the sources which we want to use for this analysis
     548    // XXX move max source number to config
     549    psArray *sourceSubset = psArrayAllocEmpty (100);
     550    for (int i = 0; (i < sources->n) && (i < 400); i++) {
     551
     552        pmSource *source = sources->data[i];
     553
     554        // skip faint sources for moments measurement
     555        if (sqrt(source->peak->detValue) < MIN_SN) continue;
     556
     557        // skip sources on lines
     558        if (source->mode2 & PM_SOURCE_MODE2_ON_LINE) continue;
     559        psArrayAdd (sourceSubset, 100, source);
     560    }
     561
    541562    // loop over radii:
    542563    for (int i = 0; i < nsigma; i++) {
    543 
    544         // XXX move max source number to config
    545         for (int j = 0; (j < sources->n) && (j < 400); j++) {
    546 
    547             pmSource *source = sources->data[j];
     564        for (int j = 0; j < sourceSubset->n; j++) {
     565            pmSource *source = sourceSubset->data[j];
    548566            psAssert (source->moments, "force moments to exist");
    549567            source->moments->nPixels = 0;
     
    565583          sprintf (name, "moments.v%d.dat", i);
    566584          FILE *fout = fopen (name, "w");
    567           for (int j = 0; j < sources->n; j++) {
    568             pmSource *source = sources->data[j];
     585          for (int j = 0; j < sourceSubset->n; j++) {
     586            pmSource *source = sourceSubset->data[j];
    569587            psAssert (source->moments, "force moments to exist");
    570588            source->moments->nPixels = 0;
     
    581599
    582600        // determine the PSF parameters from the source moment values
    583         pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);
     601        pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sourceSubset, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);
    584602        psLogMsg ("psphot", 3, "sigma guess (pix) %.1f, nStars: %d of %d in clump, nSigma: %5.2f, X,  Y: %f, %f (%f, %f)\n", sigma[i], psfClump.nStars, psfClump.nTotal, psfClump.nSigma, psfClump.X, psfClump.Y, sqrt(psfClump.X) / sigma[i], sqrt(psfClump.Y) / sigma[i]);
    585603
    586         Rmin[i] = pmSourceMinKronRadius(sources, PSF_SN_LIM);
     604        Rmin[i] = pmSourceMinKronRadius(sourceSubset, PSF_SN_LIM);
    587605
    588606#if 0
     
    600618        psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY);
    601619        if (pmVisualTestLevel("psphot.moments.full", 2)) {
    602             psphotVisualPlotMoments (recipe, analysis, sources);
     620            psphotVisualPlotMoments (recipe, analysis, sourceSubset);
    603621        }
    604622#endif
     
    608626        Sout[i] = (Nout[i] == 0) ? NAN : sqrt(0.5*(psfClump.X + psfClump.Y)) / sigma[i];
    609627    }
     628
     629    psFree (sourceSubset);
    610630
    611631    // we are looking for sigma for which Sout = 0.65 (or some other value)
Note: See TracChangeset for help on using the changeset viewer.