- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotPetrosianRadialBins.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot merged eligible /branches/eam_branches/stackphot.20100406/psphot 27622-27655 /branches/pap_delete/psphot 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/psphot/src
- Property svn:ignore
-
old new 19 19 psphotMomentsStudy 20 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/tap_branches/psphot/src/psphotPetrosianRadialBins.c
r25755 r27838 1 1 # include "psphotInternal.h" 2 float InterpolateValues (float X0, float Y0, float X1, float Y1, float X); 2 3 3 4 // convert the flux vs elliptical radius to annular bins … … 5 6 // we are guaranteed to be limited by either the seeing (1 - few pixels) or by the pixels 6 7 // themselves. this function does not attempt to measure the radial profiles accurately 7 // for radii that are smaller than a minimum (currently 1.0 pixels).8 // for radii that are smaller than ~2 pixels 8 9 9 10 // for small radii, we are measuring the mean surface brightness in non-overlapping radial … … 13 14 // track the non-overlapping radius values. 14 15 16 // Photo interpolates the image of interest to place the peak on the center of the central 17 // pixel, and then uses the exact fractions of the pixels in each of the first few annuli. 18 // Seems like a reasonable thing, but is there any significance to the difference? 19 15 20 // XXX move the resulting elements from profile to extpars->petrosian? 16 21 bool psphotPetrosianRadialBins (pmSource *source, float radiusMax, float skynoise) { 17 22 18 p mSourceRadialProfile *profile = source->extpars->profile;19 20 float skyModelErrorSQ = PS_SQR(skynoise);21 22 psVector *radius = profile->radiusElliptical;23 psVector *flux = profile->fluxElliptical;23 psAssert (source, "missing source"); 24 psAssert (source->extpars, "missing extpars"); 25 psAssert (source->extpars->ellipticalFlux, "missing ellipticalFlux"); 26 27 psVector *radius = source->extpars->ellipticalFlux->radiusElliptical; 28 psVector *flux = source->extpars->ellipticalFlux->fluxElliptical; 24 29 25 30 // sort incoming vectors by radius 26 31 pmSourceRadialProfileSortPair (radius, flux); 32 33 if (!source->extpars->petProfile) { 34 source->extpars->petProfile = pmSourceRadialProfileAlloc(); 35 } 36 pmSourceRadialProfile *profile = source->extpars->petProfile; 37 38 float skyModelErrorSQ = PS_SQR(skynoise); 27 39 28 40 int nMax = radiusMax; … … 107 119 psVector *values = psVectorAllocEmpty (flux->n, PS_TYPE_F32); 108 120 psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 109 // psStats *stats = psStatsAlloc(PS_STAT_FITTED_MEAN_V4 | PS_STAT_FITTED_STDEV_V4);110 111 // integrate flux, radius for each of these bins. since flux is sorted by radius,112 // we can do this fairly quickly113 121 114 122 bool done = false; … … 133 141 dvalue = NAN; 134 142 } 135 // binSB->data.F32[nOut] = stats->sampleMedian; 143 136 144 binSB->data.F32[nOut] = value; 137 145 binSBstdev->data.F32[nOut] = sqrt(PS_SQR(dvalue) / values->n + skyModelErrorSQ); 138 // binSB->data.F32[nOut] = stats->fittedMean;139 // binSBstdev->data.F32[nOut] = sqrt(PS_SQR(stats->fittedStdev) / values->n + skyModelErrorSQ);140 146 141 147 // error in the SB is the stdev per bin / sqrt (number of pixels) … … 143 149 // residual flux, but the sky from the sky model) 144 150 145 psTrace ("psphot", 5, "%3d %5.1f %5.1f : %5.1f %5.2f\n", 146 nOut, radAlp->data.F32[nOut], radBet->data.F32[nOut], binSB->data.F32[nOut], binSBstdev->data.F32[nOut]); 151 psTrace ("psphot", 5, "%3d %5.1f %5.1f : %5.1f %5.2f\n", nOut, radAlp->data.F32[nOut], radBet->data.F32[nOut], binSB->data.F32[nOut], binSBstdev->data.F32[nOut]); 147 152 148 153 nOut ++; … … 163 168 // XXX I think this misses the last radial bin -- do we care? 164 169 170 // interpolate any bins that were empty (extrapolate to center if needed) 171 if (!isfinite(binSB->data.F32[0]) && !isfinite(binSB->data.F32[1])) { 172 psWarning ("center 2 bins of source at %f, %f are NAN, skipping this source", source->peak->xf, source->peak->yf); 173 // XXX raise a flag 174 psFree(binSB); 175 psFree(binSBstdev); 176 psFree(binRad); 177 psFree(binArea); 178 psFree(radMin); 179 psFree(radMax); 180 psFree(radAlp); 181 psFree(radBet); 182 psFree(values); 183 psFree(stats); 184 return false; 185 } 186 187 // if center bin is empty assume same SB as next radius (probably true due to PSF) 188 if (!isfinite(binSB->data.F32[0])) { 189 binSB->data.F32[0] = binSB->data.F32[1]; 190 binSBstdev->data.F32[0] = binSBstdev->data.F32[1]; 191 } 192 193 // interpolate any bins that were empty (if center if needed) 194 for (int i = 1; i < binSB->n - 1; i++) { 195 if (isfinite(binSB->data.F32[i])) continue; 196 binSB->data.F32[i] = InterpolateValues (binRad->data.F32[i-1], binSB->data.F32[i-1], binRad->data.F32[i+1], binSB->data.F32[i+1], binRad->data.F32[i]); 197 binSBstdev->data.F32[i] = InterpolateValues (binRad->data.F32[i-1], binSBstdev->data.F32[i-1], binRad->data.F32[i+1], binSBstdev->data.F32[i+1], binRad->data.F32[i]); 198 } 199 200 psFree(profile->binSB); 201 psFree(profile->binSBstdev); 202 psFree(profile->radialBins); 203 psFree(profile->area); 204 165 205 // save the vectors 166 206 profile->radialBins = binRad;
Note:
See TracChangeset
for help on using the changeset viewer.
