Changeset 31034
- Timestamp:
- Mar 24, 2011, 11:39:04 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213
- Files:
-
- 11 edited
-
psModules/src/objects/models/pmModel_DEV.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_EXP.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_GAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_PGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_PS1_V1.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_QGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_RGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_SERSIC.c (modified) (3 diffs)
-
psModules/src/objects/pmModelUtils.c (modified) (1 diff)
-
psModules/src/objects/pmModelUtils.h (modified) (1 diff)
-
psphot/src/psphotGuessModels.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_DEV.c
r31031 r31034 217 217 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 218 218 { 219 pmMoments *moments = source->moments; 220 pmPeak *peak = source->peak; 221 psF32 *PAR = model->params->data.F32; 222 223 psEllipseMoments emoments; 224 emoments.x2 = moments->Mxx; 225 emoments.xy = moments->Mxy; 226 emoments.y2 = moments->Myy; 227 228 // force the axis ratio to be < 20.0 229 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 230 231 if (!isfinite(axes.major)) return false; 232 if (!isfinite(axes.minor)) return false; 233 if (!isfinite(axes.theta)) return false; 234 235 psEllipseShape shape = psEllipseAxesToShape (axes); 236 237 if (!isfinite(shape.sx)) return false; 238 if (!isfinite(shape.sy)) return false; 239 if (!isfinite(shape.sxy)) return false; 240 241 // the other parameters depend on the guess for PAR_7 219 psF32 *PAR = model->params->data.F32; 220 221 // sky is set to 0.0 222 PAR[PM_PAR_SKY] = 0.0; 223 224 // set the shape parameters 225 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 226 return false; 227 } 228 229 // the normalization is modified by the slope 242 230 float index = 0.5 / ALPHA; 243 231 float bn = 1.9992*index - 0.3271; 244 // float fR = 1.0 / (sqrt(2.0) * pow (bn, index));245 232 float Io = exp(0.5*bn); 246 233 247 float Sxx = PS_MAX(0.5, shape.sx); 248 float Syy = PS_MAX(0.5, shape.sy); 249 250 PAR[PM_PAR_SKY] = 0.0; 251 PAR[PM_PAR_I0] = peak->rawFlux / Io; 252 PAR[PM_PAR_XPOS] = peak->xf; 253 PAR[PM_PAR_YPOS] = peak->yf; 254 // PAR[PM_PAR_SXX] = Sxx * fR; 255 // PAR[PM_PAR_SYY] = Syy * fR; 256 PAR[PM_PAR_SXX] = Sxx; 257 PAR[PM_PAR_SYY] = Syy; 258 PAR[PM_PAR_SXY] = shape.sxy; 234 // set the model normalization 235 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 236 return false; 237 } 238 PAR[PM_PAR_I0] /= Io; 239 240 // set the model position 241 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 242 return false; 243 } 259 244 260 245 return(true); -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_EXP.c
r31031 r31034 210 210 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 211 211 { 212 pmMoments *moments = source->moments; 213 pmPeak *peak = source->peak; 214 psF32 *PAR = model->params->data.F32; 215 216 psEllipseMoments emoments; 217 emoments.x2 = moments->Mxx; 218 emoments.xy = moments->Mxy; 219 emoments.y2 = moments->Myy; 220 221 // force the axis ratio to be < 20.0 222 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 223 224 if (!isfinite(axes.major)) return false; 225 if (!isfinite(axes.minor)) return false; 226 if (!isfinite(axes.theta)) return false; 227 228 psEllipseShape shape = psEllipseAxesToShape (axes); 229 230 if (!isfinite(shape.sx)) return false; 231 if (!isfinite(shape.sy)) return false; 232 if (!isfinite(shape.sxy)) return false; 233 212 psF32 *PAR = model->params->data.F32; 213 214 // sky is set to 0.0 234 215 PAR[PM_PAR_SKY] = 0.0; 235 PAR[PM_PAR_I0] = peak->rawFlux; 236 PAR[PM_PAR_XPOS] = peak->xf; 237 PAR[PM_PAR_YPOS] = peak->yf; 238 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 239 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 240 PAR[PM_PAR_SXY] = shape.sxy; 216 217 // set the shape parameters 218 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 219 return false; 220 } 221 222 // set the model normalization 223 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 224 return false; 225 } 226 227 // set the model position 228 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 229 return false; 230 } 231 241 232 return(true); 242 233 } -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_GAUSS.c
r31031 r31034 193 193 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 194 194 { 195 pmMoments *moments = source->moments; 196 pmPeak *peak = source->peak; 197 psF32 *PAR = model->params->data.F32; 198 199 psEllipseMoments emoments; 200 emoments.x2 = moments->Mxx; 201 emoments.y2 = moments->Myy; 202 emoments.xy = moments->Mxy; 203 204 // force the axis ratio to be < 20.0 205 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 206 psEllipseShape shape = psEllipseAxesToShape (axes); 207 195 psF32 *PAR = model->params->data.F32; 196 197 // sky is set to 0.0 208 198 PAR[PM_PAR_SKY] = 0.0; 209 PAR[PM_PAR_I0] = peak->rawFlux; 210 PAR[PM_PAR_XPOS] = peak->xf; 211 PAR[PM_PAR_YPOS] = peak->yf; 212 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 213 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 214 PAR[PM_PAR_SXY] = shape.sxy; 199 200 // set the shape parameters 201 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 202 return false; 203 } 204 205 // set the model normalization 206 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 207 return false; 208 } 209 210 // set the model position 211 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 212 return false; 213 } 214 215 215 return(true); 216 216 } -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_PGAUSS.c
r31031 r31034 194 194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 195 195 { 196 pmMoments *moments = source->moments; 197 pmPeak *peak = source->peak; 198 psF32 *PAR = model->params->data.F32; 199 200 psEllipseMoments emoments; 201 emoments.x2 = moments->Mxx; 202 emoments.xy = moments->Mxy; 203 emoments.y2 = moments->Myy; 204 205 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 206 psEllipseShape shape = psEllipseAxesToShape (axes); 207 196 psF32 *PAR = model->params->data.F32; 197 198 // sky is set to 0.0 208 199 PAR[PM_PAR_SKY] = 0.0; 209 PAR[PM_PAR_I0] = peak->rawFlux; 210 PAR[PM_PAR_XPOS] = peak->xf; 211 PAR[PM_PAR_YPOS] = peak->yf; 212 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 213 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 214 PAR[PM_PAR_SXY] = shape.sxy; 200 201 // set the shape parameters 202 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 203 return false; 204 } 205 206 // set the model normalization 207 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 208 return false; 209 } 210 211 // set the model position 212 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 213 return false; 214 } 215 215 216 return(true); 216 217 } -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_PS1_V1.c
r31031 r31034 213 213 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 214 214 { 215 pmMoments *moments = source->moments; 216 pmPeak *peak = source->peak; 217 psF32 *PAR = model->params->data.F32; 218 219 psEllipseMoments emoments; 220 emoments.x2 = moments->Mxx; 221 emoments.xy = moments->Mxy; 222 emoments.y2 = moments->Myy; 223 224 // force the axis ratio to be < 20.0 225 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 226 227 if (!isfinite(axes.major)) return false; 228 if (!isfinite(axes.minor)) return false; 229 if (!isfinite(axes.theta)) return false; 230 231 psEllipseShape shape = psEllipseAxesToShape (axes); 232 233 if (!isfinite(shape.sx)) return false; 234 if (!isfinite(shape.sy)) return false; 235 if (!isfinite(shape.sxy)) return false; 236 215 psF32 *PAR = model->params->data.F32; 216 217 // sky is set to 0.0 237 218 PAR[PM_PAR_SKY] = 0.0; 238 PAR[PM_PAR_I0] = peak->rawFlux; 239 PAR[PM_PAR_XPOS] = peak->xf; 240 PAR[PM_PAR_YPOS] = peak->yf; 241 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 242 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 243 PAR[PM_PAR_SXY] = shape.sxy; 219 220 // set the shape parameters 221 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 222 return false; 223 } 224 225 // set the model normalization 226 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 227 return false; 228 } 229 230 // set the model position 231 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 232 return false; 233 } 234 235 // extra parameter 244 236 PAR[PM_PAR_7] = 0.5; 245 237 -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_QGAUSS.c
r31031 r31034 214 214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 215 215 { 216 pmMoments *moments = source->moments; 217 pmPeak *peak = source->peak; 218 psF32 *PAR = model->params->data.F32; 219 220 psEllipseMoments emoments; 221 emoments.x2 = moments->Mxx; 222 emoments.xy = moments->Mxy; 223 emoments.y2 = moments->Myy; 224 225 // force the axis ratio to be < 20.0 226 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 227 228 if (!isfinite(axes.major)) return false; 229 if (!isfinite(axes.minor)) return false; 230 if (!isfinite(axes.theta)) return false; 231 232 psEllipseShape shape = psEllipseAxesToShape (axes); 233 234 if (!isfinite(shape.sx)) return false; 235 if (!isfinite(shape.sy)) return false; 236 if (!isfinite(shape.sxy)) return false; 237 216 psF32 *PAR = model->params->data.F32; 217 218 // sky is set to 0.0 238 219 PAR[PM_PAR_SKY] = 0.0; 239 PAR[PM_PAR_I0] = peak->rawFlux; 240 PAR[PM_PAR_XPOS] = peak->xf; 241 PAR[PM_PAR_YPOS] = peak->yf; 242 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 243 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 244 PAR[PM_PAR_SXY] = shape.sxy; 220 221 // set the shape parameters 222 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 223 return false; 224 } 225 226 // set the model normalization 227 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 228 return false; 229 } 230 231 // set the model position 232 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 233 return false; 234 } 235 236 // extra parameter 245 237 PAR[PM_PAR_7] = 1.0; 246 238 -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_RGAUSS.c
r31031 r31034 203 203 bool PM_MODEL_GUESS (pmModel *model, pmSource *source) 204 204 { 205 pmMoments *moments = source->moments; 206 pmPeak *peak = source->peak; 207 psF32 *PAR = model->params->data.F32; 208 209 psEllipseMoments emoments; 210 emoments.x2 = moments->Mxx; 211 emoments.xy = moments->Mxy; 212 emoments.y2 = moments->Myy; 213 214 // force the axis ratio to be < 20.0 215 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 216 217 if (!isfinite(axes.major)) return false; 218 if (!isfinite(axes.minor)) return false; 219 if (!isfinite(axes.theta)) return false; 220 221 psEllipseShape shape = psEllipseAxesToShape (axes); 222 223 if (!isfinite(shape.sx)) return false; 224 if (!isfinite(shape.sy)) return false; 225 if (!isfinite(shape.sxy)) return false; 226 205 psF32 *PAR = model->params->data.F32; 206 207 // sky is set to 0.0 227 208 PAR[PM_PAR_SKY] = 0.0; 228 PAR[PM_PAR_I0] = peak->rawFlux; 229 PAR[PM_PAR_XPOS] = peak->xf; 230 PAR[PM_PAR_YPOS] = peak->yf; 231 PAR[PM_PAR_SXX] = PS_MAX(0.5, shape.sx); 232 PAR[PM_PAR_SYY] = PS_MAX(0.5, shape.sy); 233 PAR[PM_PAR_SXY] = shape.sxy; 209 210 // set the shape parameters 211 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 212 return false; 213 } 214 215 // set the model normalization 216 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 217 return false; 218 } 219 220 // set the model position 221 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 222 return false; 223 } 224 225 // extra parameter 234 226 PAR[PM_PAR_7] = 1.5; 235 227 -
branches/eam_branches/ipp-20110213/psModules/src/objects/models/pmModel_SERSIC.c
r31031 r31034 222 222 { 223 223 pmMoments *moments = source->moments; 224 pmPeak *peak = source->peak;225 224 psF32 *PAR = model->params->data.F32; 225 226 // sky is set to 0.0 227 PAR[PM_PAR_SKY] = 0.0; 226 228 227 229 // the other parameters depend on the guess for PAR_7 … … 236 238 float Zero = 1.16 - 0.615 * PAR[PM_PAR_7]; 237 239 240 // Sersic shape is a bit special 238 241 psEllipseMoments emoments; 239 242 emoments.x2 = moments->Mxx; … … 273 276 float Syy = PS_MAX(0.5, shape.sy); 274 277 275 PAR[PM_PAR_SKY] = 0.0;276 PAR[PM_PAR_I0] = peak->rawFlux / Io;277 PAR[PM_PAR_XPOS] = peak->xf;278 PAR[PM_PAR_YPOS] = peak->yf;279 278 PAR[PM_PAR_SXX] = Sxx; 280 279 PAR[PM_PAR_SYY] = Syy; 281 280 PAR[PM_PAR_SXY] = shape.sxy; 281 282 // set the model normalization (adjust for Sersic best guess) 283 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 284 return false; 285 } 286 PAR[PM_PAR_I0] /= Io; 287 288 // set the model position 289 if (!pmModelSetPosition(&PAR[PM_PAR_XPOS], &PAR[PM_PAR_YPOS], source)) { 290 return false; 291 } 282 292 283 293 return(true); -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmModelUtils.c
r29004 r31034 107 107 return true; 108 108 } 109 110 bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments) { 111 112 psEllipseMoments emoments; 113 emoments.x2 = moments->Mxx; 114 emoments.xy = moments->Mxy; 115 emoments.y2 = moments->Myy; 116 117 // force the axis ratio to be < 20.0 118 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 119 120 if (!isfinite(axes.major)) return false; 121 if (!isfinite(axes.minor)) return false; 122 if (!isfinite(axes.theta)) return false; 123 124 psEllipseShape shape = psEllipseAxesToShape (axes); 125 126 if (!isfinite(shape.sx)) return false; 127 if (!isfinite(shape.sy)) return false; 128 if (!isfinite(shape.sxy)) return false; 129 130 // set the shape parameters 131 *Sxx = PS_MAX(0.5, M_SQRT2*shape.sx); 132 *Syy = PS_MAX(0.5, M_SQRT2*shape.sy); 133 *Sxy = shape.sxy; 134 135 return true; 136 } 137 138 bool pmModelSetNorm (float *Io, pmSource *source) { 139 140 *Io = source->peak->rawFlux; 141 if (!isfinite(*Io) && !source->moments) return false; 142 143 *Io = source->moments->Peak; 144 if (!isfinite(*Io)) return false; 145 146 return true; 147 } 148 149 bool pmModelSetPosition (float *Xo, float *Yo, pmSource *source) { 150 151 bool useMoments = pmSourcePositionUseMoments(source); 152 153 if (useMoments) { 154 *Xo = source->moments->Mx; 155 *Yo = source->moments->My; 156 } else { 157 *Xo = source->peak->xf; 158 *Yo = source->peak->yf; 159 } 160 161 return true; 162 } -
branches/eam_branches/ipp-20110213/psModules/src/objects/pmModelUtils.h
r15843 r31034 42 42 ); 43 43 44 44 bool pmModelSetPosition (float *Xo, float *Yo, pmSource *source); 45 bool pmModelSetNorm (float *Io, pmSource *source); 46 bool pmModelSetShape (float *Sxx, float *Sxy, float *Syy, pmMoments *moments); 45 47 46 48 /// @} -
branches/eam_branches/ipp-20110213/psphot/src/psphotGuessModels.c
r30975 r31034 177 177 // the guess central intensity comes from the peak: 178 178 float Io = source->peak->rawFlux; 179 if (!isfinite(Io) && source->moments) { 180 Io = source->moments->Peak; 181 } 179 182 180 183 // We have two options to get a guess for the object position: the position from the
Note:
See TracChangeset
for help on using the changeset viewer.
