IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 15, 2008, 4:44:46 PM (18 years ago)
Author:
eugene
Message:

options to turn on and off all of the components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080511/ppSim/src/ppSimMakeSky.c

    r17702 r17705  
    1717    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe
    1818
    19     bool sky = psMetadataLookupBool(&status, recipe, "SKY"); // Generate a SKY flux?
     19    bool sky  = psMetadataLookupBool(&status, recipe, "SKY"); // Generate a SKY flux?
     20    bool flat = psMetadataLookupBool(&status, recipe, "FLAT"); // Apply flat-field term?
    2021 
    2122    float expTime      = psMetadataLookupF32(&status, recipe, "EXPTIME"); // Exposure time
     
    2425    float flatRate     = psMetadataLookupF32(&status, recipe, "FLAT.RATE"); // Flat-field rate
    2526    float shutterTime  = psMetadataLookupF32(&status, recipe, "SHUTTER.TIME"); // Shutter time
    26     float scatterScale = psMetadataLookupF32(&status, recipe, "SCATTER.SCALE"); // scattered light term
     27    float scatterFrac  = psMetadataLookupF32(&status, recipe, "SCATTER.FRAC"); // scattered light fraction (max)
    2728    float skyRate      = psMetadataLookupF32(&status, recipe, "SKY.RATE"); // Sky rate
    28     if (isnan(skyRate)) {
     29    float skyMags      = psMetadataLookupF32(&status, recipe, "SKY.MAGS");  assert (status);
     30    if (!isnan(skyMags)) {
    2931        float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
    3032        float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
    31         float skyMags  = psMetadataLookupF32(&status, recipe, "SKY.MAGS");  assert (status);
    3233        skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
    3334    }
     
    6970            float realExpTime = expTime + shutterTime * (xFPA + yFPA + 2.0) / 4.0;
    7071
    71             // Gaussian flat-field over the FPA
    72             float flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA))) / flatSigma / sqrtf(2.0 * M_PI);
     72            // Gaussian flat-field over the FPA with flatValue = 1.0 at the field center
     73            float flatValue = 1.0;
     74            if (flat) {
     75                // we make the flat-field have a response of 1.0 at the field center (like a vignetting)
     76                flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA)));
     77            }
    7378
    7479            float scatterRate = 0.0;
     
    7883              if (type == PPSIM_TYPE_FLAT) {
    7984                float xF = 2.0*(xFPA / dXfpa) - 1.0;
    80                 scatterRate = scatterScale * PS_SQR(xF);
     85                scatterRate = scatterFrac * PS_SQR(xF);
    8186              }
    8287
    8388              // Sky background
    84               float skyFlux = (skyRate * flatValue + scatterRate) * realExpTime; // Flux from sky
     89              float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
    8590              signal->data.F32[y][x] += skyFlux;
    8691              variance->data.F32[y][x] += skyFlux;
Note: See TracChangeset for help on using the changeset viewer.