- Timestamp:
- Jul 15, 2010, 6:29:09 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/ppSim/src/ppSimMakeGalaxies.c
r28659 r28675 18 18 int galaxyGridDX = psMetadataLookupS32(&mdok, recipe, "GALAXY.GRID.DX"); // Density of fakes 19 19 int galaxyGridDY = psMetadataLookupS32(&mdok, recipe, "GALAXY.GRID.DY"); // Density of fakes 20 bool galaxyGridRandom = psMetadataLookupBool(&mdok, recipe, "GALAXY.GRID.RANDOM"); // Density of fakes 20 21 21 22 float galaxyRmajorMax = psMetadataLookupF32(&mdok, recipe, "GALAXY.RMAJOR.MAX"); // Density of fakes … … 43 44 44 45 if (galaxyDensity <= 0) return true; 46 47 if (galaxyGridRandom) { 48 long A, B; 49 A = time(NULL); 50 for (B = 0; A == time(NULL); B++); 51 srand48(B); 52 } 45 53 46 54 // Size of FPA … … 81 89 psLogMsg("ppSim", PS_LOG_INFO, "Adding grid of %ld galaxies\n", num); 82 90 83 float galaxyIndexSlope = (galaxyIndexMax - galaxyIndexMin) / num;84 float galaxyThetaSlope = (galaxyThetaMax - galaxyThetaMin) / num;85 float galaxyARatioSlope = (galaxyARatioMax - galaxyARatioMin) / num;86 float galaxyRmajorSlope = (galaxyRmajorMax - galaxyRmajorMin) / num;91 float galaxyIndexSlope = (galaxyIndexMax - galaxyIndexMin); 92 float galaxyThetaSlope = (galaxyThetaMax - galaxyThetaMin); 93 float galaxyARatioSlope = (galaxyARatioMax - galaxyARatioMin); 94 float galaxyRmajorSlope = (galaxyRmajorMax - galaxyRmajorMin); 87 95 88 96 int i = 0; … … 101 109 // galaxy->index = (1/2n) 102 110 103 float index = (galaxyIndexMin + i * galaxyIndexSlope); // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n) 111 float factor = galaxyGridRandom ? drand48() : i / num; 112 float index = (galaxyIndexMin + factor * galaxyIndexSlope); // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n) 104 113 galaxy->index = 0.5/index; 105 114 106 float scale = (galaxyRmajorMin + i * galaxyRmajorSlope); 115 factor = galaxyGridRandom ? drand48() : i / num; 116 float scale = (galaxyRmajorMin + factor * galaxyRmajorSlope); 107 117 108 118 // for a sersic model, … … 114 124 115 125 galaxy->Rmaj = scale; 116 galaxy->Rmin = (galaxyARatioMin + i * galaxyARatioSlope) * galaxy->Rmaj; 117 galaxy->theta = (galaxyThetaMin + i * galaxyThetaSlope); 126 127 factor = galaxyGridRandom ? drand48() : i / num; 128 galaxy->Rmin = (galaxyARatioMin + factor * galaxyARatioSlope) * galaxy->Rmaj; 129 130 factor = galaxyGridRandom ? drand48() : i / num; 131 galaxy->theta = (galaxyThetaMin + factor * galaxyThetaSlope); 118 132 119 133 // galaxy->peak *= Io; 120 134 121 fprintf (stderr, "Rmaj: %f, scale: %f, index: %f, bn: %f, Ro: %f, Io: %f\n", 122 galaxy->Rmaj, scale, index, bn, fR, Io); 135 if (0) { 136 fprintf (stderr, "Rmaj: %f, scale: %f, index: %f, bn: %f, Ro: %f, Io: %f\n", galaxy->Rmaj, scale, index, bn, fR, Io); 137 } 123 138 124 139 psArrayAdd (galaxies, 100, galaxy);
Note:
See TracChangeset
for help on using the changeset viewer.
