Index: trunk/psModules/src/objects/pmModelUtils.c
===================================================================
--- trunk/psModules/src/objects/pmModelUtils.c	(revision 34403)
+++ trunk/psModules/src/objects/pmModelUtils.c	(revision 35768)
@@ -118,5 +118,66 @@
 }
 
-bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments) {
+bool pmModelUseReff (pmModelType type) {
+    bool useReff = false;
+    useReff |= (type == pmModelClassGetType ("PS_MODEL_SERSIC"));
+    useReff |= (type == pmModelClassGetType ("PS_MODEL_DEV"));
+    useReff |= (type == pmModelClassGetType ("PS_MODEL_EXP"));
+    return useReff;
+}
+
+// this function and the one below handle the two cases, where the model shape is uses R_eff or Sigma
+bool pmModelAxesToParams (float *Sxx, float *Sxy, float *Syy, psEllipseAxes axes, bool useReff)  {
+
+    psEllipseShape shape = psEllipseAxesToShape (axes);
+
+    if (!isfinite(shape.sx))  return false;
+    if (!isfinite(shape.sy))  return false;
+    if (!isfinite(shape.sxy)) return false;
+
+    // set the shape parameters
+    if (useReff) {
+	*Sxx  = PS_MAX(0.5, shape.sx);
+	*Syy  = PS_MAX(0.5, shape.sy);
+	*Sxy  = shape.sxy * 2.0;
+    } else {
+	*Sxx  = PS_MAX(0.5, M_SQRT2*shape.sx);
+	*Syy  = PS_MAX(0.5, M_SQRT2*shape.sy);
+	*Sxy  = shape.sxy;
+    }
+
+    return true;
+}
+
+bool pmModelParamsToAxes (psEllipseAxes *axes, float Sxx, float Sxy, float Syy, bool useReff)  {
+
+    psEllipseShape shape;
+
+    // set the shape parameters
+    if (useReff) {
+	shape.sx  = Sxx;
+	shape.sy  = Syy;
+	shape.sxy = Sxy / 2.0;
+    } else {
+	shape.sx  = Sxx / M_SQRT2;
+	shape.sy  = Syy / M_SQRT2;
+	shape.sxy = Sxy;
+    }
+
+    if ((shape.sx == 0) || (shape.sy == 0)) {
+        axes->major = 0.0;
+        axes->minor = 0.0;
+        axes->theta = 0.0;
+    } else {
+	// axes ratio < 20
+	// replace with maxAR argument?
+	*axes = psEllipseShapeToAxes (shape, 20.0);
+    }
+
+    return true;
+}
+
+// Reff says if this is a model which uses R_eff (like exp or dev) instead of Sigma
+// set the parameter values SXX, SXY, SYY
+bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments, bool useReff) {
 
     psEllipseMoments emoments;
@@ -137,14 +198,5 @@
     axes.minor *= scale;
 
-    psEllipseShape shape = psEllipseAxesToShape (axes);
-
-    if (!isfinite(shape.sx))  return false;
-    if (!isfinite(shape.sy))  return false;
-    if (!isfinite(shape.sxy)) return false;
-
-    // set the shape parameters
-    *Sxx  = PS_MAX(0.5, M_SQRT2*shape.sx);
-    *Syy  = PS_MAX(0.5, M_SQRT2*shape.sy);
-    *Sxy  = shape.sxy;
+    pmModelAxesToParams (Sxx, Sxy, Syy, axes, useReff);
 
     return true;
