Changeset 29011 for trunk/ppSim
- Timestamp:
- Aug 23, 2010, 7:26:50 AM (16 years ago)
- Location:
- trunk/ppSim/src
- Files:
-
- 3 edited
-
ppSimArguments.c (modified) (2 diffs)
-
ppSimCreate.c (modified) (1 diff)
-
ppSimMakeGalaxies.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimArguments.c
r24807 r29011 55 55 psMetadataAddStr(arguments, PS_LIST_TAIL, "-galmodel", 0, "Type of Galaxy model", NULL); 56 56 psMetadataAddS32(arguments, PS_LIST_TAIL, "-bin", 0, "Binning in x and y", 1); 57 psMetadataAddS32(arguments, PS_LIST_TAIL, "-nx", 0, "cell x-size in pixels", 0); 58 psMetadataAddS32(arguments, PS_LIST_TAIL, "-ny", 0, "cell y-size in pixels", 0); 57 59 psMetadataAddBool(arguments, PS_LIST_TAIL, "+photom", 0, "Perform photometry on fake sources", false); 58 60 … … 197 199 ppSimArgToRecipeS32(&status, options, "BINNING", arguments, "-bin"); 198 200 201 ppSimArgToRecipeS32(&status, config->arguments, "NX.CELL", arguments, "-nx"); 202 ppSimArgToRecipeS32(&status, config->arguments, "NY.CELL", arguments, "-ny"); 203 199 204 if (type == PPSIM_TYPE_OBJECT) { 200 205 // Load values required for adding stars -
trunk/ppSim/src/ppSimCreate.c
r27989 r29011 26 26 } 27 27 28 assert (config->camera); 29 30 // int nx = psMetadataLookupS32 (&status, config->arguments, "NX.CELL"); 31 // if (nx) { 32 // psMetadata *defaults = psMetadataLookupPtr(&status, config->camera, "DEFAULTS"); 33 // psMetadataLookupS32 (&status, defaults, "CELL.XSIZE"); 34 // psAssert (status, "CELL.XSIZE should be in DEFAULTS"); 35 // psMetadataAddF32(defaults, PS_LIST_TAIL, "CELL.XSIZE", PS_META_REPLACE, "", nx); 36 // } 37 // int ny = psMetadataLookupS32 (&status, config->arguments, "NY.CELL"); 38 // if (ny) { 39 // psMetadata *defaults = psMetadataLookupPtr(&status, config->camera, "DEFAULTS"); 40 // psMetadataLookupS32 (&status, defaults, "CELL.YSIZE"); 41 // psAssert (status, "CELL.YSIZE should be in DEFAULTS"); 42 // psMetadataAddF32(defaults, PS_LIST_TAIL, "CELL.YSIZE", PS_META_REPLACE, "", ny); 43 // } 44 28 45 // generate the fpa structure used by the output camera (determined from INPUT or specified) 29 assert (config->camera);30 46 fpa = pmFPAConstruct(config->camera, config->cameraName); // FPA to contain the observation 31 47 if (!fpa) { -
trunk/ppSim/src/ppSimMakeGalaxies.c
r29002 r29011 109 109 // galaxy->index = (1/2n) 110 110 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) 113 galaxy->index = 0.5/index; 111 float rndValue; 114 112 115 factor = galaxyGridRandom ? drand48() : i / num; 116 float scale = (galaxyRmajorMin + factor * galaxyRmajorSlope); 113 rndValue = galaxyGridRandom ? drand48() : i / num; 114 float index = (galaxyIndexMin + rndValue * galaxyIndexSlope); 115 galaxy->index = 0.5/index; // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n) 116 117 rndValue = galaxyGridRandom ? drand48() : i / num; 118 float scale = (galaxyRmajorMin + rndValue * galaxyRmajorSlope); 117 119 118 120 // for a sersic model, … … 121 123 float Io = exp(bn); 122 124 123 // galaxy->Rmaj = scale * fR;124 125 125 galaxy->Rmaj = scale; 126 126 127 factor= galaxyGridRandom ? drand48() : i / num;128 galaxy->Rmin = (galaxyARatioMin + factor* galaxyARatioSlope) * galaxy->Rmaj;127 rndValue = galaxyGridRandom ? drand48() : i / num; 128 galaxy->Rmin = (galaxyARatioMin + rndValue * galaxyARatioSlope) * galaxy->Rmaj; 129 129 130 factor= galaxyGridRandom ? drand48() : i / num;131 galaxy->theta = (galaxyThetaMin + factor* galaxyThetaSlope);130 rndValue = galaxyGridRandom ? drand48() : i / num; 131 galaxy->theta = (galaxyThetaMin + rndValue * galaxyThetaSlope); 132 132 133 133 // galaxy->peak *= Io; … … 158 158 galaxy->y = psRandomUniform(rng) * ySize; // y position 159 159 160 // galaxy->flux = pow ((double)((i + 1) / norm), (double) (1.0 / galaxyLum)); 160 float index = (sqrt(psRandomUniform(rng)) * galaxyIndexSlope + galaxyIndexMin); 161 galaxy->index = 0.5/index; // factor of 0.5 because the Sersic model creates exp(-z^n), not exp(-r^n) 161 162 162 galaxy->index = (sqrt(psRandomUniform(rng)) * galaxyIndexSlope + galaxyIndexMin); 163 float scale = (psRandomUniform(rng) * galaxyRmajorSlope + galaxyRmajorMin); 164 165 // for a sersic model, 166 float bn = 1.9992*index - 0.3271; 167 float fR = 1.0 / (sqrt(2.0) * pow (bn, index)); 168 float Io = exp(bn); 169 170 galaxy->Rmaj = scale; 171 172 galaxy->Rmin = (PS_SQR(psRandomUniform(rng)) * galaxyARatioSlope + galaxyARatioMin) * galaxy->Rmaj; 173 163 174 galaxy->theta = (psRandomUniform(rng) * galaxyThetaSlope + galaxyThetaMin); 164 galaxy->Rmaj = (psRandomUniform(rng) * galaxyRmajorSlope + galaxyRmajorMin);165 galaxy->Rmin = (PS_SQR(psRandomUniform(rng)) * galaxyARatioSlope + galaxyARatioMin) * galaxy->Rmaj;166 175 167 176 // the flux is only approximately correct (scaling of the peak is wrong) … … 170 179 galaxy->peak = galaxy->flux / (2.0*M_PI*PS_SQR(seeing)); 171 180 181 if (0) { 182 fprintf (stderr, "Rmaj: %f, scale: %f, index: %f, bn: %f, Ro: %f, Io: %f\n", galaxy->Rmaj, scale, index, bn, fR, Io); 183 } 184 172 185 psArrayAdd (galaxies, 100, galaxy); 173 186 }
Note:
See TracChangeset
for help on using the changeset viewer.
