- Timestamp:
- Sep 4, 2009, 2:18:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotPetrosianStats.c
r25204 r25275 32 32 float dFsum2 = 0.0; 33 33 34 float nSigma = 3.0; 35 int lowestSignificantRadius = 0; 36 float lowestSignificantRatio = 1.0; 37 34 38 int nOut = 0; 35 39 for (int i = 0; i < binSB->n; i++) { … … 48 52 areaInner += areaSum->data.F32[nOut-1]; 49 53 fluxInner += fluxSum->data.F32[nOut-1]; 50 fluxInnerErr2 = PS_SQR(fluxSumErr2->data.F32[nOut-1] * areaSum->data.F32[nOut-1]);54 fluxInnerErr2 += fluxSumErr2->data.F32[nOut-1]; 51 55 } 52 56 … … 64 68 65 69 float meanSBerr = sqrt(fluxInnerErr2) / areaInner; 66 float ratioErr = ratio* sqrt(PS_SQR(binSBstdev->data.F32[i]/binSB->data.F32[i]) + PS_SQR(meanSBerr/meanSB->data.F32[nOut]));70 float ratioErr = fabs(ratio) * sqrt(PS_SQR(binSBstdev->data.F32[i]/binSB->data.F32[i]) + PS_SQR(meanSBerr/meanSB->data.F32[nOut])); 67 71 68 72 psVectorAppend(petRatioErr, ratioErr); … … 74 78 75 79 if (1) { 76 fprintf (stderr, "%3d : %5.2f : %5.3f %5.3f : %5.3f %5.3f : %5.1f %5.1f\n", 77 i, refRadius->data.F32[nOut], binSB->data.F32[i], meanSB->data.F32[nOut], petRatio->data.F32[nOut], petRatioErr->data.F32[nOut], fluxSum->data.F32[nOut], areaSum->data.F32[nOut]); 80 fprintf (stderr, "%3d : %5.2f : %5.3f %5.3f : %5.3f %5.3f : %5.3f %5.3f : %5.3f %5.3f : %5.1f %5.1f\n", 81 i, refRadius->data.F32[nOut], 82 binSB->data.F32[i], binSBstdev->data.F32[i], 83 meanSB->data.F32[nOut], meanSBerr, 84 petRatio->data.F32[nOut], petRatioErr->data.F32[nOut], 85 fluxSum->data.F32[nOut], sqrt(fluxSumErr2->data.F32[nOut]), areaSum->data.F32[nOut], areaInner); 78 86 } 79 87 80 88 // anytime we transition below the PETROSIAN_RATIO, calculate the radius and flux 81 89 // we will keep and report the last (largest radius) value 82 if (above && (petRatio->data.F32[nOut] < PETROSIAN_RATIO) ) {90 if (above && (petRatio->data.F32[nOut] < PETROSIAN_RATIO) && (petRatio->data.F32[nOut] > nSigma*petRatioErr->data.F32[nOut])) { 83 91 // interpolate Rvec between i-1 and i to PETROSIAN_RATIO to get flux (Fvec) and radius (rvec) 84 92 if (i == 0) { … … 93 101 } 94 102 103 // anytime we transition below the PETROSIAN_RATIO, calculate the radius and flux 104 // we will keep and report the last (largest radius) value 105 // find the last signficant measurement of the petrosian ratio 106 if (above && (petRatio->data.F32[nOut] < lowestSignificantRatio) && (petRatio->data.F32[nOut] > nSigma*petRatioErr->data.F32[nOut])) { 107 lowestSignificantRadius = nOut; 108 lowestSignificantRatio = petRatio->data.F32[nOut]; 109 } 110 95 111 // reset on transitions up, but do not re-calculate rad_90, flux_90 96 112 if (!above && (petRatio->data.F32[nOut] >= PETROSIAN_RATIO)) { … … 101 117 102 118 if (!anyPetro) { 103 // set default radius: 119 // interpolate Rvec between i-1 and i to PETROSIAN_RATIO to get flux (Fvec) and radius (rvec) 120 if (lowestSignificantRadius == 0) { 121 // assume Fmax @ R = 0.0 122 petRadius = InterpolateValues (1.0, 0.0, petRatio->data.F32[lowestSignificantRadius], refRadius->data.F32[lowestSignificantRadius], PETROSIAN_RATIO); 123 } else { 124 petRadius = InterpolateValues (petRatio->data.F32[lowestSignificantRadius-1], refRadius->data.F32[lowestSignificantRadius-1], petRatio->data.F32[lowestSignificantRadius], refRadius->data.F32[lowestSignificantRadius], PETROSIAN_RATIO); 125 } 104 126 } 105 127 … … 110 132 if (refRadius->data.F32[i] > apRadius) { 111 133 if (i == 0) { 112 psAbort ("does this case make any sense?"); 134 psWarning ("does this case make any sense? (refRadius[0] > apRadius)"); 135 continue; 113 136 } else { 114 137 petFlux = InterpolateValues (refRadius->data.F32[i-1], fluxSum->data.F32[i-1], refRadius->data.F32[i], fluxSum->data.F32[i], apRadius); … … 119 142 120 143 // save petRadius, petFlux 144 // XXX save flags (anyPetro, manyPetro) 121 145 petrosian->petrosianRadius = petRadius; 122 146 petrosian->petrosianFlux = petFlux;
Note:
See TracChangeset
for help on using the changeset viewer.
