IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 11, 2007, 1:01:03 PM (19 years ago)
Author:
Paul Price
Message:

Ensuring consistency between flux scales (peak vs integrated) --- stars now appear on the output image! Some memory fixing too.

File:
1 edited

Legend:

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

    r14657 r14816  
    88
    99    pmCell *cell = readout->parent;
    10     pmChip *chip = cell->parent; 
     10    pmChip *chip = cell->parent;
    1111    pmFPA  *fpa  = chip->parent;
    1212
     
    3838    for (int y = 0; y < signal->numRows; y++) {
    3939
    40         float yFPA = PPSIM_CELL_TO_FPA(y, y0Cell, yParityCell, binning, y0Chip, yParityChip) * 2.0 /
    41             (bounds->y1 - bounds->y0); // Relative y position in FPA
     40        float yFPA = PPSIM_CELL_TO_FPA(y, y0Cell, yParityCell, binning, y0Chip, yParityChip) * 2.0 /
     41            (bounds->y1 - bounds->y0); // Relative y position in FPA
    4242
    43         for (int x = 0; x < signal->numCols; x++) {
    44             float xFPA = PPSIM_CELL_TO_FPA(x, x0Cell, xParityCell, binning, x0Chip, xParityChip) * 2.0 /
    45                 (bounds->x1 - bounds->x0); // Relative x position in FPA
     43        for (int x = 0; x < signal->numCols; x++) {
     44            float xFPA = PPSIM_CELL_TO_FPA(x, x0Cell, xParityCell, binning, x0Chip, xParityChip) * 2.0 /
     45                (bounds->x1 - bounds->x0); // Relative x position in FPA
    4646
    47             // Shutter: adjust exposure time
    48             float realExpTime = expTime + shutterTime * (xFPA + yFPA + 2.0) / 4.0;
     47            // Shutter: adjust exposure time
     48            float realExpTime = expTime + shutterTime * (xFPA + yFPA + 2.0) / 4.0;
    4949
    50             // Gaussian flat-field over the FPA
    51             float flatValue = exp(-0.5 / PS_SQR(flatSigma) *
    52                                   (PS_SQR(yFPA) + PS_SQR(xFPA))) / flatSigma / sqrt(M_PI);
     50            // Gaussian flat-field over the FPA
     51            float flatValue = expf(-0.5 / PS_SQR(flatSigma) * (PS_SQR(yFPA) + PS_SQR(xFPA))) /
     52                flatSigma / sqrtf(2.0 * M_PI);
    5353
    54             if (type == PPSIM_TYPE_FLAT) {
    55                 float flatFlux = flatRate * flatValue * realExpTime; // Flux from flat-field
    56                 signal->data.F32[y][x] += flatFlux;
    57                 variance->data.F32[y][x] += flatFlux;
    58                 continue;
    59             }
     54            if (type == PPSIM_TYPE_FLAT) {
     55                float flatFlux = flatRate * flatValue * realExpTime; // Flux from flat-field
     56                signal->data.F32[y][x] += flatFlux;
     57                variance->data.F32[y][x] += flatFlux;
     58                continue;
     59            }
    6060
    61             expCorr->data.F32[y][x] = flatValue * realExpTime / expTime;
     61            expCorr->data.F32[y][x] = realExpTime / expTime;
    6262
    63             // Sky background
    64             float skyFlux = skyRate * flatValue * realExpTime; // Flux from sky
    65             signal->data.F32[y][x] += skyFlux;
    66             variance->data.F32[y][x] += skyFlux;
     63            // Sky background
     64            float skyFlux = skyRate * flatValue * realExpTime; // Flux from sky
     65            signal->data.F32[y][x] += skyFlux;
     66            variance->data.F32[y][x] += skyFlux;
    6767
    68             // TO DO: Add fringes
     68            // TO DO: Add fringes
    6969
    70         }
     70        }
    7171    }
    7272    psFree(bounds);
Note: See TracChangeset for help on using the changeset viewer.