- Timestamp:
- Aug 19, 2009, 12:16:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotRadialProfileByAngle.c
r25105 r25128 5 5 6 6 // XXX choices for rMax and Nsec? 7 // XXX where does the output go?8 // XXX how does this fit in context?9 7 10 8 bool psphotRadialProfilesByAngles (pmPetrosian *petrosian, pmSource *source, int Nsec, float Rmax) { 11 9 10 // we want to have an even number of sectors so we can do 180 deg symmetrizing 11 Nsec = (Nsec % 2) ? Nsec + 1 : Nsec; 12 12 float dtheta = 2.0*M_PI / Nsec; 13 13 … … 46 46 // value is NAN if we run off the image 47 47 float value = psImageInterpolatePixelBilinear(x, y, source->pixels); 48 if (isnan(value)) continue; 48 49 // keep the nan values so all vectors are matched 50 // if (isnan(value)) continue; 49 51 50 52 psVectorAppend (radius, r); … … 62 64 } 63 65 66 for (int i = 0; i < Nsec / 2; i++) { 67 68 psVector *r1 = petrosian->radii->data[i]; 69 psVector *r2 = petrosian->radii->data[i+Nsec/2]; 70 71 psVector *f1 = petrosian->fluxes->data[i]; 72 psVector *f2 = petrosian->fluxes->data[i+Nsec/2]; 73 74 psAssert (r1->n == r2->n, "mis-matched vectors"); 75 psAssert (f1->n == f2->n, "mis-matched vectors"); 76 77 // we have a pair of vectors i, i+Nsec/2; replace them with the finite minimum of the pair 78 for (int j = 0; j < r1->n; j++) { 79 80 float flux; 81 82 if (!isfinite(f1->data.F32[j]) && !isfinite(f2->data.F32[j])) { 83 flux = NAN; 84 goto setflux; 85 } 86 87 if (!isfinite(f1->data.F32[j])) { 88 flux = f2->data.F32[j]; 89 goto setflux; 90 } 91 if (!isfinite(f2->data.F32[j])) { 92 flux = f1->data.F32[j]; 93 goto setflux; 94 } 95 96 flux = PS_MIN(f1->data.F32[j], f2->data.F32[j]); 97 98 setflux: 99 f1->data.F32[j] = flux; 100 f2->data.F32[j] = flux; 101 } 102 } 64 103 return true; 65 104 }
Note:
See TracChangeset
for help on using the changeset viewer.
