Changeset 17705 for branches/eam_branch_20080511/ppSim/src/ppSimMakeSky.c
- Timestamp:
- May 15, 2008, 4:44:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080511/ppSim/src/ppSimMakeSky.c
r17702 r17705 17 17 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe 18 18 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? 20 21 21 22 float expTime = psMetadataLookupF32(&status, recipe, "EXPTIME"); // Exposure time … … 24 25 float flatRate = psMetadataLookupF32(&status, recipe, "FLAT.RATE"); // Flat-field rate 25 26 float shutterTime = psMetadataLookupF32(&status, recipe, "SHUTTER.TIME"); // Shutter time 26 float scatter Scale = psMetadataLookupF32(&status, recipe, "SCATTER.SCALE"); // scattered light term27 float scatterFrac = psMetadataLookupF32(&status, recipe, "SCATTER.FRAC"); // scattered light fraction (max) 27 28 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)) { 29 31 float zp = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status); 30 32 float scale = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status); 31 float skyMags = psMetadataLookupF32(&status, recipe, "SKY.MAGS"); assert (status);32 33 skyRate = scale * scale * ppSimMagToFlux (skyMags, zp); 33 34 } … … 69 70 float realExpTime = expTime + shutterTime * (xFPA + yFPA + 2.0) / 4.0; 70 71 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 } 73 78 74 79 float scatterRate = 0.0; … … 78 83 if (type == PPSIM_TYPE_FLAT) { 79 84 float xF = 2.0*(xFPA / dXfpa) - 1.0; 80 scatterRate = scatter Scale* PS_SQR(xF);85 scatterRate = scatterFrac * PS_SQR(xF); 81 86 } 82 87 83 88 // Sky background 84 float skyFlux = (skyRate * flatValue + scatterRate) * realExpTime; // Flux from sky89 float skyFlux = (skyRate * (flatValue + scatterRate)) * realExpTime; // Flux from sky 85 90 signal->data.F32[y][x] += skyFlux; 86 91 variance->data.F32[y][x] += skyFlux;
Note:
See TracChangeset
for help on using the changeset viewer.
