Changeset 42842 for trunk/psphot/src/psphotSourceStats.c
- Timestamp:
- May 9, 2025, 11:21:40 AM (14 months ago)
- Location:
- trunk/psphot
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psphotSourceStats.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20230313/psphot (added) merged: 42435,42439,42507-42510,42529,42582,42612,42707,42711
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotSourceStats.c
r41359 r42842 120 120 source->moments = pmMomentsAlloc(); 121 121 122 // XXX can this ever be set at this point? (we just allocated the source and moments) 122 123 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) { 123 124 fprintf (stderr, "moment failure\n"); … … 144 145 145 146 if (setWindow) { 147 // identify sources on lines, drop from MomentsWindow analysis 148 psphotFindFeatures (readout, sources); 149 146 150 if (!psphotSetMomentsWindow(recipe, readout->analysis, sources, maskVal)) { 147 151 psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!"); … … 503 507 } 504 508 509 // use clipped stats or robust stats to define the clump 510 bool PSF_CLUMP_USE_CLIPPED_STATS = psMetadataLookupF32(&status, recipe, "PSF_CLUMP_USE_CLIPPED_STATS"); 511 if (!status) { PSF_CLUMP_USE_CLIPPED_STATS = true; } 512 505 513 // when we set the window, we are not attempting to measure spatial variations; we can use a somewhat higher S/N limit 506 514 // since we are using all sources (true?) … … 539 547 sources = psArraySort (sources, pmSourceSortByFlux); 540 548 549 // generate an array of the sources which we want to use for this analysis 550 // XXX move max source number to config 551 psArray *sourceSubset = psArrayAllocEmpty (100); 552 for (int i = 0; (i < sources->n) && (i < 400); i++) { 553 554 pmSource *source = sources->data[i]; 555 556 // skip faint sources for moments measurement 557 if (sqrt(source->peak->detValue) < MIN_SN) continue; 558 559 // skip sources on lines 560 if (source->mode2 & PM_SOURCE_MODE2_ON_LINE) continue; 561 psArrayAdd (sourceSubset, 100, source); 562 } 563 541 564 // loop over radii: 542 565 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]; 566 for (int j = 0; j < sourceSubset->n; j++) { 567 pmSource *source = sourceSubset->data[j]; 548 568 psAssert (source->moments, "force moments to exist"); 549 569 source->moments->nPixels = 0; … … 565 585 sprintf (name, "moments.v%d.dat", i); 566 586 FILE *fout = fopen (name, "w"); 567 for (int j = 0; j < source s->n; j++) {568 pmSource *source = source s->data[j];587 for (int j = 0; j < sourceSubset->n; j++) { 588 pmSource *source = sourceSubset->data[j]; 569 589 psAssert (source->moments, "force moments to exist"); 570 590 source->moments->nPixels = 0; … … 581 601 582 602 // determine the PSF parameters from the source moment values 583 pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, source s, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);603 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, PSF_CLUMP_USE_CLIPPED_STATS); 584 604 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]); 585 605 586 Rmin[i] = pmSourceMinKronRadius(source s, PSF_SN_LIM);606 Rmin[i] = pmSourceMinKronRadius(sourceSubset, PSF_SN_LIM); 587 607 588 608 #if 0 … … 600 620 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY); 601 621 if (pmVisualTestLevel("psphot.moments.full", 2)) { 602 psphotVisualPlotMoments (recipe, analysis, source s);622 psphotVisualPlotMoments (recipe, analysis, sourceSubset); 603 623 } 604 624 #endif … … 608 628 Sout[i] = (Nout[i] == 0) ? NAN : sqrt(0.5*(psfClump.X + psfClump.Y)) / sigma[i]; 609 629 } 630 631 psFree (sourceSubset); 610 632 611 633 // we are looking for sigma for which Sout = 0.65 (or some other value)
Note:
See TracChangeset
for help on using the changeset viewer.
