IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 11, 2010, 3:24:33 PM (16 years ago)
Author:
eugene
Message:

sersic model consistency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/ppSim/src/ppSimMakeGalaxies.c

    r18011 r28659  
    9696                galaxy->y    = iy;
    9797
    98                 galaxy->peak = 20000;
     98                galaxy->peak = 1000;
    9999
    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;
    102116                galaxy->Rmin  = (galaxyARatioMin + i * galaxyARatioSlope) * galaxy->Rmaj;
    103117                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);
    104123
    105124                psArrayAdd (galaxies, 100, galaxy);
     
    124143            galaxy->y    = psRandomUniform(rng) * ySize; // y position
    125144
    126             galaxy->flux = pow ((double)((i + 1) / norm), (double) (1.0 / galaxyLum));
     145            // galaxy->flux = pow ((double)((i + 1) / norm), (double) (1.0 / galaxyLum));
    127146
    128             galaxy->index = (psRandomUniform(rng) * galaxyIndexSlope  + galaxyIndexMin);
     147            galaxy->index = (sqrt(psRandomUniform(rng)) * galaxyIndexSlope  + galaxyIndexMin);
    129148            galaxy->theta = (psRandomUniform(rng) * galaxyThetaSlope  + galaxyThetaMin);
    130149            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;
    132151
     152            // the flux is only approximately correct (scaling of the peak is wrong)
     153            // elsewhere (ppSimInsertGalaxies.c) we calculate the true galaxy flux
    133154            galaxy->flux = expf((logf(i + 1) - logf(norm)) / galaxyLum); // Peak flux
    134155            galaxy->peak = galaxy->flux / (2.0*M_PI*PS_SQR(seeing));
    135             // galaxy->peak = 5000;
    136156
    137157            psArrayAdd (galaxies, 100, galaxy);
Note: See TracChangeset for help on using the changeset viewer.