Changeset 38560
- Timestamp:
- Jul 2, 2015, 7:36:29 AM (11 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 4 edited
-
psphotDeblendSatstars.c (modified) (1 diff)
-
psphotMergeSources.c (modified) (1 diff)
-
psphotReplaceUnfit.c (modified) (1 diff)
-
psphotStackUpdateReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotDeblendSatstars.c
r38395 r38560 136 136 source = sources->data[N]; 137 137 138 if (!source->pixels) continue; 138 139 #ifndef DEBLEND_PASS2_SOURCES 139 140 // XXX: Need to define this if we want to rerun the satstar stuff again on the pass2 sources -
trunk/psphot/src/psphotMergeSources.c
r38543 r38560 1013 1013 } else { 1014 1014 // What to do here? 1015 psAssert (pcm, "pmPCMinit failed!"); 1015 // psAssert (pcm, "pmPCMinit failed!"); 1016 psFree (sourceOut->modelEXT); 1017 sourceOut->modelEXT = NULL; 1016 1018 } 1017 1019 } else { -
trunk/psphot/src/psphotReplaceUnfit.c
r38556 r38560 378 378 379 379 if (model->isPCM) { 380 #if 0 381 psAssert(false, "this section is not complete"); 382 383 pmSourceCachePSF (source, maskVal); 384 385 psKernel *psfKernel = pmPCMkernelFromPSF(source, psfSize); 386 if (!psfKernel) { 387 psWarning ("no psf kernel"); 388 } 389 390 // generate an image of the right size 391 psImage *rawModelFlux = psImageCopy (NULL, source->pixels, PS_TYPE_F32); 392 psImageInit (rawModelFlux, 0.0); 393 394 // insert the model image normalized to 1.0 395 pmModelAdd (rawModelFlux, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_NORM, maskVal); 396 397 psImageConvolveFFT (source->modelFlux, rawModelFlux, NULL, 0, psfKernel); 398 psFree (psfKernel); 399 psFree (rawModelFlux); 400 #endif 401 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize); 380 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize); 402 381 if (pcm) { 403 382 pmPCMCacheModel (source, maskVal, psfSize, pcm->nsigma); 404 383 psFree(pcm); 405 384 } else { 406 psAssert (pcm, "pmPCMinit failed!"); 385 psFree(source->modelEXT); 386 source->modelEXT = NULL; 407 387 } 408 388 -
trunk/psphot/src/psphotStackUpdateReadout.c
r38531 r38560 362 362 source->modelPSF->residuals = psf->residuals; 363 363 } 364 364 365 if (!(source->mode & PM_SOURCE_MODE_PSFMODEL)) { 365 366 // The cmf loaders unconditionallly create psf models even if the source did not have one. … … 372 373 } 373 374 374 // make sure that the window radius is large enough. Should we do this regardless of whether375 // or not the source is extended?375 // make sure that the window radius is large enough. 376 // Should we do this regardless of whether or not the source is extended? 376 377 float fitRadius = NAN; 377 378 float windowRadius = NAN; 378 if (1 || source->modelEXT) { 379 if (!psphotSetRadiusMoments (&fitRadius, &windowRadius, readout, source, markVal)) { 380 psError (PSPHOT_ERR_UNKNOWN, false, "failed to set radius for ext source"); 381 return false; 382 } 383 } 379 if (!psphotSetRadiusMoments (&fitRadius, &windowRadius, readout, source, markVal)) { 380 psError (PSPHOT_ERR_UNKNOWN, false, "failed to set radius for ext source"); 381 return false; 382 } 383 // We are getting some sources near the edge of skycells which are marked as having 384 // been fit with saturated star model but have peak coordinates far outside the 385 // image. When this happens an error is left on the stack. 386 psErrorClear(); 384 387 385 388 // If we find a good model we will cache it below. … … 431 434 // I Should be getting that information from the recipe. 432 435 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize); 433 if (!pcm) { 434 psError (PSPHOT_ERR_UNKNOWN, false, "failed to to initialize PCM for model"); 435 return false; 436 if (pcm) { 437 model->params->data.F32[PM_PAR_I0] = 1.0; 438 float normFlux = model->class->modelFlux(model->params); 439 float I0 = modelFlux / normFlux; 440 if (isfinite(I0)) { 441 model->params->data.F32[PM_PAR_I0] = I0; 442 goodModel = true; 443 // Usually this it is set when doing the fit. Since we are instantiating the model we 444 // set it explicitly here. 445 model->isPCM = true; 446 } 447 psFree(pcm); 448 } else { 449 // psError (PSPHOT_ERR_UNKNOWN, false, "failed to to initialize PCM for model"); 450 // return false; 451 // fall through 436 452 } 437 model->params->data.F32[PM_PAR_I0] = 1.0;438 // XXX: this duplicates work that pmPCMCacheModel does439 // pmPCMMakeModel (source, model, pcm->nsigma, maskVal, psfSize);440 float normFlux = model->class->modelFlux(model->params);441 float I0 = modelFlux / normFlux;442 if (isfinite(I0)) {443 model->params->data.F32[PM_PAR_I0] = I0;444 goodModel = true;445 // Usually this it is set when doing the fit. Since we are instantiating the model we446 // set it explicitly here.447 model->isPCM = true;448 }449 psFree(pcm);450 453 } 451 454 if (!goodModel) { … … 458 461 // XXX However we aren't going to cache it below so... 459 462 source->type = PM_SOURCE_TYPE_STAR; 463 psFree(source->modelEXT); 464 source->modelEXT = NULL; 460 465 model = NULL; 461 466 }
Note:
See TracChangeset
for help on using the changeset viewer.
