Changeset 41331
- Timestamp:
- Apr 9, 2020, 11:51:42 AM (6 years ago)
- Location:
- trunk/ppSim/src
- Files:
-
- 5 edited
-
ppSim.h (modified) (1 diff)
-
ppSimInsertStars.c (modified) (2 diffs)
-
ppSimMakeSky.c (modified) (1 diff)
-
ppSimMakeStars.c (modified) (1 diff)
-
ppSimUtils.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSim.h
r41173 r41331 188 188 189 189 float ppSimGetZeroPoint(psMetadata *recipe, const char *filter); 190 float ppSimGetSkyRate(psMetadata *recipe); 190 191 191 192 bool ppSimMergeReadouts (pmConfig *config, pmFPAview *view); -
trunk/ppSim/src/ppSimInsertStars.c
r36868 r41331 41 41 } 42 42 43 float skyRate = psMetadataLookupF32(NULL, recipe, "SKY.RATE"); // Sky rate 44 if (isnan(skyRate)) { 45 float zp = psMetadataLookupF32(&mdok, recipe, "ZEROPOINT"); assert (mdok); 46 float scale = psMetadataLookupF32(&mdok, recipe, "PIXEL.SCALE"); assert (mdok); 47 float skyMags = psMetadataLookupF32(&mdok, recipe, "SKY.MAGS"); assert (mdok); 48 skyRate = scale * scale * ppSimMagToFlux (skyMags, zp); 49 } 43 float skyRate = ppSimGetSkyRate (recipe); 50 44 51 45 // Rough noise estimate, appropriate for entire cell (use for source radius?) 52 46 float roughNoise = sqrtf(PS_SQR(readnoise) + (darkRate + skyRate) * expTime); 47 float skyFlux = skyRate*expTime; 53 48 54 49 int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0"); … … 165 160 fprintf (outfile, "%8.3f %8.3f %10.5f %2d %7.3f %5.3f %5.3f %5.3f %5.3f %5.3f : %f %f\n", star->x, star->y, starFlux, 0, source->psfMag, source->psfMagErr, axes.major, axes.minor, axes.theta, par8, model->params->data.F32[PM_PAR_I0], radius); 166 161 162 // save the approx sky (exact if sky is flat) for external comparisons 163 source->sky = skyFlux; 164 167 165 // add the sources to the source array 168 166 psArrayAdd (sources, 100,source); -
trunk/ppSim/src/ppSimMakeSky.c
r41330 r41331 26 26 float shutterTime = psMetadataLookupF32(&status, recipe, "SHUTTER.TIME"); // Shutter time 27 27 float scatterFrac = psMetadataLookupF32(&status, recipe, "SCATTER.FRAC"); // scattered light fraction (max) 28 float skyRate = psMetadataLookupF32(&status, recipe, "SKY.RATE"); // Sky rate 29 float skyMags = psMetadataLookupF32(&status, recipe, "SKY.MAGS"); assert (status); 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); 34 } 35 if (type == PPSIM_TYPE_FLAT) { 36 skyRate = flatRate; 37 } 28 29 float skyRate = (type == PPSIM_TYPE_FLAT) ? flatRate : ppSimGetSkyRate (recipe); 38 30 39 31 int x0Chip = psMetadataLookupS32(&status, chip->concepts, "CHIP.X0"); -
trunk/ppSim/src/ppSimMakeStars.c
r41173 r41331 39 39 if (isnan(scale)) ESCAPE("PIXEL.SCALE is not defined"); 40 40 41 bool flatLum = psMetadataLookupBool(&status,recipe, "STARS.FLAT.LUM"); // were real stars generated?42 float flatNum = psMetadataLookupS32(&status, recipe, "STARS.FLAT.NUM"); // were real stars generated?41 bool flatLum = psMetadataLookupBool(&status,recipe, "STARS.FLAT.LUM"); // use a flat luminosity function? (dn/dmag = const) 42 float flatNum = psMetadataLookupS32(&status, recipe, "STARS.FLAT.NUM"); // amplitude of flat luminosity function 43 43 44 float skyRate = psMetadataLookupF32(&status, recipe, "SKY.RATE"); // Sky rate 45 if (isnan(skyRate)) { 46 float skyMags = psMetadataLookupF32(&status, recipe, "SKY.MAGS"); assert (status); 47 skyRate = scale * scale * ppSimMagToFlux (skyMags, zp); 48 // skyMags is in mags / square arcsec, so scale must be in arcsec / pixel 49 } 44 float skyRate = ppSimGetSkyRate (recipe); 50 45 51 46 // Size of FPA -
trunk/ppSim/src/ppSimUtils.c
r41173 r41331 272 272 } 273 273 274 float ppSimGetSkyRate (psMetadata *recipe) { 275 276 bool status; 277 278 float skyRate = psMetadataLookupF32(&status, recipe, "SKY.RATE"); // Sky rate 279 if (!isnan(skyRate)) { 280 float zp = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); assert (status); 281 float scale = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); assert (status); 282 float skyMags = psMetadataLookupF32(&status, recipe, "SKY.MAGS"); assert (status); 283 skyRate = scale * scale * ppSimMagToFlux (skyMags, zp); 284 } 285 return skyRate; 286 } 287 274 288 psArray *ppSimSelectSources (pmConfig *config, const pmFPAview *view, const char *filename) { 275 289
Note:
See TracChangeset
for help on using the changeset viewer.
