- Timestamp:
- Jul 11, 2010, 3:24:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/ppSim/src/ppSimMakeGalaxies.c
r18011 r28659 96 96 galaxy->y = iy; 97 97 98 galaxy->peak = 20000;98 galaxy->peak = 1000; 99 99 100 galaxy->index = (galaxyIndexMin + i * galaxyIndexSlope); 101 galaxy->Rmaj = (galaxyRmajorMin + i * galaxyRmajorSlope); 100 // galaxyIndex from user should be for function of this form: exp(-r^(1/n)) 101 // galaxy->index = (1/2n) 102 103 float index = (galaxyIndexMin + i * galaxyIndexSlope); // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n) 104 galaxy->index = 0.5/index; 105 106 float scale = (galaxyRmajorMin + i * galaxyRmajorSlope); 107 108 // for a sersic model, 109 float bn = 1.9992*index - 0.3271; 110 float fR = 1.0 / (sqrt(2.0) * pow (bn, index)); 111 float Io = exp(bn); 112 113 // galaxy->Rmaj = scale * fR; 114 115 galaxy->Rmaj = scale; 102 116 galaxy->Rmin = (galaxyARatioMin + i * galaxyARatioSlope) * galaxy->Rmaj; 103 117 galaxy->theta = (galaxyThetaMin + i * galaxyThetaSlope); 118 119 // galaxy->peak *= Io; 120 121 fprintf (stderr, "Rmaj: %f, scale: %f, index: %f, bn: %f, Ro: %f, Io: %f\n", 122 galaxy->Rmaj, scale, index, bn, fR, Io); 104 123 105 124 psArrayAdd (galaxies, 100, galaxy); … … 124 143 galaxy->y = psRandomUniform(rng) * ySize; // y position 125 144 126 galaxy->flux = pow ((double)((i + 1) / norm), (double) (1.0 / galaxyLum));145 // galaxy->flux = pow ((double)((i + 1) / norm), (double) (1.0 / galaxyLum)); 127 146 128 galaxy->index = ( psRandomUniform(rng) * galaxyIndexSlope + galaxyIndexMin);147 galaxy->index = (sqrt(psRandomUniform(rng)) * galaxyIndexSlope + galaxyIndexMin); 129 148 galaxy->theta = (psRandomUniform(rng) * galaxyThetaSlope + galaxyThetaMin); 130 149 galaxy->Rmaj = (psRandomUniform(rng) * galaxyRmajorSlope + galaxyRmajorMin); 131 galaxy->Rmin = ( psRandomUniform(rng) * galaxyARatioSlope + galaxyARatioMin) * galaxy->Rmaj;150 galaxy->Rmin = (PS_SQR(psRandomUniform(rng)) * galaxyARatioSlope + galaxyARatioMin) * galaxy->Rmaj; 132 151 152 // the flux is only approximately correct (scaling of the peak is wrong) 153 // elsewhere (ppSimInsertGalaxies.c) we calculate the true galaxy flux 133 154 galaxy->flux = expf((logf(i + 1) - logf(norm)) / galaxyLum); // Peak flux 134 155 galaxy->peak = galaxy->flux / (2.0*M_PI*PS_SQR(seeing)); 135 // galaxy->peak = 5000;136 156 137 157 psArrayAdd (galaxies, 100, galaxy);
Note:
See TracChangeset
for help on using the changeset viewer.
