Changeset 26507
- Timestamp:
- Jan 4, 2010, 10:07:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psphot/src/psphotSourceFits.c
r25755 r26507 219 219 double chiTrend; 220 220 pmModel *ONE = NULL; 221 pmSource *tmpSrc = NULL; 222 pmModel *EXT = NULL; 223 psArray *DBL = NULL; 221 224 222 225 // skip the source if we don't think it is extended … … 240 243 241 244 // this temporary source is used as a place-holder by the psphotEval functions below 242 pmSource *tmpSrc = pmSourceAlloc ();245 tmpSrc = pmSourceAlloc (); 243 246 244 247 // XXX need to handle failures better here 245 pmModel *EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal); 246 if (!isfinite(EXT->params->data.F32[PM_PAR_I0])) psAbort("nan in fit"); 248 EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal); 249 if (!EXT) goto escape; 250 if (!isfinite(EXT->params->data.F32[PM_PAR_I0])) goto escape; 247 251 248 252 okEXT = psphotEvalEXT (tmpSrc, EXT); … … 250 254 251 255 // DBL will always be defined, but DBL->data[n] might not 252 psArray *DBL = psphotFitDBL (readout, source, maskVal, markVal); 256 DBL = psphotFitDBL (readout, source, maskVal, markVal); 257 if (!DBL) goto escape; 258 if (!DBL->n) goto escape; 259 253 260 okDBL = psphotEvalDBL (tmpSrc, DBL->data[0]); 254 261 okDBL &= psphotEvalDBL (tmpSrc, DBL->data[1]); … … 362 369 psFree (DBL); 363 370 return true; 371 372 escape: 373 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 374 psFree (tmpSrc); 375 psFree (EXT); 376 psFree (DBL); 377 return false; 364 378 } 365 379 … … 425 439 // use the source moments, etc to guess basic model parameters 426 440 pmModel *EXT = pmSourceModelGuess (source, modelType); 427 PS_ASSERT (EXT, NULL); 441 if (!EXT) { 442 psTrace ("psphot", 5, "failed to generate a model for source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy); 443 return NULL; 444 } 428 445 429 446 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) {
Note:
See TracChangeset
for help on using the changeset viewer.
