Changeset 26917 for trunk/psModules/src/imcombine/pmPSFEnvelope.c
- Timestamp:
- Feb 11, 2010, 4:20:46 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmPSFEnvelope.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmPSFEnvelope.c
r26916 r26917 152 152 // Test PSF 153 153 { 154 bool goodPSF = true; // Good PSF? 155 pmModelClassSetLimits(PM_MODEL_LIMITS_IGNORE); 156 pmModel *model = pmModelFromPSFforXY(psf, numCols / 2.0, numRows / 2.0, PEAK_FLUX); // Test model 157 if (!model) { 158 goodPSF = false; 159 } else { 160 model->modelSetLimits(PM_MODEL_LIMITS_MODERATE); 161 for (int j = 0; j < model->params->n && goodPSF; j++) { 162 if (!model->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) || 163 !model->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) { 164 goodPSF = false; 154 bool goodPSF = false; // Is there a PSF that we can use? 155 int xNum = PS_MAX(psf->trendNx, 1), yNum = PS_MAX(psf->trendNy, 1); // Number of positions to check 156 for (int j = 0; j < yNum && !goodPSF; j++) { 157 float y = ((float)j + 0.5) / (float)yNum * numRows; // Position on image 158 for (int i = 0; i < xNum && !goodPSF; i++) { 159 float x = ((float)i + 0.5) / (float)xNum * numCols; // Position on image 160 pmModelClassSetLimits(PM_MODEL_LIMITS_IGNORE); 161 pmModel *model = pmModelFromPSFforXY(psf, x, y, PEAK_FLUX); // Test model 162 if (!model) { 163 continue; 164 } 165 model->modelSetLimits(PM_MODEL_LIMITS_MODERATE); 166 bool limits = true; // Model within limits? 167 for (int j = 0; j < model->params->n && limits; j++) { 168 if (!model->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) || 169 !model->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) { 170 limits = false; 171 } 172 } 173 psFree(model); 174 if (limits) { 175 goodPSF = true; 165 176 } 166 177 } 167 psFree(model);168 178 } 169 179 if (!goodPSF) { 170 psWarning("PSF %d is bad --- not including in envelope calculation.", i);180 psWarning("PSF %d is completely bad --- not including in envelope calculation.", i); 171 181 continue; 172 182 } … … 175 185 pmResiduals *resid = psf->residuals;// PSF residuals 176 186 psf->residuals = NULL; 187 pmModelClassSetLimits(PM_MODEL_LIMITS_MODERATE); 177 188 if (!pmReadoutFakeFromSources(fakeRO, fakeSize, fakeSize, fakes, 0, xOffset, yOffset, psf, 178 189 NAN, radius, true, false)) { … … 399 410 400 411 pmSourceFitModelInit(SOURCE_FIT_ITERATIONS, 0.01, VARIANCE_VAL, true); 401 pmModelClassSetLimits(PM_MODEL_LIMITS_STRICT); 412 pmModelClassSetLimits(PM_MODEL_LIMITS_STRICT); // Important for getting a good stack target PSF 402 413 403 414 pmPSFtry *try = pmPSFtryModel(fakes, modelName, options, 0, 0xff);
Note:
See TracChangeset
for help on using the changeset viewer.
