Changeset 30866
- Timestamp:
- Mar 10, 2011, 5:25:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphotSourceStats.c
r30753 r30866 377 377 psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[6],PS_TYPE_IMAGE_MASK_DATA); 378 378 379 // if no valid pixels, massive swing or very large Mrf, likely saturated source, 380 // try a much larger box 381 float BIG_RADIUS = 3.0*RADIUS; 382 float BIG_SIGMA = 3.0*SIGMA; 383 379 384 // maskVal is used to test for rejected pixels, and must include markVal 380 385 maskVal |= markVal; … … 419 424 } 420 425 426 // XXX how can this be set: this is raised in pmSourceRoughClass, called after this function? 421 427 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 422 428 fprintf (stderr, "satstar: %f,%f\n", source->peak->xf, source->peak->yf); 423 429 } 424 430 425 // measure basic source moments (no S/N clipping on input pixels) 426 status = pmSourceMoments (source, RADIUS, SIGMA, 0.0, maskVal); 427 // XXX moments / aperture test: 428 if (0) { 429 // clear the mask bit and set the circular mask pixels 430 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 431 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, 4.0*source->moments->Mrf, "OR", markVal); 432 433 float apMag = NAN; 434 pmSourcePhotometryAper (&apMag, NULL, NULL, NULL, source->pixels, source->variance, source->maskObj, maskVal); 435 fprintf (stderr, "apMag: %f, kronMag: %f\n", apMag, -2.5*log10(source->moments->KronFlux)); 436 437 // clear the mask bit 438 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 439 } 440 if (status && (source->moments->Mrf < 2.0*SIGMA)) { 441 Nmoments ++; 442 continue; 443 } 444 445 // if no valid pixels, massive swing or very large Mrf, likely saturated source, 446 // try a much larger box 447 float BIG_RADIUS = 3.0*RADIUS; 448 float BIG_SIGMA = 3.0*SIGMA; 449 450 { 451 // NOTE this is slightly sleazy, but only slightly: pmSourceRedefinePixels uses the readout 452 // to pass the pointers to the parent image data. I guess the API could be simplified: 453 // we could recover this from the source in the function 431 if (!(source->peak->type == PM_PEAK_SUSPECT_SATURATION)) { 432 // measure basic source moments (no S/N clipping on input pixels) 433 status = pmSourceMoments (source, RADIUS, SIGMA, 0.0, maskVal); 434 } else { 435 // For saturated stars, choose a much larger box NOTE this is slightly sleazy, but 436 // only slightly: pmSourceRedefinePixels uses the readout to pass the pointers to 437 // the parent image data. I guess the API could be simplified: we could recover 438 // this from the source in the function 454 439 455 440 pmReadout tmpReadout; … … 458 443 tmpReadout.variance = (psImage *)source->variance->parent; 459 444 460 // re-allocate image, weight, mask arrays for each peak (square of radius OUTER)445 // re-allocate image, weight, mask arrays for each peak with box big enough to fit BIG_RADIUS 461 446 pmSourceRedefinePixels (source, &tmpReadout, source->peak->x, source->peak->y, BIG_RADIUS + 2); 447 448 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y); 449 status = pmSourceMoments (source, BIG_RADIUS, BIG_SIGMA, 0.0, maskVal); 450 source->mode |= PM_SOURCE_MODE_BIG_RADIUS; 462 451 } 463 464 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y); 465 status = pmSourceMoments (source, BIG_RADIUS, BIG_SIGMA, 0.0, maskVal); 466 if (status) { 467 source->mode |= PM_SOURCE_MODE_BIG_RADIUS; 468 Nmoments ++; 469 continue; 470 } 471 472 source->mode |= PM_SOURCE_MODE_MOMENTS_FAILURE; 473 Nfail ++; 474 psErrorClear(); 475 continue; 452 if (!status) { 453 source->mode |= PM_SOURCE_MODE_MOMENTS_FAILURE; 454 Nfail ++; 455 psErrorClear(); 456 continue; 457 } 458 Nmoments ++; 459 460 // re-try big sources or not?? 461 // if (source->moments->Mrf < 2.0*SIGMA) 476 462 } 477 463
Note:
See TracChangeset
for help on using the changeset viewer.
