Changeset 32241
- Timestamp:
- Aug 31, 2011, 12:44:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110710/psphot/src/psphotSourceFits.c
r32157 r32241 217 217 pmModel *EXT = NULL; 218 218 psArray *DBL = NULL; 219 pmMoments psfMoments;219 // pmMoments psfMoments; 220 220 221 221 // skip the source if we don't think it is extended … … 225 225 if (source->type == PM_SOURCE_TYPE_SATURATED) return false; 226 226 227 # define TEST_X - 540.0228 # define TEST_Y 540.0227 # define TEST_X -420.0 228 # define TEST_Y 300.0 229 229 230 230 if ((fabs(source->peak->xf - TEST_X) < 5) && (fabs(source->peak->yf - TEST_Y) < 5)) { … … 238 238 if (!psphotSetRadiusMoments(&fitRadius, &windowRadius, readout, source, markVal)) return false; 239 239 // fprintf (stderr, "rad: %6.1f %6.1f | %5.2f %5.2f %5.2f ", source->peak->xf, source->peak->yf, source->moments->Mrf, fitRadius, windowRadius); 240 241 // XXX note that this changes the source moments that are published...242 // XXX all published moments should use the same measurement243 // recalculate the source moments using the larger extended-source moments radius244 // at this stage, skip Gaussian windowing, and do not clip pixels by S/N245 // this uses the footprint to judge both radius and aperture?246 // XXX save the psf-based moments for output247 // XXX do not limit to pixels in the marked circle248 psfMoments = *source->moments;249 if (!pmSourceMoments (source, windowRadius, 0.0, 0.5, 0.0, maskVal & PS_NOT_IMAGE_MASK(markVal))) {250 *source->moments = psfMoments;251 fprintf (stderr, "skip (bad moments)\n");252 return false;253 }254 // fprintf (stderr, "r1: %f\n", source->moments->Mrf);255 256 // XXX note that we do not re-try to measure the moments if the resulting Mrf is large compared257 // to the initial value258 240 259 241 psTrace ("psphot", 5, "trying blob...\n"); … … 312 294 313 295 if (okEXT && okDBL) { 314 psTrace ("psphot", 5, "blob chisq: %f vs %f\n", chiEXT, chiDBL);315 296 // XXX EAM : a bogus bias: need to examine this better 316 297 if (3*chiEXT > chiDBL) goto keepDBL; … … 321 302 if (!okEXT && okDBL) goto keepDBL; 322 303 304 psTrace ("psphot", 4, "both failed: blob chisq: %f vs %f for %f,%f\n", chiEXT, chiDBL, source->peak->xf, source->peak->yf); 305 323 306 // both models failed; reject them both 324 307 // XXX -- change type flags to psf in this case, and make sure we subtract it? 325 308 // reset the psf moments 326 *source->moments = psfMoments;309 // XXX *source->moments = psfMoments; 327 310 328 311 psFree (EXT); … … 331 314 332 315 keepEXT: 316 psTrace ("psphot", 4, "goto EXT : blob chisq: %f vs %f for %f,%f\n", chiEXT, chiDBL, source->peak->xf, source->peak->yf); 333 317 // sub EXT 334 318 psFree (DBL); … … 356 340 357 341 // reset the psf moments 358 *source->moments = psfMoments;342 // XXX *source->moments = psfMoments; 359 343 return true; 360 344 361 345 keepDBL: 346 psTrace ("psphot", 4, "goto DBL : blob chisq: %f vs %f for %f,%f\n", chiEXT, chiDBL, source->peak->xf, source->peak->yf); 362 347 // sub DLB 363 348 psFree (EXT); … … 390 375 psLogMsg ("psphot", 1, "PAR %d : %f +/- %f\n", i, source->modelPSF->params->data.F32[i], source->modelPSF->dparams->data.F32[i]); 391 376 } 392 psphotVisualShowResidualImage (readout, false);393 377 } 394 378 # endif 395 396 // reset the (original) psf moments397 *source->moments = psfMoments;398 *newSrc->moments = psfMoments;399 379 400 380 psArrayAdd (newSources, 100, newSrc); … … 404 384 405 385 escape: 406 // reset the psf moments407 *source->moments = psfMoments;408 386 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 409 387 psFree (tmpSrc); … … 506 484 pmSourceFitModel (source, model, &options, maskVal); 507 485 // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix); 508 509 486 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0); 487 510 488 return (model); 511 489 }
Note:
See TracChangeset
for help on using the changeset viewer.
