Changeset 30883
- Timestamp:
- Mar 12, 2011, 10:06:53 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 5 edited
-
psphot.h (modified) (1 diff)
-
psphotMergeSources.c (modified) (3 diffs)
-
psphotRoughClass.c (modified) (2 diffs)
-
psphotSourceStats.c (modified) (6 diffs)
-
psphotVisual.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphot.h
r30749 r30883 253 253 bool psphotVisualShowLogSignificance (psImage *image, float min, float max); 254 254 bool psphotVisualShowPeaks (pmDetections *detections); 255 bool psphotVisualShowSources (psArray *sources); 255 256 bool psphotVisualShowFootprints (pmDetections *detections); 256 257 bool psphotVisualShowMoments (psArray *sources); -
branches/eam_branches/ipp-20110213/psphot/src/psphotMergeSources.c
r30776 r30883 1 1 # include "psphotInternal.h" 2 2 3 // Mask to apply for PSF sources : only exclude bad sources -- we will re-test for extendedness 3 4 #define PSF_SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_SATSTAR | PM_SOURCE_MODE_BLEND | \ 4 5 PM_SOURCE_MODE_BADPSF | PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_SATURATED | \ 5 PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT) // Mask to apply for PSF sources6 PM_SOURCE_MODE_CR_LIMIT) 6 7 7 8 // for now, let's store the detections on the readout->analysis for each readout … … 347 348 348 349 psLogMsg ("psphot", 3, "%ld PSF sources loaded", detections->peaks->n); 350 psphotVisualShowSources (sources); 351 psphotVisualShowPeaks (detections); 349 352 350 353 // save detections on the readout->analysis … … 354 357 } 355 358 psFree (detections); 359 356 360 return true; 357 361 } 358 362 359 363 // generate the detection structure for the supplied array of sources 364 // XXX this function is currently unused 360 365 bool psphotSetSourceParams (pmConfig *config, psArray *sources, pmPSF *psf) { 361 366 -
branches/eam_branches/ipp-20110213/psphot/src/psphotRoughClass.c
r29936 r30883 63 63 } 64 64 65 int NstarsInClump = psMetadataLookupS32 (&status, readout->analysis, "PSF_CLUMP_NSTARS"); 66 // if NstarsInClump is not defined, use the user-selected option: 67 if (!status) { 68 NstarsInClump = 1000; 69 } 70 71 int ScaleForClump = 1; 72 if (NstarsInClump >= 12) ScaleForClump = 2; // 4 cells 73 if (NstarsInClump >= 27) ScaleForClump = 3; // 9 cells 74 if (NstarsInClump >= 48) ScaleForClump = 4; // 16 cells 75 if (NstarsInClump > 75) ScaleForClump = 5; // 25 cells 76 65 77 // we make this measurement on a NxM grid of regions across the readout 66 78 int NX = psMetadataLookupS32 (&status, recipe, "PSF_CLUMP_NX"); CHECK_STATUS (status, "PSF_CLUMP_NX"); 67 79 int NY = psMetadataLookupS32 (&status, recipe, "PSF_CLUMP_NY"); CHECK_STATUS (status, "PSF_CLUMP_NY"); 68 int dX = readout->image->numCols / NX; 69 int dY = readout->image->numRows / NY; 80 81 int NXuse, NYuse; 82 83 ScaleForClump = PS_MIN(ScaleForClump, PS_MAX(NX, NY)); 84 if (NX > NY) { 85 NXuse = ScaleForClump; 86 NYuse = (int) (ScaleForClump * (NY / NX) + 0.5); 87 } else { 88 NYuse = ScaleForClump; 89 NXuse = (int) (ScaleForClump * (NY / NX) + 0.5); 90 } 91 92 psLogMsg ("psphot", 4, "With %d stars, using %d x %d grid for PSF clump\n", NstarsInClump, NXuse, NYuse); 93 94 int dX = readout->image->numCols / NXuse; 95 int dY = readout->image->numRows / NYuse; 70 96 71 97 int nRegion = 0; 72 for (int ix = 0; ix < NX ; ix ++) {73 for (int iy = 0; iy < NY ; iy ++) {98 for (int ix = 0; ix < NXuse; ix ++) { 99 for (int iy = 0; iy < NYuse; iy ++) { 74 100 75 101 psRegion *region = psRegionAlloc (ix*dX, (ix + 1)*dX, iy*dY, (iy + 1)*dY); … … 181 207 return false; 182 208 } 183 psLogMsg ("psphot", 3, "psf clump X, Y: %f, %f\n", psfClump.X, psfClump.Y); 184 psLogMsg ("psphot", 3, "psf clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY); 209 psLogMsg ("psphot", 3, "psf clump X, Y: %f, %f : DX, DY: %f, %f : nStars %d of %d\n", psfClump.X, psfClump.Y, psfClump.dX, psfClump.dY, psfClump.nStars, psfClump.nTotal); 185 210 186 211 // get basic parameters, or set defaults -
branches/eam_branches/ipp-20110213/psphot/src/psphotSourceStats.c
r30866 r30883 482 482 483 483 float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN"); psAssert (status, "missing MOMENTS_SN_MIN"); 484 float PSF_SN_LIM = psMetadataLookupF32(&status, recipe, "PSF_SN_LIM"); psAssert (status, "missing PSF_SN_LIM");485 484 psF32 MOMENTS_AR_MAX = psMetadataLookupF32(&status, recipe, "MOMENTS_AR_MAX"); psAssert (status, "missing MOMENTS_AR_MAX"); 485 486 // when we set the window, we are not attempting to measure spatial variations; we can use a somewhat higher S/N limit 487 // since we are using all sources (true?) 488 float PSF_SN_LIM = 2.0*psMetadataLookupF32(&status, recipe, "PSF_SN_LIM"); psAssert (status, "missing PSF_SN_LIM"); 486 489 487 490 // XXX move this to a config file? … … 489 492 float sigma[NSIGMA] = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0}; 490 493 float Sout[NSIGMA]; 494 int Nout[NSIGMA]; // number of stars found in clump : use this to control the number of regions measured by psphotRoughClass 491 495 492 496 // this sorts by peak->SN … … 519 523 // determine the PSF parameters from the source moment values 520 524 pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_AR_MAX); 521 psLogMsg ("psphot", 3, "radius %.1f, nStars: %d , nSigma: %5.2f, X, Y: %f, %f (%f, %f)\n", sigma[i], psfClump.nStars, psfClump.nSigma, psfClump.X, psfClump.Y, sqrt(psfClump.X) / sigma[i], sqrt(psfClump.Y) / sigma[i]);525 psLogMsg ("psphot", 3, "radius %.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]); 522 526 523 527 #if 0 … … 540 544 541 545 Sout[i] = sqrt(0.5*(psfClump.X + psfClump.Y)) / sigma[i]; 546 Nout[i] = psfClump.nStars; 542 547 } 543 548 544 549 // we are looking for sigma for which Sout = 0.65 (or some other value) 550 int Nstars = 0; 545 551 float Sigma = NAN; 546 552 float minS = Sout[0]; … … 558 564 if ((Sout[i] < 0.65) && (Sout[i+1] < 0.65)) continue; 559 565 Sigma = sigma[i] + (0.65 - Sout[i])*(sigma[i+1] - sigma[i])/(Sout[i+1] - Sout[i]); 566 Nstars = 0.5*(Nout[i] + Nout[i+1]); 560 567 } 561 568 psAssert (isfinite(Sigma), "did we miss a case?"); … … 567 574 psMetadataAddF32(analysis, PS_LIST_TAIL, "MOMENTS_GAUSS_SIGMA", PS_META_REPLACE, "moments limit", Sigma); 568 575 psMetadataAddF32(analysis, PS_LIST_TAIL, "PSF_MOMENTS_RADIUS", PS_META_REPLACE, "moments limit", 4.0*Sigma); 576 psMetadataAddF32(analysis, PS_LIST_TAIL, "PSF_CLUMP_NSTARS", PS_META_REPLACE, "number of stars in clump", Nstars); 569 577 570 578 psLogMsg ("psphot", 3, "using window function with sigma = %f\n", Sigma); -
branches/eam_branches/ipp-20110213/psphot/src/psphotVisual.c
r30764 r30883 350 350 } 351 351 352 // requires psphotVisualShowImage 353 bool psphotVisualShowSources (psArray *sources) { 354 355 int Noverlay; 356 KiiOverlay *overlay; 357 358 if (!pmVisualTestLevel("psphot.objects.sources", 1)) return true; 359 360 int kapa = psphotKapaChannel (1); 361 if (kapa == -1) return false; 362 363 // note: this uses the Ohana allocation tools: 364 // ALLOCATE (overlay, KiiOverlay, 3*peaks->n + 1); 365 ALLOCATE (overlay, KiiOverlay, sources->n + 2); 366 367 Noverlay = 0; 368 for (int i = 0; i < sources->n; i++) { 369 370 pmSource *source = sources->data[i]; 371 if (!source) continue; 372 373 pmPeak *peak = source->peak; 374 if (!peak) continue; 375 376 overlay[Noverlay].type = KII_OVERLAY_BOX; 377 overlay[Noverlay].x = peak->xf; 378 overlay[Noverlay].y = peak->yf; 379 overlay[Noverlay].dx = 4.0; 380 overlay[Noverlay].dy = 4.0; 381 overlay[Noverlay].angle = 0.0; 382 overlay[Noverlay].text = NULL; 383 Noverlay ++; 384 } 385 386 KiiLoadOverlay (kapa, overlay, Noverlay, "blue"); 387 FREE (overlay); 388 389 pmVisualAskUser(NULL); 390 return true; 391 } 392 352 393 // XXX : requires psphotVisualShowImage 353 394 bool psphotVisualShowPeaks (pmDetections *detections) {
Note:
See TracChangeset
for help on using the changeset viewer.
