Changeset 31154 for trunk/psphot/src/psphotMergeSources.c
- Timestamp:
- Apr 4, 2011, 1:12:39 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 2 edited
-
. (modified) (2 props)
-
src/psphotMergeSources.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:ignore
-
old new 19 19 psphot-config 20 20 Doxyfile 21 a.out.dSYM
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
trunk/psphot/src/psphotMergeSources.c
r30624 r31154 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 … … 110 111 111 112 // the supplied peak flux needs to be re-normalized 112 source->peak->flux = 1.0; 113 source->peak->value = 1.0; 113 source->peak->rawFlux = 1.0; 114 source->peak->smoothFlux = 1.0; 115 source->peak->detValue = 1.0; 114 116 115 117 // drop the loaded source modelPSF … … 281 283 for (int i = 0; i < sources->n; i++) { 282 284 pmSource *source = sources->data[i]; 283 source->peak->flux = source->moments->Peak; 285 source->peak->rawFlux = source->moments->Peak; 286 source->peak->smoothFlux = source->moments->Peak; 284 287 } 285 288 … … 331 334 float ypos = model->params->data.F32[PM_PAR_YPOS]; 332 335 333 pmPeak *peak = pmPeakAlloc(xpos, ypos, 1.0, PM_PEAK_LONE);336 pmPeak *peak = pmPeakAlloc(xpos, ypos, flux, PM_PEAK_LONE); 334 337 peak->xf = xpos; 335 338 peak->yf = ypos; 336 peak->flux = flux; // this are being set wrong, but does it matter?337 338 if (isfinite (source->errMag) && (source->errMag > 0.0)) {339 peak->SN = 1.0 / source->errMag;340 } else {341 peak->SN = 0.0;342 }343 339 344 340 psArrayAdd (detections->peaks, 100, peak); … … 347 343 348 344 psLogMsg ("psphot", 3, "%ld PSF sources loaded", detections->peaks->n); 345 psphotVisualShowSources (sources); 346 psphotVisualShowPeaks (detections); 349 347 350 348 // save detections on the readout->analysis … … 354 352 } 355 353 psFree (detections); 354 356 355 return true; 357 356 } 358 357 359 358 // generate the detection structure for the supplied array of sources 359 // XXX this function is currently unused 360 360 bool psphotSetSourceParams (pmConfig *config, psArray *sources, pmPSF *psf) { 361 361 … … 378 378 float ypos = model->params->data.F32[PM_PAR_YPOS]; 379 379 380 pmPeak *peak = pmPeakAlloc(xpos, ypos, 1.0, PM_PEAK_LONE);380 pmPeak *peak = pmPeakAlloc(xpos, ypos, flux, PM_PEAK_LONE); 381 381 peak->xf = xpos; 382 382 peak->yf = ypos; 383 peak->flux = flux; // this are being set wrong, but does it matter? 384 385 if (isfinite (source->errMag) && (source->errMag > 0.0)) { 386 peak->SN = 1.0 / source->errMag; 387 } else { 388 peak->SN = 0.0; 389 } 383 peak->rawFlux = flux; // this are being set wrong, but does it matter? 384 peak->smoothFlux = flux; // this are being set wrong, but does it matter? 390 385 391 386 source->peak = peak; … … 613 608 614 609 // allocate image, weight, mask for the new image for each peak 615 pmSourceRedefinePixels (sourceOut, readoutOut, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius); 610 if (sourceOut->modelPSF) { 611 pmSourceRedefinePixels (sourceOut, readoutOut, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius); 612 } 616 613 617 614 // child sources have not been subtracted in this image, but this flag may be raised if … … 679 676 objectsOut->data[k] = objectOut; 680 677 681 objectOut-> SN = objectSrc->SN;682 objectOut->x = objectSrc->x;683 objectOut->y = objectSrc->y;678 objectOut->flux = objectSrc->flux; 679 objectOut->x = objectSrc->x; 680 objectOut->y = objectSrc->y; 684 681 685 682 objectOut->sources = psArrayAlloc(objectSrc->sources->n); … … 697 694 sourceOut->parent = sourceSrc; 698 695 699 // keep the original source flags 696 // keep the original source flags and sequence ID (if set) 697 sourceOut->seq = sourceSrc->seq; 700 698 sourceOut->type = sourceSrc->type; 701 699 sourceOut->mode = sourceSrc->mode; … … 723 721 724 722 // allocate image, weight, mask for the new image for each peak 725 pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius); 723 if (sourceOut->modelPSF) { 724 pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius); 725 } 726 726 727 727 // child sources have not been subtracted in this image, but this flag may be raised if
Note:
See TracChangeset
for help on using the changeset viewer.
