Changeset 24317
- Timestamp:
- Jun 3, 2009, 5:51:01 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSource.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSource.c
r23989 r24317 480 480 481 481 if (!psVectorStats (stats, tmpSx, NULL, NULL, 0)) { 482 psError(PS_ERR_UNKNOWN, false, "failed to measure Sx stats");482 psError(PS_ERR_UNKNOWN, false, "failed to measure Sx stats"); 483 483 return (emptyClump); 484 }484 } 485 485 psfClump.X = stats->clippedMean; 486 486 psfClump.dX = stats->clippedStdev; 487 487 488 488 if (!psVectorStats (stats, tmpSy, NULL, NULL, 0)) { 489 psError(PS_ERR_UNKNOWN, false, "failed to measure Sy stats");489 psError(PS_ERR_UNKNOWN, false, "failed to measure Sy stats"); 490 490 return (emptyClump); 491 }491 } 492 492 psfClump.Y = stats->clippedMean; 493 493 psfClump.dY = stats->clippedStdev; … … 549 549 pmSource *source = (pmSource *) sources->data[i]; 550 550 551 // psf clumps are found for image subregions:552 // skip sources not in this region 551 // psf clumps are found for image subregions: 552 // skip sources not in this region 553 553 if (source->peak->x < region->x0) continue; 554 554 if (source->peak->x >= region->x1) continue; 555 555 if (source->peak->y < region->y0) continue; 556 if (source->peak->y >= region->y1) continue;557 558 // should be set by pmSourceAlloc556 if (source->peak->y >= region->y1) continue; 557 558 // should be set by pmSourceAlloc 559 559 psAssert (source->type == PM_SOURCE_TYPE_UNKNOWN, "source type was not init-ed?"); 560 560 … … 562 562 if (!source->moments) { 563 563 source->type = PM_SOURCE_TYPE_STAR; 564 psAssert (source->mode & noMoments, "why is this source missing moments?");564 psAssert (source->mode & noMoments, "why is this source missing moments?"); 565 565 Nstar++; 566 566 continue; … … 596 596 } 597 597 598 // likely defect (too small to be stellar) (push out to 3 sigma) 599 // low S/N objects which are small are probably stellar 600 // only set candidate defects if 601 // XXX these limits are quite arbitrary 602 if ((sigX < 0.05) || (sigY < 0.05)) { 603 source->type = PM_SOURCE_TYPE_DEFECT; 604 source->mode |= PM_SOURCE_MODE_DEFECT; 605 Ncr ++; 606 continue; 607 } 608 609 // likely unsaturated extended source (too large to be stellar) 610 if ((sigX > (clump.X + 3*clump.dX)) || (sigY > (clump.Y + 3*clump.dY))) { 611 source->type = PM_SOURCE_TYPE_EXTENDED; 612 Next ++; 613 continue; 614 } 615 616 // the rest are probable stellar objects 617 starsn_moments->data.F32[starsn_moments->n] = source->moments->SN; 618 starsn_moments->n ++; 619 starsn_peaks->data.F32[starsn_peaks->n] = source->peak->SN; 620 starsn_peaks->n ++; 621 Nstar ++; 622 623 // PSF star (within 1.5 sigma of clump center, S/N > limit) 624 psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY); 625 if ((source->moments->SN > PSF_SN_LIM) && (radius < PSF_CLUMP_NSIGMA)) { 626 source->type = PM_SOURCE_TYPE_STAR; 627 source->mode |= PM_SOURCE_MODE_PSFSTAR; 628 Npsf ++; 629 continue; 598 // The following determinations require the use of moments 599 if (!(source->mode & noMoments)) { 600 // likely defect (too small to be stellar) (push out to 3 sigma) 601 // low S/N objects which are small are probably stellar 602 // XXX these limits are quite arbitrary 603 if (sigX < 0.05 || sigY < 0.05) { 604 source->type = PM_SOURCE_TYPE_DEFECT; 605 source->mode |= PM_SOURCE_MODE_DEFECT; 606 Ncr ++; 607 continue; 608 } 609 610 // likely unsaturated extended source (too large to be stellar) 611 if (sigX > clump.X + 3*clump.dX || sigY > clump.Y + 3*clump.dY) { 612 source->type = PM_SOURCE_TYPE_EXTENDED; 613 Next ++; 614 continue; 615 } 616 617 // the rest are probable stellar objects 618 starsn_moments->data.F32[starsn_moments->n] = source->moments->SN; 619 starsn_moments->n ++; 620 starsn_peaks->data.F32[starsn_peaks->n] = source->peak->SN; 621 starsn_peaks->n ++; 622 Nstar ++; 623 624 // PSF star (within 1.5 sigma of clump center, S/N > limit) 625 psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY); 626 if ((source->moments->SN > PSF_SN_LIM) && (radius < PSF_CLUMP_NSIGMA)) { 627 source->type = PM_SOURCE_TYPE_STAR; 628 source->mode |= PM_SOURCE_MODE_PSFSTAR; 629 Npsf ++; 630 continue; 631 } 630 632 } 631 633 … … 642 644 643 645 if (!psVectorStats (stats, starsn_moments, NULL, NULL, 0)) { 644 psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats");645 psFree (stats);646 psFree (starsn_peaks);647 return false;646 psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats"); 647 psFree (stats); 648 psFree (starsn_peaks); 649 return false; 648 650 } 649 651 psLogMsg ("pmObjects", 3, "SN range (moments): %f - %f\n", stats->min, stats->max); … … 656 658 stats = psStatsAlloc (PS_STAT_MIN | PS_STAT_MAX); 657 659 if (!psVectorStats (stats, starsn_peaks, NULL, NULL, 0)) { 658 psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats");659 psFree (stats);660 psFree (starsn_peaks);661 return false;660 psError(PS_ERR_UNKNOWN, false, "failed to measure SN / moments stats"); 661 psFree (stats); 662 psFree (starsn_peaks); 663 return false; 662 664 } 663 665 psLogMsg ("psModules.objects", 3, "SN range (peaks) : %f - %f (%ld)\n",
Note:
See TracChangeset
for help on using the changeset viewer.
