Changeset 34322
- Timestamp:
- Aug 19, 2012, 9:43:19 AM (14 years ago)
- File:
-
- 1 edited
-
tags/ipp-20120802/psphot/src/psphotSourceStats.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20120802/psphot/src/psphotSourceStats.c
r34308 r34322 524 524 # define NSIGMA 8 525 525 // moved to config file 526 // float sigma[NSIGMA] = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0}; 527 psVector *sigmavec = psMetadataLookupPtr (&status, recipe, "PSF.SIGMA.VALUES"); psAssert(status, "missing PSF.SIGMA.VALUES"); 528 psAssert(sigmavec->n <= NSIGMA, "too many sigma values in recipe %ld maximum is %d", sigmavec->n, NSIGMA); 526 psVector *sigmavec = psMetadataLookupPtr (&status, recipe, "PSF.SIGMA.VALUES"); 529 527 530 528 float sigma[NSIGMA]; … … 533 531 int Nout[NSIGMA]; // number of stars found in clump : use this to control the number of regions measured by psphotRoughClass 534 532 535 // copy the data from vector to local array to keep the code below easier to read 536 for (int i = 0 ; i < sigmavec->n; i++) { 537 sigma[i] = sigmavec->data.F32[i]; 533 int nsigma; 534 if (sigmavec) { 535 psAssert(sigmavec->n <= NSIGMA, "too many sigma values in recipe %ld maximum is %d", sigmavec->n, NSIGMA); 536 // copy the data from vector to local array to keep the code below easier to read 537 for (int i = 0 ; i < sigmavec->n; i++) { 538 sigma[i] = sigmavec->data.F32[i]; 539 } 540 nsigma = sigmavec->n; 541 } else { 542 // requiring this causes updates to pop an assertion 543 // psAssert(status, "missing PSF.SIGMA.VALUES"); 544 float defaultsigma[NSIGMA] = {1.0, 2.0, 3.0, 4.5, 6.0, 9.0, 12.0, 18.0}; 545 for (int i = 0 ; i < NSIGMA; i++) { 546 sigma[i] = defaultsigma[i]; 547 } 548 nsigma = NSIGMA; 538 549 } 539 550 … … 542 553 543 554 // loop over radii: 544 for (int i = 0; i < sigmavec->n; i++) {555 for (int i = 0; i < nsigma; i++) { 545 556 546 557 // XXX move max source number to config … … 599 610 float minS = Sout[0]; 600 611 float maxS = Sout[0]; 601 for (int i = 0; i < sigmavec->n; i++) {612 for (int i = 0; i < nsigma; i++) { 602 613 minS = PS_MIN(Sout[i], minS); 603 614 maxS = PS_MAX(Sout[i], maxS); 604 615 } 605 if (minS > 0.65) Sigma = sigma[ sigmavec->n-1];616 if (minS > 0.65) Sigma = sigma[nsigma-1]; 606 617 if (maxS < 0.65) Sigma = sigma[0]; 607 618 608 for (int i = 0; i < sigmavec->n- 1 && isnan(Sigma); i++) {619 for (int i = 0; i < nsigma - 1 && isnan(Sigma); i++) { 609 620 if (!isfinite(Sout[i]) || !isfinite(Sout[i+1])) continue; 610 621 if ((Sout[i] > 0.65) && (Sout[i+1] > 0.65)) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
