Index: branches/pap/psphot/src/psphotRadialProfile.c
===================================================================
--- branches/pap/psphot/src/psphotRadialProfile.c	(revision 27708)
+++ branches/pap/psphot/src/psphotRadialProfile.c	(revision 28003)
@@ -3,11 +3,9 @@
 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal) {
 
+    bool status;
+
     // allocate pmSourceExtendedParameters, if not already defined
     if (!source->extpars) {
         source->extpars = pmSourceExtendedParsAlloc ();
-    }
-
-    if (!source->extpars->profile) {
-        source->extpars->profile = pmSourceRadialProfileAlloc ();
     }
 
@@ -17,4 +15,6 @@
     float fluxMin = 0.0;
     float fluxMax = source->peak->flux;
+
+    bool RAW_RADIUS = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_RAW_RADIUS");
 
     // generate a series of radial profiles at Nsec evenly spaced angles.  the profile flux
@@ -28,5 +28,5 @@
     // use the radial profiles to determine the radius of a given isophote.  this isophote
     // is used to determine the elliptical shape of the object, so it has a relatively high
-    // value (nominally 50% of the peak)
+    // value (nominally 25% of the peak)
     if (!psphotRadiiFromProfiles (source, fluxMin, fluxMax)) {
 	psError (PS_ERR_UNKNOWN, false, "failed to measure isophotal radii from profiles");
@@ -42,6 +42,12 @@
     // generate a single, normalized radial profile following the elliptical contours.
     // the radius is normalized by the axis ratio so that on the major axis, 1 pixel = 1 pixel
-    if (!psphotEllipticalProfile (source)) {
+    if (!psphotEllipticalProfile (source, RAW_RADIUS)) {
 	psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile");
+	return false;
+    }
+  
+    // generated profile in averaged bins
+    if (!psphotRadialBins (recipe, source, Rmax, skynoise)) {
+	psError (PS_ERR_UNKNOWN, false, "failed to generate radial bins");
 	return false;
     }
