- Timestamp:
- Sep 17, 2009, 2:26:32 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotSourceFits.c
r24592 r25433 223 223 if (source->peak->SN < EXT_MIN_SN) return false; 224 224 225 float radius = psphotSetRadiusEXT (readout, source, markVal); 226 227 // XXX note that this changes the source moments that are published... 225 228 // recalculate the source moments using the larger extended-source moments radius 226 229 // at this stage, skip Gaussian windowing, and do not clip pixels by S/N 227 if (!pmSourceMoments (source, EXT_MOMENTS_RAD, 0.0, 0.0)) return false; 230 // XXX use the deteremined value of PSF_MOMENTS_RADIUS and SIGMA and scale up? 231 // XXX increase the moments radius iteratively until the measured sigma / input < f? 232 // XXX use the footprint somehow to judge both radius and aperture? 233 if (!pmSourceMoments (source, radius, 0.0, 0.0)) return false; 228 234 229 235 psTrace ("psphot", 5, "trying blob...\n"); … … 277 283 278 284 // both models failed; reject them both 285 // XXX -- change type flags to psf in this case and keep original moments? 279 286 psFree (EXT); 280 287 psFree (DBL); … … 287 294 // save new model 288 295 source->modelEXT = EXT; 296 source->modelEXT->radiusFit = radius; 289 297 source->type = PM_SOURCE_TYPE_EXTENDED; 290 298 source->mode |= PM_SOURCE_MODE_EXTMODEL; … … 294 302 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 295 303 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 304 305 # if (PS_TRACE_ON) 296 306 psTrace ("psphot", 5, "blob as EXT: %f %f\n", EXT->params->data.F32[PM_PAR_XPOS], EXT->params->data.F32[PM_PAR_YPOS]); 307 if (psTraceGetLevel("psphot") >= 6) { 308 psLogMsg ("psphot", 1, "source 2:\n"); 309 for (int i = 0; i < source->modelEXT->params->n; i++) { 310 psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, source->modelEXT->params->data.F32[i], source->modelEXT->dparams->data.F32[i]); 311 } 312 } 313 # endif 314 297 315 return true; 298 316 … … 306 324 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 307 325 source->mode |= PM_SOURCE_MODE_PAIR; 326 source->modelPSF->radiusFit = radius; 308 327 309 328 // copy most data from the primary source (modelEXT, blends stay NULL) 310 // XXX use pmSourceCopy?311 329 pmSource *newSrc = pmSourceCopy (source); 312 330 newSrc->modelPSF = psMemIncrRefCounter (DBL->data[1]); 331 newSrc->modelPSF->radiusFit = radius; 313 332 314 333 // build cached models and subtract … … 317 336 pmSourceCacheModel (newSrc, maskVal); 318 337 pmSourceSub (newSrc, PM_MODEL_OP_FULL, maskVal); 338 339 # if (PS_TRACE_ON) 319 340 psTrace ("psphot", 5, "blob as DBL: %f %f\n", ONE->params->data.F32[PM_PAR_XPOS], ONE->params->data.F32[PM_PAR_YPOS]); 341 if (psTraceGetLevel("psphot") >= 6) { 342 psLogMsg ("psphot", 1, "source 1:\n"); 343 for (int i = 0; i < newSrc->modelPSF->params->n; i++) { 344 psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, newSrc->modelPSF->params->data.F32[i], newSrc->modelPSF->dparams->data.F32[i]); 345 } 346 psLogMsg ("psphot", 1, "source 2:\n"); 347 for (int i = 0; i < source->modelPSF->params->n; i++) { 348 psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, source->modelPSF->params->data.F32[i], source->modelPSF->dparams->data.F32[i]); 349 } 350 psphotVisualShowResidualImage (readout); 351 } 352 # endif 320 353 321 354 psArrayAdd (newSources, 100, newSrc); … … 356 389 // save the PSF model from the Ensemble fit 357 390 PSF = source->modelPSF; 358 psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0);391 // psphotCheckRadiusPSFBlend (readout, source, PSF, markVal, 8.0); 359 392 if (isnan(PSF->params->data.F32[1])) psAbort("nan in dbl fit"); 360 393 … … 390 423 391 424 // if (isnan(EXT->params->data.F32[1])) psAbort("nan in ext fit"); 392 393 psphotCheckRadiusEXT (readout, source, EXT, markVal); 425 // psphotCheckRadiusEXT (readout, source, EXT, markVal); 394 426 395 427 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) { … … 401 433 return (EXT); 402 434 } 403
Note:
See TracChangeset
for help on using the changeset viewer.
