- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotRadialProfile.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_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/simtest_nebulous_branches/psphot/src
- Property svn:ignore
-
old new 18 18 psphotVersionDefinitions.h 19 19 psphotMomentsStudy 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/psphot/src/psphotRadialProfile.c
r21366 r27840 1 1 # include "psphotInternal.h" 2 2 3 # define COMPARE_RADIUS(A,B) (radius->data.F32[A] < radius->data.F32[B]) 4 # define SWAP_RADIUS(TYPE,A,B) { \ 5 float tmp; \ 6 if (A != B) { \ 7 tmp = radius->data.F32[A]; \ 8 radius->data.F32[A] = radius->data.F32[B]; \ 9 radius->data.F32[B] = tmp; \ 10 tmp = flux->data.F32[A]; \ 11 flux->data.F32[A] = flux->data.F32[B]; \ 12 flux->data.F32[B] = tmp; \ 13 tmp = variance->data.F32[A]; \ 14 variance->data.F32[A] = variance->data.F32[B]; \ 15 variance->data.F32[B] = tmp; \ 16 } \ 17 } 3 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal) { 18 4 19 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psImageMaskType maskVal) { 5 bool status; 20 6 21 7 // allocate pmSourceExtendedParameters, if not already defined … … 24 10 } 25 11 26 if (!source->extpars->profile) { 27 source->extpars->profile = pmSourceRadialProfileAlloc (); 12 // XXX these need to go into recipe values 13 int Nsec = 24; 14 float Rmax = 200; 15 float fluxMin = 0.0; 16 float fluxMax = source->peak->flux; 17 18 bool RAW_RADIUS = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_RAW_RADIUS"); 19 20 // generate a series of radial profiles at Nsec evenly spaced angles. the profile flux 21 // is measured by interpolation for small radii; for large radii, the pixels in a box 22 // are averaged to increase the S/N 23 if (!psphotRadialProfilesByAngles (source, Nsec, Rmax)) { 24 psError (PS_ERR_UNKNOWN, false, "failed to measure radial profile for petrosian"); 25 return false; 28 26 } 29 27 30 int nPts = source->pixels->numRows * source->pixels->numCols; 31 source->extpars->profile->radius = psVectorAllocEmpty (nPts, PS_TYPE_F32); 32 source->extpars->profile->flux = psVectorAllocEmpty (nPts, PS_TYPE_F32); 33 source->extpars->profile->variance = psVectorAllocEmpty (nPts, PS_TYPE_F32); 28 // use the radial profiles to determine the radius of a given isophote. this isophote 29 // is used to determine the elliptical shape of the object, so it has a relatively high 30 // value (nominally 25% of the peak) 31 if (!psphotRadiiFromProfiles (source, fluxMin, fluxMax)) { 32 psError (PS_ERR_UNKNOWN, false, "failed to measure isophotal radii from profiles"); 33 return false; 34 } 34 35 35 psVector *radius = source->extpars->profile->radius; 36 psVector *flux = source->extpars->profile->flux; 37 psVector *variance = source->extpars->profile->variance; 38 39 // XXX use the extended source model here for Xo, Yo? 40 // XXX define a radius scaled to the elliptical contour? 41 42 int n = 0; 43 44 float Xo = 0.0; 45 float Yo = 0.0; 46 47 if (source->modelEXT) { 48 Xo = source->modelEXT->params->data.F32[PM_PAR_XPOS] - source->pixels->col0; 49 Yo = source->modelEXT->params->data.F32[PM_PAR_YPOS] - source->pixels->row0; 50 } else { 51 Xo = source->peak->xf - source->pixels->col0; 52 Yo = source->peak->yf - source->pixels->row0; 36 // convert the isophotal radius vs angle measurements to an elliptical contour 37 if (!psphotEllipticalContour (source)) { 38 psLogMsg ("psphot", 3, "failed to measure elliptical contour"); 39 return false; 53 40 } 54 for (int iy = 0; iy < source->pixels->numRows; iy++) { 55 for (int ix = 0; ix < source->pixels->numCols; ix++) { 56 if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) continue; 57 radius->data.F32[n] = hypot (ix - Xo, iy - Yo) ; 58 flux->data.F32[n] = source->pixels->data.F32[iy][ix]; 59 variance->data.F32[n] = source->variance->data.F32[iy][ix]; 60 n++; 61 } 41 42 // generate a single, normalized radial profile following the elliptical contours. 43 // the radius is normalized by the axis ratio so that on the major axis, 1 pixel = 1 pixel 44 if (!psphotEllipticalProfile (source, RAW_RADIUS)) { 45 psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile"); 46 return false; 62 47 } 63 radius->n = n;64 variance->n = n;65 flux->n = n;66 67 // sort the vector set by the radius 68 PSSORT (radius->n, COMPARE_RADIUS, SWAP_RADIUS, NONE);69 48 49 // generated profile in averaged bins 50 if (!psphotRadialBins (recipe, source, Rmax, skynoise)) { 51 psError (PS_ERR_UNKNOWN, false, "failed to generate radial bins"); 52 return false; 53 } 54 70 55 return true; 71 56 }
Note:
See TracChangeset
for help on using the changeset viewer.
