Changeset 30175
- Timestamp:
- Dec 24, 2010, 3:29:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/psphot/src/psphotChoosePSF.c
r30141 r30175 166 166 for (int i = 0; i < sources->n; i++) { 167 167 pmSource *source = sources->data[i]; 168 if (source-> mode & PM_SOURCE_MODE_PSFSTAR) {169 // keep NSTARS PSF stars , unmark the rest168 if (source->tmpFlags & PM_SOURCE_TMPF_CANDIDATE_PSFSTAR) { 169 // keep NSTARS PSF stars 170 170 if (stars->n < NSTARS) { 171 171 psArrayAdd (stars, 200, source); 172 } else {173 source->mode &= ~PM_SOURCE_MODE_PSFSTAR;174 172 } 175 173 } … … 214 212 psFree(options); 215 213 216 // unset the PSFSTAR flags (none are used): 217 for (int i = 0; i < sources->n; i++) { 218 pmSource *source = sources->data[i]; 219 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 220 } 214 // no sources are used as PSF stars 221 215 222 216 // XXX set sxx, etc from FWHM in recipe … … 292 286 psLogMsg ("psphot.pspsf", PS_LOG_INFO, "Using guess PSF model"); 293 287 294 // unset the PSFSTAR flags (none are used): 295 for (int i = 0; i < sources->n; i++) { 296 pmSource *source = sources->data[i]; 297 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 298 } 288 // no sources are used as PSF stars 299 289 300 290 // XXX set sxx, etc from FWHM in recipe … … 322 312 pmPSFtry *try = models->data[bestN]; 323 313 324 // unset the PSFSTAR flag for stars not used for PSF model 325 // XXX a more efficient way of achieving this would be to record a pair of arrays 326 // of the source index and the source id for the psf stars. but that would require we do 327 // not re-sort the source list in the meanwhile 328 int nDrop = 0; 314 // set the PSFSTAR flag for stars used for the PSF model 315 int nKeep = 0; 329 316 for (int i = 0; i < try->sources->n; i++) { 330 317 pmSource *source = try->sources->data[i]; 331 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 332 // need to find this source in the original list (these are copies, not pointers) 333 for (int j = 0; j < sources->n; j++) { 334 pmSource *realSource = sources->data[j]; 335 if (realSource->id != source->id) continue; 336 realSource->mode &= ~PM_SOURCE_MODE_PSFSTAR; 337 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 338 nDrop ++; 339 break; 340 } 341 } 342 } 343 // fprintf (stderr, "drop %d stars as PSF stars\n", nDrop); 344 345 // XXX is this working? 346 // int N1 = 0; 347 // for (int i = 0; i < try->sources->n; i++) { 348 // pmSource *source = try->sources->data[i]; 349 // fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR)); 350 // if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 351 // N1 ++; 352 // } 353 // } 354 // int N2 = 0; 355 // for (int i = 0; i < sources->n; i++) { 356 // pmSource *source = sources->data[i]; 357 // fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR)); 358 // if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 359 // N2 ++; 360 // } 361 // } 362 // fprintf (stderr, "N1: %d, N2: %d\n", N1, N2); 318 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue; 319 320 // this source was used: find the parent and set its PSFSTAR flag 321 pmSource *realSource = source->parent; 322 psAssert (realSource, "pmPSFtryAlloc should have set the parent pointers"); 323 realSource->mode |= PM_SOURCE_MODE_PSFSTAR; 324 nKeep ++; 325 } 326 psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "used %d of %ld candidate PSF objects\n", nKeep, try->sources->n); 363 327 364 328 // build a PSF residual image … … 386 350 } 387 351 388 // XXXtest dump of psf star data and psf-subtracted image352 // test dump of psf star data and psf-subtracted image 389 353 if (psTraceGetLevel("psphot.psfstars") > 5) { 390 354 psphotDumpPSFStars (readout, try, options->fitRadius, maskVal, markVal); … … 413 377 return false; 414 378 } 415 psFree (psf); // XXX double-check 416 417 // move into psphotChoosePSF 379 psFree (psf); 380 418 381 psphotVisualShowPSFModel (readout, psf); 419 382
Note:
See TracChangeset
for help on using the changeset viewer.
