IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 9, 2008, 11:37:58 AM (18 years ago)
Author:
eugene
Message:

option for flat magnitude distribution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimMakeStars.c

    r17557 r17616  
    2424    float seeing       = psMetadataLookupF32(&status, recipe, "SEEING"); // Seeing SIGMA (pixels)
    2525    float scale        = psMetadataLookupF32(&status, recipe, "SCALE") * M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel)
     26
     27    bool flatLum       = psMetadataLookupBool(&status,recipe, "STARS.FLAT.LUM"); // were real stars generated?
     28    float flatNum      = psMetadataLookupS32(&status, recipe, "STARS.FLAT.NUM"); // were real stars generated?
    2629
    2730    float skyRate = psMetadataLookupF32(&status, recipe, "SKY.RATE"); // Sky rate
     
    9396
    9497    // Total number of stars down to the faint flux end
    95     long nTotal = normScale * powf (10.0, (starsAlpha * faintMag));
     98    long nTotal = 0;
     99    if (flatLum) {
     100        nTotal = flatNum;
     101    } else {
     102        nTotal = normScale * powf (10.0, (starsAlpha * faintMag));
     103    }
    96104
    97     psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld stars down to %f mag\n", nTotal, faintMag);
     105    psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld stars between %f and %f mag\n", nTotal, brightMag, faintMag);
    98106
    99107    long oldSize = stars->n;
     
    107115        star->y    = psRandomUniform(rng) * ySize; // y position
    108116
    109         // XXX this needs to respect the bright limit
    110         float starMag = log10((i + 1.0) / normScale) / starsAlpha;
     117        float starMag = 0;
     118        if (flatLum) {
     119            starMag = psRandomUniform(rng) * (faintMag - brightMag) + brightMag;
     120        } else {
     121            starMag = PS_MIN (faintMag, PS_MAX (brightMag, (log10((i + 1.0) / normScale) / starsAlpha)));
     122        }
    111123       
    112124        star->flux = ppSimMagToFlux (starMag, zp) * expTime;
Note: See TracChangeset for help on using the changeset viewer.