Changeset 15819
- Timestamp:
- Dec 13, 2007, 2:40:29 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotRadialProfile.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotRadialProfile.c
r15801 r15819 1 1 # include "psphotInternal.h" 2 2 3 # define COMPARE (A,B) (radius->data.F32[A] < radius->data.F32[B])4 # define SWAP FUNC(TYPE,A,B) { \3 # define COMPARE_RADIUS(A,B) (radius->data.F32[A] < radius->data.F32[B]) 4 # define SWAP_RADIUS(TYPE,A,B) { \ 5 5 float tmp; \ 6 6 if (A != B) { \ … … 14 14 weight->data.F32[A] = weight->data.F32[B]; \ 15 15 weight->data.F32[B] = tmp; \ 16 } 17 16 } \ 17 } 18 18 19 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psMaskType maskVal) { 19 20 20 21 // allocate pmSourceExtendedParameters, if not already defined 21 22 if (!source->extpars) { 22 source->extpars = pmSourceExtendedParsAlloc ();23 source->extpars = pmSourceExtendedParsAlloc (); 23 24 } 24 25 25 26 if (!source->extpars->profile) { 26 source->extpars->profile = pmSourceRadialProfileAlloc (); 27 } 28 27 source->extpars->profile = pmSourceRadialProfileAlloc (); 28 } 29 29 30 int nPts = source->pixels->numRows * source->pixels->numCols; 30 31 source->extpars->profile->radius = psVectorAllocEmpty (nPts, PS_TYPE_F32); … … 43 44 float Yo = source->modelEXT->params->data.F32[PM_PAR_YPOS] - source->pixels->row0; 44 45 for (int iy = 0; iy < source->pixels->numRows; iy++) { 45 for (int ix = 0; ix < source->pixels->numCols; ix++) {46 if (source->maskObj->data.U8[iy][ix]) continue;47 radius->data.F32[n] = hypot (ix - Xo, iy - Yo) ;48 flux->data.F32[n] = source->pixels->data.F32[iy][ix];49 weight->data.F32[n] = source->weight->data.F32[iy][ix];50 n++;51 }46 for (int ix = 0; ix < source->pixels->numCols; ix++) { 47 if (source->maskObj->data.U8[iy][ix]) continue; 48 radius->data.F32[n] = hypot (ix - Xo, iy - Yo) ; 49 flux->data.F32[n] = source->pixels->data.F32[iy][ix]; 50 weight->data.F32[n] = source->weight->data.F32[iy][ix]; 51 n++; 52 } 52 53 } 53 54 radius->n = n; … … 56 57 57 58 // sort the vector set by the radius 58 PSSORT (radius->n, COMPARE , SWAPFUNC, NONE);59 PSSORT (radius->n, COMPARE_RADIUS, SWAP_RADIUS, NONE); 59 60 60 61 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
