IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 4:47:00 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

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

    r20366 r21365  
    99
    1010    psImage *signal = readout->image;
    11     psImage *variance = readout->weight;
     11    psImage *variance = readout->variance;
    1212
    1313    pmCell *cell = readout->parent;
     
    1919    bool sky  = psMetadataLookupBool(&status, recipe, "SKY"); // Generate a SKY flux?
    2020    bool flat = psMetadataLookupBool(&status, recipe, "FLAT"); // Apply flat-field term?
    21  
     21
    2222    float expTime      = psMetadataLookupF32(&status, recipe, "EXPTIME"); // Exposure time
    2323
     
    2929    float skyMags      = psMetadataLookupF32(&status, recipe, "SKY.MAGS");  assert (status);
    3030    if (!isnan(skyMags)) {
    31         float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
    32         float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
    33         skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
     31        float zp       = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status);
     32        float scale    = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status);
     33        skyRate = scale * scale * ppSimMagToFlux (skyMags, zp);
    3434    }
    3535    if (type == PPSIM_TYPE_FLAT) {
     
    3737    }
    3838
    39     int x0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0");
    40     int y0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.Y0");
     39    int x0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0");
     40    int y0Chip        = psMetadataLookupS32(&status, chip->concepts, "CHIP.Y0");
    4141    int xParityChip   = psMetadataLookupS32(&status, chip->concepts, "CHIP.XPARITY");
    4242    int yParityChip   = psMetadataLookupS32(&status, chip->concepts, "CHIP.YPARITY");
    4343
    44     int x0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.X0");
    45     int y0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.Y0");
     44    int x0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.X0");
     45    int y0Cell        = psMetadataLookupS32(&status, cell->concepts, "CELL.Y0");
    4646    int xParityCell   = psMetadataLookupS32(&status, cell->concepts, "CELL.XPARITY");
    4747    int yParityCell   = psMetadataLookupS32(&status, cell->concepts, "CELL.YPARITY");
     
    7272            // Gaussian flat-field over the FPA with flatValue = 1.0 at the field center
    7373            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             }
     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            }
    7878
    79             float scatterRate = 0.0;
     79            float scatterRate = 0.0;
    8080
    81             if (sky) {
    82               // add a scattered light term to the flat-field images
    83               if (type == PPSIM_TYPE_FLAT) {
    84                   scatterRate = scatterFrac * PS_SQR(xFPA);
    85               }
     81            if (sky) {
     82              // add a scattered light term to the flat-field images
     83              if (type == PPSIM_TYPE_FLAT) {
     84                  scatterRate = scatterFrac * PS_SQR(xFPA);
     85              }
    8686
    87               // Sky background
    88               float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
    89               signal->data.F32[y][x] += skyFlux;
    90               variance->data.F32[y][x] += skyFlux;
    91             }
     87              // Sky background
     88              float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky
     89              signal->data.F32[y][x] += skyFlux;
     90              variance->data.F32[y][x] += skyFlux;
     91            }
    9292
    93             // used later to modify the star and galaxy photometry
    94             if (expCorr) {
    95                 // exposure correction is (effective exposure time) * (flatValue)
    96               expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
    97             }
     93            // used later to modify the star and galaxy photometry
     94            if (expCorr) {
     95                // exposure correction is (effective exposure time) * (flatValue)
     96              expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
     97            }
    9898
    9999            // TO DO: Add fringes
Note: See TracChangeset for help on using the changeset viewer.