- Timestamp:
- Aug 19, 2013, 6:42:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130711/ppSim/src/ppSimMakeGalaxies.c
r34261 r35970 204 204 } 205 205 206 float pmSersicNorm (float index) { 207 208 float C0 = NAN; 209 float C1 = NAN; 210 float C2 = NAN; 211 212 // y = 0.201545 x^0 -0.950965 x^1 -0.315248 x^2 213 // y = 0.402084 x^0 -1.357775 x^1 -0.105102 x^2 214 // y = 0.619093 x^0 -1.591674 x^1 -0.041576 x^2 215 // y = 0.770263 x^0 -1.696421 x^1 -0.023363 x^2 216 // y = 0.885891 x^0 -1.755684 x^1 -0.015753 x^2 217 218 if ((index >= 0.0) && (index < 1.0)) { 219 C0 = 0.201545; C1 = -0.950965; C2 = -0.315248; 220 // y = 0.201545 x^0 -0.950965 x^1 -0.315248 x^2 221 } 222 if ((index >= 1.0) && (index < 2.0)) { 223 C0 = 0.402084; C1 = -1.357775; C2 = -0.105102; 224 // y = 0.402084 x^0 -1.357775 x^1 -0.105102 x^2 225 } 226 if ((index >= 2.0) && (index < 3.0)) { 227 C0 = 0.619093; C1 = -1.591674; C2 = -0.041576; 228 // y = 0.619093 x^0 -1.591674 x^1 -0.041576 x^2 229 } 230 if ((index >= 3.0) && (index < 4.0)) { 231 C0 = 0.770263; C1 = -1.696421; C2 = -0.023363; 232 // y = 0.770263 x^0 -1.696421 x^1 -0.023363 x^2 233 } 234 if ((index >= 4.0) && (index < 5.5)) { 235 C0 = 0.885891; C1 = -1.755684; C2 = -0.015753; 236 // y = 0.885891 x^0 -1.755684 x^1 -0.015753 x^2 237 } 238 239 if (isnan(C0)) return NAN; 240 241 float lnorm = C0 + C1*index + C2*index*index; 242 float norm = exp(lnorm); 243 return norm; 244 } 245 206 246 bool ppSimSetGalaxyPeak (ppSimGalaxy *galaxy, pmModelType type, float index, float seeing) { 207 247 … … 219 259 } 220 260 261 // exponential 262 // f = I0 exp (sqrt(z)) (index = 1.0) 263 264 // f = I0 exp (-0.5*z) 265 221 266 if (isSersicType) { 222 267 // for a sersic model, 223 float bn = 1.9992*index - 0.3271;224 float Io = exp(bn);268 // float bn = 1.9992*index - 0.3271; 269 // float Io = exp(bn); 225 270 226 271 // the integral of a Sersic has an analytical form as follows: 227 float logGamma = lgamma(2.0*index);228 float bnFactor = pow(bn, 2.0*index);229 float norm = 2.0 * M_PI * PS_SQR(galaxy->Rmaj) * index * Io * exp(logGamma) / bnFactor;272 // float logGamma = lgamma(2.0*index); 273 // float bnFactor = pow(bn, 2.0*index); 274 // float norm = 2.0 * M_PI * PS_SQR(galaxy->Rmaj) * index * Io * exp(logGamma) / bnFactor; 230 275 276 // find the flux of a sersic with peak = 1.0: 277 float norm = pmSersicNorm (index); 278 float flux = 2.0 * M_PI * galaxy->Rmaj * galaxy->Rmin * norm; 279 231 280 // XXX probably should limit the allowed thinness of a galaxy 232 galaxy->peak = galaxy->flux / norm / (galaxy->Rmin / galaxy->Rmaj);281 galaxy->peak = galaxy->flux / flux; 233 282 return true; 234 283 }
Note:
See TracChangeset
for help on using the changeset viewer.
