Changeset 28677
- Timestamp:
- Jul 15, 2010, 6:31:24 AM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100621/psphot/src
- Files:
-
- 3 edited
-
psphotChoosePSF.c (modified) (2 diffs)
-
psphotSourceFits.c (modified) (3 diffs)
-
psphotSourceSize.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psphot/src/psphotChoosePSF.c
r28657 r28677 244 244 245 245 // try each model option listed in config 246 // pmPSFtryModel makes a local copy of the sources -- those points are not the same as those for 'sources' 246 247 for (int i = 0; i < modelNames->n; i++) { 247 248 char *modelName = modelNames->data[i]; … … 321 322 322 323 // unset the PSFSTAR flag for stars not used for PSF model 324 // XXX a more efficient way of achieving this would be to record a pair of arrays 325 // of the source index and the source id for the psf stars. but that would require we do 326 // not re-sort the source list in the meanwhile 327 int nDrop = 0; 323 328 for (int i = 0; i < try->sources->n; i++) { 324 329 pmSource *source = try->sources->data[i]; 325 330 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 326 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 327 } 328 } 331 // need to find this source in the original list (these are copies, not pointers) 332 for (int j = 0; j < sources->n; j++) { 333 pmSource *realSource = sources->data[j]; 334 if (realSource->id != source->id) continue; 335 realSource->mode &= ~PM_SOURCE_MODE_PSFSTAR; 336 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 337 nDrop ++; 338 break; 339 } 340 } 341 } 342 // fprintf (stderr, "drop %d stars as PSF stars\n", nDrop); 343 344 // XXX is this working? 345 // int N1 = 0; 346 // for (int i = 0; i < try->sources->n; i++) { 347 // pmSource *source = try->sources->data[i]; 348 // fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR)); 349 // if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 350 // N1 ++; 351 // } 352 // } 353 // int N2 = 0; 354 // for (int i = 0; i < sources->n; i++) { 355 // pmSource *source = sources->data[i]; 356 // fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR)); 357 // if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 358 // N2 ++; 359 // } 360 // } 361 // fprintf (stderr, "N1: %d, N2: %d\n", N1, N2); 329 362 330 363 // build a PSF residual image -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceFits.c
r28657 r28677 345 345 346 346 // copy most data from the primary source (modelEXT, blends stay NULL) 347 pmSource *newSrc = pmSourceCopy (source);347 pmSource *newSrc = pmSourceCopyData (source); 348 348 newSrc->modelPSF = psMemIncrRefCounter (DBL->data[1]); 349 349 newSrc->modelPSF->fitRadius = radius; … … 447 447 maskVal |= markVal; 448 448 449 psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5);449 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5); 450 450 451 451 // use the source moments, etc to guess basic model parameters … … 460 460 } 461 461 462 // for sersic models, get the initial guess more carefully462 // for sersic models, use a grid search to choose an index, then float the params there 463 463 if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { 464 464 psphotFitSersicIndex (source, EXT, fitOptions, maskVal); 465 465 } 466 466 467 // fit EXT (not PSF) model (set/unset the pixel mask) 468 options.mode = PM_SOURCE_FIT_EXT; 467 if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { 468 options.mode = PM_SOURCE_FIT_NO_INDEX; 469 } else { 470 options.mode = PM_SOURCE_FIT_EXT; 471 } 469 472 pmSourceFitModel (source, EXT, &options, maskVal); 470 473 471 psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0);474 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0); 472 475 return (EXT); 473 476 } 474 477 475 float indexGuess[] = {0.5, 0.25, 0.125}; 478 // note that these should be 1/2n of the standard sersic index 479 float indexGuess[] = {0.5, 0.33, 0.25, 0.167, 0.125, 0.083}; 476 480 477 481 // A sersic model is very sensitive to the index. attempt to find the index first by grid search in just the index -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceSize.c
r28643 r28677 364 364 float nSigmaMYY = (Myy - psfClump->Y) / hypot(psfClump->dY, psfClump->Y*psfClump->Y*source->errMag); 365 365 366 fprintf (stderr, " Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f\n",367 Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My,366 fprintf (stderr, "%f %f : Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f\n", 367 source->peak->xf, source->peak->yf, Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My, 368 368 source->psfMag, apMag, dMag, source->errMag, nSigmaMAG); 369 369
Note:
See TracChangeset
for help on using the changeset viewer.
