- Timestamp:
- Sep 23, 2009, 11:16:52 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psModules/src/objects/pmPSFtryFitPSF.c
r25476 r25496 67 67 continue; 68 68 } 69 source->modelPSF->radiusFit = options->radius; 70 // XXXX use a different radius for the aperture magnitude than for the PSF fit? 69 // PSF fit and aperture mags use different radii 70 source->modelPSF->fitRadius = options->fitRadius; 71 source->apRadius = options->apRadius; 71 72 72 // set object mask to define valid pixels 73 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options-> radius, "OR", markVal);73 // set object mask to define valid pixels for PSF model fit 74 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->fitRadius, "OR", markVal); 74 75 75 76 // fit the PSF model to the source … … 78 79 // skip poor fits 79 80 if (!status) { 80 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options-> radius, "AND", PS_NOT_IMAGE_MASK(markVal));81 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->fitRadius, "AND", PS_NOT_IMAGE_MASK(markVal)); 81 82 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_PSF_FAIL; 82 83 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y); … … 84 85 } 85 86 86 // XXX this function calculates the aperture magnitude, but we now use the moments->Sum as the flux 87 // set object mask to define valid pixels for APERTURE magnitude 88 if (options->fitRadius < options->apRadius) { 89 // this is not really a recommended situation... 90 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->fitRadius, "AND", PS_NOT_IMAGE_MASK(markVal)); 91 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->apRadius, "OR", markVal); 92 } 93 if (options->fitRadius > options->apRadius) { 94 // ensure the aperture is defined 95 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->apRadius, "OR", markVal); 96 } 97 98 // This function calculates the psf and aperture magnitudes 87 99 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal); 88 100 if (!status || isnan(source->apMag)) { 89 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options-> radius, "AND", PS_NOT_IMAGE_MASK(markVal));101 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->apRadius, "AND", PS_NOT_IMAGE_MASK(markVal)); 90 102 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_BAD_PHOT; 91 103 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y); … … 94 106 95 107 // clear object mask to define valid pixels 96 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options-> radius, "AND", PS_NOT_IMAGE_MASK(markVal));108 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->apRadius, "AND", PS_NOT_IMAGE_MASK(markVal)); 97 109 98 110 psfTry->fitMag->data.F32[i] = source->psfMag; 99 psfTry->metric->data.F32[i] = -2.5*log10(source->moments->Sum) - source->psfMag; 111 // psfTry->metric->data.F32[i] = -2.5*log10(source->moments->Sum) - source->psfMag; 112 psfTry->metric->data.F32[i] = source->apMag - source->psfMag; 100 113 psfTry->metricErr->data.F32[i] = source->errMag; 101 114 … … 104 117 } 105 118 psfTry->psf->nPSFstars = Npsf; 119 120 // XXX test code: 121 pmSourceVisualShowModelFits (psfTry->psf, psfTry->sources, maskVal); 106 122 107 123 psLogMsg ("psphot.psftry", PS_LOG_MINUTIA, "fit psf: %f sec for %d of %ld sources\n", psTimerMark ("psf.fit"), Npsf, psfTry->sources->n);
Note:
See TracChangeset
for help on using the changeset viewer.
