Changeset 18555 for trunk/psphot/src/psphotSourceFits.c
- Timestamp:
- Jul 15, 2008, 10:25:50 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSourceFits.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSourceFits.c
r17396 r18555 21 21 } 22 22 23 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal ) {23 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal) { 24 24 25 25 float x, y, dR; 26 27 // maskVal is used to test for rejected pixels, and must include markVal 28 maskVal |= markVal; 26 29 27 30 // if this source is not a possible blend, just fit as PSF 28 31 if ((source->blends == NULL) || (source->mode & PM_SOURCE_MODE_SATSTAR)) { 29 bool status = psphotFitPSF (readout, source, psf, maskVal );32 bool status = psphotFitPSF (readout, source, psf, maskVal, markVal); 30 33 return status; 31 34 } … … 80 83 81 84 // extend source radius as needed 82 psphotCheckRadiusPSFBlend (readout, source, PSF, dR);85 psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, dR); 83 86 84 87 // fit PSF model (set/unset the pixel mask) … … 139 142 } 140 143 141 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal ) {144 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, psMaskType maskVal, psMaskType markVal) { 142 145 143 146 double chiTrend; 147 148 // maskVal is used to test for rejected pixels, and must include markVal 149 maskVal |= markVal; 144 150 145 151 NfitPSF ++; … … 150 156 151 157 // extend source radius as needed 152 psphotCheckRadiusPSF (readout, source, PSF );158 psphotCheckRadiusPSF (readout, source, PSF, markVal); 153 159 154 160 // fit PSF model (set/unset the pixel mask) … … 197 203 } 198 204 199 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal ) {205 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, psMaskType maskVal, psMaskType markVal) { 200 206 201 207 bool okEXT, okDBL; … … 215 221 psTrace ("psphot", 5, "trying blob...\n"); 216 222 217 // psTraceSetLevel("psModules.objects.pmSourceFitSet", 5); 223 // maskVal is used to test for rejected pixels, and must include markVal 224 maskVal |= markVal; 218 225 219 226 // this temporary source is used as a place-holder by the psphotEval functions below 220 227 pmSource *tmpSrc = pmSourceAlloc (); 221 228 222 pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal );229 pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal); 223 230 okEXT = psphotEvalEXT (tmpSrc, EXT); 224 231 chiEXT = EXT->chisq / EXT->nDOF; 225 232 226 psArray *DBL = psphotFitDBL (readout, source, maskVal );233 psArray *DBL = psphotFitDBL (readout, source, maskVal, markVal); 227 234 okDBL = psphotEvalDBL (tmpSrc, DBL->data[0]); 228 235 okDBL &= psphotEvalDBL (tmpSrc, DBL->data[1]); … … 306 313 307 314 // fit a double PSF source to an extended blob 308 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal ) {315 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, psMaskType maskVal, psMaskType markVal) { 309 316 310 317 float dx, dy; … … 317 324 NfitDBL ++; 318 325 326 // maskVal is used to test for rejected pixels, and must include markVal 327 maskVal |= markVal; 328 319 329 // make a guess at the position of the two sources 320 330 moments.x2 = source->moments->Sx; … … 329 339 // save the PSF model from the Ensemble fit 330 340 PSF = source->modelPSF; 331 psphotCheckRadiusPSFBlend (readout, source, PSF, 8.0);341 psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0); 332 342 if (isnan(PSF->params->data.F32[1])) psAbort("nan in dbl fit"); 333 343 … … 351 361 } 352 362 353 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal ) {363 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psMaskType maskVal, psMaskType markVal) { 354 364 355 365 NfitEXT ++; 366 367 // maskVal is used to test for rejected pixels, and must include markVal 368 maskVal |= markVal; 356 369 357 370 // use the source moments, etc to guess basic model parameters … … 361 374 // if (isnan(EXT->params->data.F32[1])) psAbort("nan in ext fit"); 362 375 363 psphotCheckRadiusEXT (readout, source, EXT );376 psphotCheckRadiusEXT (readout, source, EXT, markVal); 364 377 365 378 if ((source->moments->Sx < 1e-3) || (source->moments->Sx < 1e-3)) {
Note:
See TracChangeset
for help on using the changeset viewer.
