Changeset 35644
- Timestamp:
- Jun 11, 2013, 9:15:36 AM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130509/psModules/src/objects/models
- Files:
-
- 9 edited
-
pmModel_DEV.c (modified) (8 diffs)
-
pmModel_EXP.c (modified) (7 diffs)
-
pmModel_GAUSS.c (modified) (6 diffs)
-
pmModel_PGAUSS.c (modified) (6 diffs)
-
pmModel_PS1_V1.c (modified) (6 diffs)
-
pmModel_QGAUSS.c (modified) (6 diffs)
-
pmModel_RGAUSS.c (modified) (6 diffs)
-
pmModel_SERSIC.c (modified) (8 diffs)
-
pmModel_TRAIL.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_DEV.c
r35560 r35644 123 123 124 124 // first, use Rmajor and index to find the central pixel flux (fraction of total flux) 125 psEllipseShape shape; 126 127 shape.sx = PAR[PM_PAR_SXX]; 128 shape.sy = PAR[PM_PAR_SYY]; 129 shape.sxy = PAR[PM_PAR_SXY]; 130 131 // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio 132 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 125 psEllipseAxes axes; 126 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 133 127 134 128 // get the central pixel flux from the lookup table … … 303 297 304 298 // set the shape parameters 305 // XXX adjust this? 306 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 299 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, true)) { 307 300 return false; 308 301 } … … 330 323 psF64 PM_MODEL_FLUX (const psVector *params) 331 324 { 332 psEllipseShape shape;333 334 325 psF32 *PAR = params->data.F32; 335 326 336 shape.sx = PAR[PM_PAR_SXX]; 337 shape.sy = PAR[PM_PAR_SYY]; 338 shape.sxy = PAR[PM_PAR_SXY]; 339 340 // for a non-circular DeVaucouleur, the flux of the Rmajor equivalent is scaled by the AspectRatio 341 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 327 psEllipseAxes axes; 328 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 342 329 float AspectRatio = axes.minor / axes.major; 343 330 … … 359 346 psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux) 360 347 { 361 psEllipseShape shape;362 363 348 psF32 *PAR = params->data.F32; 364 349 … … 370 355 return (1.0); 371 356 372 shape.sx = PAR[PM_PAR_SXX]; 373 shape.sy = PAR[PM_PAR_SYY]; 374 shape.sxy = PAR[PM_PAR_SXY]; 375 376 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 357 psEllipseAxes axes; 358 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 377 359 378 360 // f = Io exp(-z^n) -> z^n = ln(Io/f) … … 382 364 psAssert (isfinite(radius), "fix this code: radius should not be nan for Io = %f, flux = %f, major = %f (%f, %f, %f)", 383 365 PAR[PM_PAR_I0], flux, axes.major, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY]); 384 385 366 return (radius); 386 367 } … … 407 388 // the 2D PSF model fits polarization terms (E0,E1,E2) 408 389 // convert to shape terms (SXX,SYY,SXY) 409 if (!pmPSF_FitToModel (out, 0.1)) { 390 bool useReff = pmModelUseReff (modelPSF->type); 391 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 410 392 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 411 393 return false; … … 460 442 // convert to shape terms (SXX,SYY,SXY) 461 443 // XXX user-defined value for limit? 462 if (!pmPSF_FitToModel (PAR, 0.1)) { 444 bool useReff = pmModelUseReff (model->type); 445 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 463 446 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 464 447 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_EXP.c
r35560 r35644 115 115 116 116 // first, use Rmajor and index to find the central pixel flux (fraction of total flux) 117 psEllipseShape shape; 118 119 shape.sx = PAR[PM_PAR_SXX]; 120 shape.sy = PAR[PM_PAR_SYY]; 121 shape.sxy = PAR[PM_PAR_SXY]; 122 123 // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio 124 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 117 psEllipseAxes axes; 118 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 125 119 126 120 // get the central pixel flux from the lookup table … … 295 289 296 290 // set the shape parameters 297 // XXX adjust this? 298 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments)) { 291 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, true)) { 299 292 return false; 300 293 } … … 316 309 psF64 PM_MODEL_FLUX (const psVector *params) 317 310 { 318 psEllipseShape shape;319 320 311 psF32 *PAR = params->data.F32; 321 312 322 shape.sx = PAR[PM_PAR_SXX]; 323 shape.sy = PAR[PM_PAR_SYY]; 324 shape.sxy = PAR[PM_PAR_SXY]; 325 326 // for a non-circular Exponential, the flux of the Rmajor equivalent is scaled by the AspectRatio 327 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 313 psEllipseAxes axes; 314 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 328 315 float AspectRatio = axes.minor / axes.major; 329 316 … … 345 332 psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux) 346 333 { 347 psEllipseShape shape;348 349 334 psF32 *PAR = params->data.F32; 350 335 … … 356 341 return (1.0); 357 342 358 shape.sx = PAR[PM_PAR_SXX]; 359 shape.sy = PAR[PM_PAR_SYY]; 360 shape.sxy = PAR[PM_PAR_SXY]; 361 362 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 343 psEllipseAxes axes; 344 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 363 345 364 346 // f = Io exp(-sqrt(z)) -> sqrt(z) = ln(Io/f) … … 392 374 // the 2D PSF model fits polarization terms (E0,E1,E2) 393 375 // convert to shape terms (SXX,SYY,SXY) 394 if (!pmPSF_FitToModel (out, 0.1)) { 376 bool useReff = pmModelUseReff (modelPSF->type); 377 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 395 378 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 396 379 return false; … … 445 428 // convert to shape terms (SXX,SYY,SXY) 446 429 // XXX user-defined value for limit? 447 if (!pmPSF_FitToModel (PAR, 0.1)) { 430 bool useReff = pmModelUseReff (model->type); 431 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 448 432 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 449 433 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_GAUSS.c
r35560 r35644 200 200 201 201 // set the shape parameters 202 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments )) {202 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) { 203 203 return false; 204 204 } … … 219 219 psF64 PM_MODEL_FLUX (const psVector *params) 220 220 { 221 222 psEllipseShape shape;223 224 221 psF32 *PAR = params->data.F32; 225 222 226 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 227 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 228 shape.sxy = PAR[PM_PAR_SXY]; 223 psEllipseAxes axes; 224 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 229 225 230 226 // Area is equivalent to 2 pi sigma^2 231 // axes ratio < 20232 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);233 227 psF64 Area = 2.0 * M_PI * axes.major * axes.minor; 234 228 … … 242 236 psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux) 243 237 { 244 psEllipseShape shape;245 246 238 psF32 *PAR = params->data.F32; 247 239 … … 253 245 return (1.0); 254 246 255 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 256 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 257 shape.sxy = PAR[PM_PAR_SXY]; 258 259 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 247 psEllipseAxes axes; 248 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 249 260 250 psF64 radius = axes.major * sqrt (2.0 * log(PAR[PM_PAR_I0] / flux)); 261 251 psAssert (isfinite(radius), "fix this code: radius should not be nan for Io = %f, flux = %f, major = %f (%f, %f, %f)", … … 285 275 } 286 276 287 // the OLD 2D model for SXY actually fitted SXY / (SXX^-2 + SYY^-2); correct here288 // out[PM_PAR_SXY] = pmPSF_SXYtoModel (out);289 290 277 // the 2D PSF model fits polarization terms (E0,E1,E2) 291 278 // convert to shape terms (SXX,SYY,SXY) 292 // XXX user-defined value for limit? 293 if (!pmPSF_FitToModel (out, 0.1)) { 294 // psError(PM_ERR_PSF, false, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 279 bool useReff = pmModelUseReff (modelPSF->type); 280 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 295 281 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 296 282 return false; … … 343 329 // the 2D PSF model fits polarization terms (E0,E1,E2) 344 330 // convert to shape terms (SXX,SYY,SXY) 345 // XXX user-defined value for limit?346 if (!pmPSF_FitToModel (PAR, 0.1 )) {331 bool useReff = pmModelUseReff (model->type); 332 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 347 333 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 348 334 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_PGAUSS.c
r35560 r35644 201 201 202 202 // set the shape parameters 203 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments )) {203 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) { 204 204 return false; 205 205 } … … 222 222 { 223 223 float z, norm; 224 psEllipseShape shape;225 224 226 225 psF32 *PAR = params->data.F32; 227 226 228 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 229 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 230 shape.sxy = PAR[PM_PAR_SXY]; 231 232 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 227 psEllipseAxes axes; 228 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 229 233 230 float AspectRatio = axes.minor / axes.major; 234 231 … … 262 259 { 263 260 psF64 z; 264 psEllipseShape shape;265 261 266 262 psF32 *PAR = params->data.F32; … … 273 269 return (1.0); 274 270 275 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 276 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 277 shape.sxy = PAR[PM_PAR_SXY]; 278 279 // this estimates the radius assuming f(z) is roughly exp(-z) 280 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 271 psEllipseAxes axes; 272 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 273 281 274 psF64 sigma = axes.major; 282 275 … … 347 340 } 348 341 349 // the OLD 2D model for SXY actually fitted SXY / (SXX^-2 + SYY^-2); correct here350 // out[PM_PAR_SXY] = pmPSF_SXYtoModel (out);351 352 342 // the 2D PSF model fits polarization terms (E0,E1,E2) 353 343 // convert to shape terms (SXX,SYY,SXY) 354 if (!pmPSF_FitToModel (out, 0.1)) { 344 bool useReff = pmModelUseReff (modelPSF->type); 345 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 355 346 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 356 347 return false; … … 403 394 // the 2D PSF model fits polarization terms (E0,E1,E2) 404 395 // convert to shape terms (SXX,SYY,SXY) 405 // XXX user-defined value for limit?406 if (!pmPSF_FitToModel (PAR, 0.1 )) {396 bool useReff = pmModelUseReff (model->type); 397 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 407 398 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 408 399 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_PS1_V1.c
r35639 r35644 221 221 222 222 // set the shape parameters 223 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments )) {223 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) { 224 224 return false; 225 225 } … … 245 245 { 246 246 float z, norm; 247 psEllipseShape shape;248 247 249 248 psF32 *PAR = params->data.F32; 250 249 251 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 252 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 253 shape.sxy = PAR[PM_PAR_SXY]; 254 255 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 250 psEllipseAxes axes; 251 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 256 252 float AspectRatio = axes.minor / axes.major; 257 253 … … 285 281 { 286 282 psF64 z; 287 psEllipseShape shape;288 283 289 284 psF32 *PAR = params->data.F32; … … 293 288 if (flux >= PAR[PM_PAR_I0]) return 1.0; 294 289 295 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 296 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 297 shape.sxy = PAR[PM_PAR_SXY]; 298 299 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 290 psEllipseAxes axes; 291 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 300 292 psF64 sigma = axes.major; 301 293 … … 364 356 // the 2D PSF model fits polarization terms (E0,E1,E2) 365 357 // convert to shape terms (SXX,SYY,SXY) 366 if (!pmPSF_FitToModel (out, 0.1)) { 358 bool useReff = pmModelUseReff (modelPSF->type); 359 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 367 360 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 368 361 return false; … … 417 410 // convert to shape terms (SXX,SYY,SXY) 418 411 // XXX user-defined value for limit? 419 if (!pmPSF_FitToModel (PAR, 0.1)) { 412 bool useReff = pmModelUseReff (model->type); 413 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 420 414 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 421 415 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_QGAUSS.c
r35639 r35644 221 221 222 222 // set the shape parameters 223 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments )) {223 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) { 224 224 return false; 225 225 } … … 245 245 { 246 246 float z, norm; 247 psEllipseShape shape;248 247 249 248 psF32 *PAR = params->data.F32; 250 249 251 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 252 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 253 shape.sxy = PAR[PM_PAR_SXY]; 254 255 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 250 psEllipseAxes axes; 251 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 256 252 float AspectRatio = axes.minor / axes.major; 257 253 … … 285 281 { 286 282 psF64 z; 287 psEllipseShape shape;288 283 289 284 psF32 *PAR = params->data.F32; … … 293 288 if (flux >= PAR[PM_PAR_I0]) return 1.0; 294 289 295 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 296 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 297 shape.sxy = PAR[PM_PAR_SXY]; 298 299 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 290 psEllipseAxes axes; 291 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 300 292 psF64 sigma = axes.major; 301 293 … … 364 356 // the 2D PSF model fits polarization terms (E0,E1,E2) 365 357 // convert to shape terms (SXX,SYY,SXY) 366 if (!pmPSF_FitToModel (out, 0.1)) { 358 bool useReff = pmModelUseReff (modelPSF->type); 359 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 367 360 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 368 361 return false; … … 421 414 // the 2D PSF model fits polarization terms (E0,E1,E2) 422 415 // convert to shape terms (SXX,SYY,SXY) 423 // XXX user-defined value for limit?424 if (!pmPSF_FitToModel (PAR, 0.1 )) {416 bool useReff = pmModelUseReff (model->type); 417 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 425 418 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 426 419 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_RGAUSS.c
r35560 r35644 210 210 211 211 // set the shape parameters 212 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments )) {212 if (!pmModelSetShape(&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], source->moments, false)) { 213 213 return false; 214 214 } … … 234 234 { 235 235 float z, norm; 236 psEllipseShape shape;237 236 238 237 psF32 *PAR = params->data.F32; 239 238 240 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 241 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 242 shape.sxy = PAR[PM_PAR_SXY]; 243 244 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 239 psEllipseAxes axes; 240 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 245 241 float AspectRatio = axes.minor / axes.major; 246 242 … … 274 270 { 275 271 psF64 z; 276 psEllipseShape shape;277 272 278 273 psF32 *PAR = params->data.F32; … … 285 280 return (1.0); 286 281 287 shape.sx = PAR[PM_PAR_SXX] / M_SQRT2; 288 shape.sy = PAR[PM_PAR_SYY] / M_SQRT2; 289 shape.sxy = PAR[PM_PAR_SXY]; 290 291 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 282 psEllipseAxes axes; 283 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], false); 292 284 psF64 sigma = axes.major; 293 285 … … 357 349 // the 2D PSF model fits polarization terms (E0,E1,E2) 358 350 // convert to shape terms (SXX,SYY,SXY) 359 if (!pmPSF_FitToModel (out, 0.1)) { 351 bool useReff = pmModelUseReff (modelPSF->type); 352 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 360 353 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 361 354 return false; … … 409 402 // the 2D PSF model fits polarization terms (E0,E1,E2) 410 403 // convert to shape terms (SXX,SYY,SXY) 411 // XXX user-defined value for limit?412 if (!pmPSF_FitToModel (PAR, 0.1 )) {404 bool useReff = pmModelUseReff (model->type); 405 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 413 406 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 414 407 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_SERSIC.c
r35560 r35644 125 125 126 126 // first, use Rmajor and index to find the central pixel flux (fraction of total flux) 127 psEllipseShape shape; 128 129 shape.sx = PAR[PM_PAR_SXX]; 130 shape.sy = PAR[PM_PAR_SYY]; 131 shape.sxy = PAR[PM_PAR_SXY]; 132 133 // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio 134 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 127 psEllipseAxes axes; 128 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 135 129 136 130 // get the central pixel flux from the lookup table … … 347 341 axes.major = Rmajor; 348 342 axes.minor = Rminor; 349 psEllipseShape shape = psEllipseAxesToShape (axes); 350 351 if (!isfinite(shape.sx)) return false; 352 if (!isfinite(shape.sy)) return false; 353 if (!isfinite(shape.sxy)) return false; 343 344 pmModelAxesToParams (&PAR[PM_PAR_SXX], &PAR[PM_PAR_SXY], &PAR[PM_PAR_SYY], axes, true); 354 345 355 346 float bn = 1.9992*index - 0.3271; … … 357 348 float Io = exp(0.5*bn); 358 349 359 float Sxx = PS_MAX(0.5, shape.sx);360 float Syy = PS_MAX(0.5, shape.sy);361 362 PAR[PM_PAR_SXX] = Sxx;363 PAR[PM_PAR_SYY] = Syy;364 PAR[PM_PAR_SXY] = shape.sxy;365 366 350 // set the model normalization (adjust for Sersic best guess) 367 351 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { … … 381 365 psF64 PM_MODEL_FLUX (const psVector *params) 382 366 { 383 psEllipseShape shape;384 385 367 psF32 *PAR = params->data.F32; 386 368 387 shape.sx = PAR[PM_PAR_SXX]; 388 shape.sy = PAR[PM_PAR_SYY]; 389 shape.sxy = PAR[PM_PAR_SXY]; 390 391 // for a non-circular Sersic, the flux of the Rmajor equivalent is scaled by the AspectRatio 392 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 369 psEllipseAxes axes; 370 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 393 371 float AspectRatio = axes.minor / axes.major; 394 372 … … 410 388 psF64 PM_MODEL_RADIUS (const psVector *params, psF64 flux) 411 389 { 412 psEllipseShape shape;413 414 390 psF32 *PAR = params->data.F32; 415 391 … … 421 397 return (1.0); 422 398 423 shape.sx = PAR[PM_PAR_SXX]; 424 shape.sy = PAR[PM_PAR_SYY]; 425 shape.sxy = PAR[PM_PAR_SXY]; 426 427 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 399 psEllipseAxes axes; 400 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], true); 428 401 429 402 // f = Io exp(-z^n) -> z^n = ln(Io/f) … … 457 430 // the 2D PSF model fits polarization terms (E0,E1,E2) 458 431 // convert to shape terms (SXX,SYY,SXY) 459 if (!pmPSF_FitToModel (out, 0.1)) { 432 bool useReff = pmModelUseReff (modelPSF->type); 433 if (!pmPSF_FitToModel (out, 0.1, useReff)) { 460 434 psTrace("psModules.objects", 5, "Failed to fit object at (r,c) = (%.1f,%.1f)", in[PM_PAR_YPOS], in[PM_PAR_XPOS]); 461 435 return false; … … 510 484 // convert to shape terms (SXX,SYY,SXY) 511 485 // XXX user-defined value for limit? 512 if (!pmPSF_FitToModel (PAR, 0.1)) { 486 bool useReff = pmModelUseReff (model->type); 487 if (!pmPSF_FitToModel (PAR, 0.1, useReff)) { 513 488 psTrace ("psModules.objects", 3, "Failed to fit object at (r,c) = (%.1f,%.1f)", Xo, Yo); 514 489 return false; -
branches/eam_branches/ipp-20130509/psModules/src/objects/models/pmModel_TRAIL.c
r35639 r35644 350 350 PAR[PM_PAR_SKY] = 0.0; 351 351 352 // XXX test : modify the Io, SXX, SYY terms based on the psf SXX, SYY terms: 353 psEllipseShape psfShape; 354 psfShape.sx = source->modelPSF->params->data.F32[PM_PAR_SXX] / M_SQRT2; 355 psfShape.sxy = source->modelPSF->params->data.F32[PM_PAR_SXY]; 356 psfShape.sy = source->modelPSF->params->data.F32[PM_PAR_SYY] / M_SQRT2; 357 psEllipseAxes psfAxes = psEllipseShapeToAxes (psfShape, 20.0); 352 psF32 *psfPAR = source->modelPSF->params->data.F32; 353 bool useReff = pmModelUseReff (source->modelPSF->type); 354 355 psEllipseAxes psfAxes; 356 pmModelParamsToAxes (&psfAxes, psfPAR[PM_PAR_SXX], psfPAR[PM_PAR_SXY], psfPAR[PM_PAR_SYY], useReff); 358 357 359 358 psEllipseMoments emoments;
Note:
See TracChangeset
for help on using the changeset viewer.
