Changeset 34083 for trunk/ppSim/src/ppSimInsertStars.c
- Timestamp:
- Jun 26, 2012, 11:25:02 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimInsertStars.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimInsertStars.c
r32350 r34083 6 6 PTR = NULL; 7 7 8 floatimageSum (psImage *image);8 double imageSum (psImage *image); 9 9 10 10 bool ppSimInsertStars (pmReadout *readout, psImage *expCorr, psArray *stars, pmConfig *config) { … … 79 79 FILE *outfile = fopen (outname, "w"); 80 80 81 float radius = -1.0; 82 81 83 // add sources to the readout image & variance 82 84 psTrace("ppSim", 1, "Inserting %ld stars...\n", stars->n); … … 110 112 pmModelSetFlux (model, flux); 111 113 112 float radius = model->modelRadius (model->params, nSigmaLim * roughNoise); 113 radius = PS_MAX (radius, 1.0); 114 radius = 20.0; 114 // we must set the radius on the first object, and leave it there for everyone else 115 // (inserting flux with a variable radius introduces a flux-dependent bias) 116 if (radius < 0) { 117 radius = model->modelRadius (model->params, nSigmaLim * roughNoise); 118 radius = PS_MAX (radius, 1.0); 119 radius = PS_MIN (radius, 50.0); 120 } 115 121 116 122 // construct a source, with model flux pixels set, based on the model … … 136 142 readout->image->data.F32[(int)(yCell)][(int)(xCell)] += flux; 137 143 } else { 138 // insert the source flux in the image 139 float sum1 = imageSum(source->pixels); 144 // insert the source flux in the image and measure inserted flux 145 // this is a difference of 2 large numbers : must use 'double' or we get floating 146 // point errors and trends on a scale of ~0.005 mags at > -10 mags instrumental 147 double sum1 = imageSum(source->pixels); 140 148 pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY); 141 floatsum2 = imageSum(source->pixels);149 double sum2 = imageSum(source->pixels); 142 150 starFlux = sum2 - sum1; 143 151 … … 154 162 RESET(source->blends); 155 163 } 156 fprintf (outfile, "%8.3f %8.3f %10. 2f %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);164 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); 157 165 158 166 // add the sources to the source array
Note:
See TracChangeset
for help on using the changeset viewer.
