Changeset 21365 for trunk/ppSim/src/ppSimMakeSky.c
- Timestamp:
- Feb 5, 2009, 4:47:00 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimMakeSky.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimMakeSky.c
r20366 r21365 9 9 10 10 psImage *signal = readout->image; 11 psImage *variance = readout-> weight;11 psImage *variance = readout->variance; 12 12 13 13 pmCell *cell = readout->parent; … … 19 19 bool sky = psMetadataLookupBool(&status, recipe, "SKY"); // Generate a SKY flux? 20 20 bool flat = psMetadataLookupBool(&status, recipe, "FLAT"); // Apply flat-field term? 21 21 22 22 float expTime = psMetadataLookupF32(&status, recipe, "EXPTIME"); // Exposure time 23 23 … … 29 29 float skyMags = psMetadataLookupF32(&status, recipe, "SKY.MAGS"); assert (status); 30 30 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); 34 34 } 35 35 if (type == PPSIM_TYPE_FLAT) { … … 37 37 } 38 38 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"); 41 41 int xParityChip = psMetadataLookupS32(&status, chip->concepts, "CHIP.XPARITY"); 42 42 int yParityChip = psMetadataLookupS32(&status, chip->concepts, "CHIP.YPARITY"); 43 43 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"); 46 46 int xParityCell = psMetadataLookupS32(&status, cell->concepts, "CELL.XPARITY"); 47 47 int yParityCell = psMetadataLookupS32(&status, cell->concepts, "CELL.YPARITY"); … … 72 72 // Gaussian flat-field over the FPA with flatValue = 1.0 at the field center 73 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 }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 } 78 78 79 float scatterRate = 0.0;79 float scatterRate = 0.0; 80 80 81 if (sky) {82 // add a scattered light term to the flat-field images83 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 } 86 86 87 // Sky background88 float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky89 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 } 92 92 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 } 98 98 99 99 // TO DO: Add fringes
Note:
See TracChangeset
for help on using the changeset viewer.
