Changeset 25755 for trunk/psphot/src/psphotChoosePSF.c
- Timestamp:
- Oct 2, 2009, 3:12:47 PM (17 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psphotChoosePSF.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src
- Property svn:ignore
-
old new 18 18 psphotVersionDefinitions.h 19 19 psphotMomentsStudy 20 psphotPetrosianStudy
-
- Property svn:ignore
-
trunk/psphot/src/psphotChoosePSF.c
r23989 r25755 1 1 # include "psphotInternal.h" 2 3 void psphotCountPSFStars (psArray *sources) {4 5 int nPSF = 0;6 7 // select the candidate PSF stars (pointers to original sources)8 for (int i = 0; i < sources->n; i++) {9 pmSource *source = sources->data[i];10 if (source->mode & PM_SOURCE_MODE_PSFSTAR) {11 nPSF ++;12 }13 }14 15 fprintf (stderr, "N PSF: %d\n", nPSF);16 }17 2 18 3 // try PSF models and select best option … … 73 58 // get the fixed PSF fit radius 74 59 // XXX check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS 75 options->radius = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS"); 76 assert (status); 60 // options->radius = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS"); 61 // assert (status); 62 63 // We have calculated a Gaussian window function, use that for both the PSF fit radius and 64 // the aperture radius (scaling SIGMA) 65 float gaussSigma = psMetadataLookupF32(&status, recipe, "MOMENTS_GAUSS_SIGMA"); 66 float fitScale = psMetadataLookupF32(&status, recipe, "PSF_FIT_RADIUS_SCALE"); 67 float apScale = psMetadataLookupF32(&status, recipe, "PSF_APERTURE_SCALE"); 68 options->fitRadius = (int)(fitScale*gaussSigma); 69 options->apRadius = (int)(apScale*gaussSigma); 70 71 // XXX use the same radii for standard analysis as for the PSF creation 72 psMetadataAddF32(recipe, PS_LIST_TAIL, "PSF_FIT_RADIUS", PS_META_REPLACE, "fit radius", options->fitRadius); 73 psMetadataAddF32(recipe, PS_LIST_TAIL, "PSF_APERTURE", PS_META_REPLACE, "psf aperture", options->apRadius); 77 74 78 75 // XXX ROBUST seems to be too agressive given the small numbers. … … 99 96 100 97 psArray *stars = psArrayAllocEmpty (sources->n); 101 102 // psphotCountPSFStars (sources);103 98 104 99 // select the candidate PSF stars (pointers to original sources) … … 115 110 } 116 111 117 // psphotCountPSFStars (sources);118 119 112 // check that the identified psf stars sufficiently cover the region; if not, extend the 120 113 // limits somewhat 121 114 psphotCheckStarDistribution (stars, sources, options); 122 123 // psphotCountPSFStars (sources);124 115 125 116 psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n); … … 289 280 // XXX test dump of psf star data and psf-subtracted image 290 281 if (psTraceGetLevel("psphot.psfstars") > 5) { 291 psphotDumpPSFStars (readout, try, options-> radius, maskVal, markVal);282 psphotDumpPSFStars (readout, try, options->fitRadius, maskVal, markVal); 292 283 } 293 284 294 285 // save only the best model; 295 // XXX we are not saving the fitted sources296 // XXX do we want to keep them so we may optionally write them out?297 286 pmPSF *psf = psMemIncrRefCounter(try->psf); 298 287 psFree (models); … … 305 294 } 306 295 307 // psphotCountPSFStars (sources);308 309 296 char *modelName = pmModelClassGetName (psf->type); 310 297 psLogMsg ("psphot.pspsf", PS_LOG_INFO, "select psf model: %f sec\n", psTimerMark ("psphot.choose.psf")); … … 341 328 // create modelPSF from this model 342 329 pmModel *modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0); 343 if (!modelPSF) continue; 330 if (!modelPSF) { 331 fprintf (stderr, "?"); 332 continue; 333 } 344 334 345 335 // get the model full-width at half-max … … 354 344 355 345 float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major); 356 if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) continue; 346 if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) { 347 fprintf (stderr, "!"); 348 continue; 349 } 357 350 psVectorAppend (fwhmMajor, FWHM_MAJOR); 358 351 psVectorAppend (fwhmMinor, FWHM_MINOR);
Note:
See TracChangeset
for help on using the changeset viewer.
