Index: trunk/psphot/src/psphotRadialProfile.c
===================================================================
--- trunk/psphot/src/psphotRadialProfile.c	(revision 15800)
+++ trunk/psphot/src/psphotRadialProfile.c	(revision 15801)
@@ -1,4 +1,19 @@
 # include "psphotInternal.h"
 
+# define COMPARE(A,B) (radius->data.F32[A] < radius->data.F32[B])
+# define SWAPFUNC(TYPE,A,B) { \
+  float tmp; \
+  if (A != B) { \
+    tmp = radius->data.F32[A]; \
+    radius->data.F32[A] = radius->data.F32[B]; \
+    radius->data.F32[B] = tmp; \
+    tmp = flux->data.F32[A]; \
+    flux->data.F32[A] = flux->data.F32[B]; \
+    flux->data.F32[B] = tmp; \
+    tmp = weight->data.F32[A]; \
+    weight->data.F32[A] = weight->data.F32[B]; \
+    weight->data.F32[B] = tmp; \
+  }
+    
 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psMaskType maskVal) {
 
@@ -40,6 +55,6 @@
     flux->n = n;
 
-    // XXX need to sort here
-    // SortVectorsByRadius (radius, flux, weight);
+    // sort the vector set by the radius
+    PSSORT (radius->n, COMPARE, SWAPFUNC, NONE);
 
     return true;
