Changeset 28692 for branches/eam_branches/ipp-20100621/psphot
- Timestamp:
- Jul 20, 2010, 7:21:53 PM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100621/psphot/src
- Files:
-
- 6 edited
-
Makefile.am (modified) (1 diff)
-
psphot.h (modified) (3 diffs)
-
psphotApResid.c (modified) (1 diff)
-
psphotMagnitudes.c (modified) (1 diff)
-
psphotSourceFits.c (modified) (9 diffs)
-
psphotSourceSize.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psphot/src/Makefile.am
r28683 r28692 168 168 psphotExtendedSourceFits.c \ 169 169 psphotKernelFromPSF.c \ 170 psphotPSFConvModel.c \171 170 psphotFitSet.c \ 172 171 psphotSourceFreePixels.c \ -
branches/eam_branches/ipp-20100621/psphot/src/psphot.h
r28643 r28692 12 12 13 13 #define PSPHOT_RECIPE_PSF_FAKE_ALLOW "PSF.FAKE.ALLOW" // Name for recipe component permitting fake PSFs 14 15 // pmPCMData : PSF Convolved Model data storage structure16 typedef struct {17 psImage *model;18 psArray *dmodels;19 psImage *modelConv;20 psArray *dmodelsConv;21 } pmPCMData;22 14 23 15 // top-level psphot functions … … 293 285 bool psphotRadialBins (psMetadata *recipe, pmSource *source, float radiusMax, float skynoise); 294 286 295 // structures & functions to support psf-convolved model fitting296 297 // psf-convolved model fitting298 bool psphotModelWithPSF_LMM (299 psMinimization *min,300 psImage *covar,301 psVector *params,302 psMinConstraint *constraint,303 pmSource *source,304 const psKernel *psf,305 psMinimizeLMChi2Func func);306 307 psF32 psphotModelWithPSF_SetABX(308 psImage *alpha,309 psVector *beta,310 const psVector *params,311 const psVector *paramMask,312 pmPCMData *pcm,313 const pmSource *source,314 const psKernel *psf,315 psMinimizeLMChi2Func func);316 317 pmPCMData *pmPCMDataAlloc (318 const psVector *params,319 const psVector *paramMask,320 pmSource *source);321 322 psImage *pmPCMDataSaveImage (pmPCMData *pcm);323 324 287 int psphotKapaOpen (void); 325 288 bool psphotKapaClose (void); … … 463 426 bool psphotStackObjectsUnifyPosition (psArray *objects); 464 427 428 bool psphotFitSersicIndexPCM (pmSource *source, pmModel *model, pmSourceFitOptions *fitOptions, psImageMaskType maskVal); 429 pmModel *psphotFitPCM (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal, int psfSize); 430 465 431 #endif -
branches/eam_branches/ipp-20100621/psphot/src/psphotApResid.c
r28405 r28692 459 459 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal); 460 460 461 bool status = pmSourceMagnitudes (source, psf, photMode, maskVal );461 bool status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal); 462 462 463 463 // clear the mask bit -
branches/eam_branches/ipp-20100621/psphot/src/psphotMagnitudes.c
r28405 r28692 186 186 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal); 187 187 188 status = pmSourceMagnitudes (source, psf, photMode, maskVal ); // maskVal includes markVal188 status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal); 189 189 if (status && isfinite(source->apMag)) Nap ++; 190 190 -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceFits.c
r28687 r28692 8 8 static int NfitDBL = 0; 9 9 static int NfitEXT = 0; 10 static int NfitPCM = 0; 10 11 11 12 bool psphotFitInit (int nThreads) { … … 440 441 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) { 441 442 443 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) { 444 psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy); 445 } 446 442 447 pmSourceFitOptions options = *fitOptions; 443 448 … … 456 461 } 457 462 458 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) {459 psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy);460 }461 462 463 // for sersic models, use a grid search to choose an index, then float the params there 463 464 if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { … … 476 477 } 477 478 478 pmModel *psphotFitPCM (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) { 479 pmModel *psphotFitPCM (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal, int psfSize) { 480 481 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) { 482 psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy); 483 } 484 485 float radius = psphotSetRadiusEXT (readout, source, markVal); 486 487 // XXX note that this changes the source moments that are published... 488 // recalculate the source moments using the larger extended-source moments radius 489 // at this stage, skip Gaussian windowing, and do not clip pixels by S/N 490 // this uses the footprint to judge both radius and aperture? 491 if (!pmSourceMoments (source, radius, 0.0, 0.0, maskVal)) return false; 479 492 480 493 pmSourceFitOptions options = *fitOptions; … … 487 500 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5); 488 501 489 // use the source moments, etc to guess basic model parameters 490 pmModel *EXT = pmSourceModelGuess (source, modelType); 491 if (!EXT) { 502 pmPCMdata *pcm = pmPCMinit (source, &options, modelType, maskVal, psfSize); 503 if (!pcm) { 492 504 psTrace ("psphot", 5, "failed to generate a model for source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy); 493 505 return NULL; 494 506 } 495 496 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) { 497 psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy);498 }507 // XXX check for nDOF too small 508 509 // use the source moments, etc to guess basic model parameters 510 pmSourceModelGuessPCM (pcm, source, maskVal, markVal); 499 511 500 512 // for sersic models, use a grid search to choose an index, then float the params there 501 513 if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { 502 psphotFitSersicIndexPCM ( source, EXT, fitOptions, maskVal);514 psphotFitSersicIndexPCM (pcm, source, fitOptions, maskVal, markVal); 503 515 } 504 516 … … 508 520 options.mode = PM_SOURCE_FIT_EXT; 509 521 } 510 pmSourceFitPCM (source, EXT, &options, maskVal);522 pmSourceFitPCM (source, PCM, &options, maskVal); 511 523 512 524 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0); 513 return ( EXT);525 return (PCM); 514 526 } 515 527 … … 520 532 // A sersic model is very sensitive to the index. attempt to find the index first by grid search in just the index 521 533 // for a sersic model, attempt to fit just the index and normalization with a modest number of iterations 522 bool psphotFitSersicIndex (pmSource *source, pmModel *model, pmSourceFitOptions *fitOptions, psImageMaskType maskVal) { 534 bool psphotFitSersicIndex (pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) { 535 536 pmModel *model = pcm->modelConv; 523 537 524 538 assert (model->type == pmModelClassGetType("PS_MODEL_SERSIC")); … … 535 549 for (int i = 0; i < N_INDEX_GUESS; i++) { 536 550 model->params->data.F32[PM_PAR_7] = indexGuess[i]; 537 model->modelGuess(model, source); 538 pmSourceFitModel (source, model, &options, maskVal); 551 pmSourceModelGuessPCM (pcm, source, maskVal, markVal); 552 553 pmSourceFitPCM (pcm, source, &options, maskVal); 539 554 chiSquare[i] = model->chisq; 540 555 if (i == 0) { … … 570 585 float xMin, chiSquare[N_INDEX_GUESS]; 571 586 int iMin; 587 588 // XXX we probably cannot be calling model->modelGuess() : this does not include the psf sigma 572 589 573 590 for (int i = 0; i < N_INDEX_GUESS; i++) { -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceSize.c
r28677 r28692 191 191 192 192 // XXX can we test if psfMag is set and calculate only if needed? 193 pmSourceMagnitudes (source, psf, photMode, maskVal ); // maskVal includes markVal193 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal); 194 194 195 195 // clear the mask bit … … 342 342 343 343 // XXX can we test if psfMag is set and calculate only if needed? 344 pmSourceMagnitudes (source, psf, photMode, maskVal ); // maskVal includes markVal344 pmSourceMagnitudes (source, psf, photMode, maskVal, markVal); 345 345 346 346 // clear the mask bit
Note:
See TracChangeset
for help on using the changeset viewer.
