- Timestamp:
- Aug 19, 2009, 12:16:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotRadiiFromProfiles.c
r25105 r25128 30 30 31 31 // examine data in the two ranges Fm - Fo and Fo - Fp to define the bin size 32 // XXX reconsider the fractional isophote value 32 33 float Fm = fluxMin + 0.25*fluxRange; 33 34 float Fp = fluxMin + 0.75*fluxRange; 34 35 float Fo = fluxMin + 0.50*fluxRange; 36 int Rbin = 1; 35 37 36 // find the mean radius of the points in the flux range Fm - Fp: 37 float Rsum = 0; 38 float Rnpt = 0; 39 for (int i = 0; i < flux->n; i++) { 40 if (flux->data.F32[i] < Fm) continue; 41 if (flux->data.F32[i] > Fp) continue; 42 43 Rsum += radius->data.F32[i]; 44 Rnpt ++; 45 } 38 // find the median radius of the points in the flux range Fm - Fp: 39 { 40 // storage vector for stats 41 psVector *values = psVectorAllocEmpty (flux->n, PS_TYPE_F32); 42 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); 46 43 47 // rebin with bins 1/2 the size of the mean radius 48 int Rbin = 0; 49 if (Rnpt == 0) { 50 Rbin = 1; 51 } else { 52 Rbin = MAX(1, 0.5*(Rsum / Rnpt)); 44 for (int i = 0; i < flux->n; i++) { 45 if (!isfinite(flux->data.F32[i])) continue; 46 if (flux->data.F32[i] < Fm) continue; 47 if (flux->data.F32[i] > Fp) continue; 48 49 psVectorAppend (values, radius->data.F32[i]); 50 } 51 psVectorStats (stats, values, NULL, NULL, 0); 52 53 // if we have a valid range, rebin with bin size 1/2 of median radius 54 if (isfinite(stats->sampleMedian)) { 55 Rbin = MAX(1, 0.5*stats->sampleMedian); 56 } 53 57 } 54 58 … … 94 98 psStatsInit(stats); 95 99 } 100 if (!isfinite(flux->data.F32[i])) continue; 96 101 psVectorAppend (values, flux->data.F32[i]); 97 102 } … … 105 110 bool above = true; 106 111 for (int i = 0; i < fluxBinned->n; i++) { 112 113 if (!isfinite(fluxBinned->data.F32[i])) continue; 107 114 108 115 // find the largest radius that matches the flux transition
Note:
See TracChangeset
for help on using the changeset viewer.
