Changeset 35768 for trunk/psModules/src/objects/pmModelUtils.c
- Timestamp:
- Jul 3, 2013, 2:37:22 PM (13 years ago)
- Location:
- trunk/psModules
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/objects/pmModelUtils.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130509/psModules (added) merged: 35594,35613,35628,35638-35639,35643-35648,35653,35657,35662,35750
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/pmModelUtils.c
r34403 r35768 118 118 } 119 119 120 bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments) { 120 bool pmModelUseReff (pmModelType type) { 121 bool useReff = false; 122 useReff |= (type == pmModelClassGetType ("PS_MODEL_SERSIC")); 123 useReff |= (type == pmModelClassGetType ("PS_MODEL_DEV")); 124 useReff |= (type == pmModelClassGetType ("PS_MODEL_EXP")); 125 return useReff; 126 } 127 128 // this function and the one below handle the two cases, where the model shape is uses R_eff or Sigma 129 bool pmModelAxesToParams (float *Sxx, float *Sxy, float *Syy, psEllipseAxes axes, bool useReff) { 130 131 psEllipseShape shape = psEllipseAxesToShape (axes); 132 133 if (!isfinite(shape.sx)) return false; 134 if (!isfinite(shape.sy)) return false; 135 if (!isfinite(shape.sxy)) return false; 136 137 // set the shape parameters 138 if (useReff) { 139 *Sxx = PS_MAX(0.5, shape.sx); 140 *Syy = PS_MAX(0.5, shape.sy); 141 *Sxy = shape.sxy * 2.0; 142 } else { 143 *Sxx = PS_MAX(0.5, M_SQRT2*shape.sx); 144 *Syy = PS_MAX(0.5, M_SQRT2*shape.sy); 145 *Sxy = shape.sxy; 146 } 147 148 return true; 149 } 150 151 bool pmModelParamsToAxes (psEllipseAxes *axes, float Sxx, float Sxy, float Syy, bool useReff) { 152 153 psEllipseShape shape; 154 155 // set the shape parameters 156 if (useReff) { 157 shape.sx = Sxx; 158 shape.sy = Syy; 159 shape.sxy = Sxy / 2.0; 160 } else { 161 shape.sx = Sxx / M_SQRT2; 162 shape.sy = Syy / M_SQRT2; 163 shape.sxy = Sxy; 164 } 165 166 if ((shape.sx == 0) || (shape.sy == 0)) { 167 axes->major = 0.0; 168 axes->minor = 0.0; 169 axes->theta = 0.0; 170 } else { 171 // axes ratio < 20 172 // replace with maxAR argument? 173 *axes = psEllipseShapeToAxes (shape, 20.0); 174 } 175 176 return true; 177 } 178 179 // Reff says if this is a model which uses R_eff (like exp or dev) instead of Sigma 180 // set the parameter values SXX, SXY, SYY 181 bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments, bool useReff) { 121 182 122 183 psEllipseMoments emoments; … … 137 198 axes.minor *= scale; 138 199 139 psEllipseShape shape = psEllipseAxesToShape (axes); 140 141 if (!isfinite(shape.sx)) return false; 142 if (!isfinite(shape.sy)) return false; 143 if (!isfinite(shape.sxy)) return false; 144 145 // set the shape parameters 146 *Sxx = PS_MAX(0.5, M_SQRT2*shape.sx); 147 *Syy = PS_MAX(0.5, M_SQRT2*shape.sy); 148 *Sxy = shape.sxy; 200 pmModelAxesToParams (Sxx, Sxy, Syy, axes, useReff); 149 201 150 202 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
