- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psModules
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psModules merged eligible /branches/eam_branches/stackphot.20100406/psModules 27623-27653 /branches/pap_delete/psModules 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/psModules/src/imcombine/pmPSFEnvelope.c
r25754 r27838 65 65 int radius, // Radius of each PSF 66 66 const char *modelName,// Name of PSF model to use 67 int xOrder, int yOrder // Order for PSF variation fit 67 int xOrder, int yOrder, // Order for PSF variation fit 68 psImageMaskType maskVal 68 69 ) 69 70 { … … 151 152 // Test PSF 152 153 { 153 bool goodPSF = true; // Good PSF? 154 pmModelClassSetLimits(PM_MODEL_LIMITS_IGNORE); 155 pmModel *model = pmModelFromPSFforXY(psf, numCols / 2.0, numRows / 2.0, PEAK_FLUX); // Test model 156 model->modelSetLimits(PM_MODEL_LIMITS_STRICT); 157 for (int j = 0; j < model->params->n && goodPSF; j++) { 158 if (!model->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) || 159 !model->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) { 160 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; 176 } 161 177 } 162 178 } 163 psFree(model);164 179 if (!goodPSF) { 165 psWarning("PSF %d is bad --- not including in envelope calculation.", i);180 psWarning("PSF %d is completely bad --- not including in envelope calculation.", i); 166 181 continue; 167 182 } … … 170 185 pmResiduals *resid = psf->residuals;// PSF residuals 171 186 psf->residuals = NULL; 187 pmModelClassSetLimits(PM_MODEL_LIMITS_MODERATE); 172 188 if (!pmReadoutFakeFromSources(fakeRO, fakeSize, fakeSize, fakes, 0, xOffset, yOffset, psf, 173 189 NAN, radius, true, false)) { … … 224 240 } 225 241 float srcRadius = model->modelRadius(model->params, PS_SQR(VARIANCE_VAL)); // Radius for source 242 psFree(model); 226 243 if (srcRadius == 0) { 227 244 continue; … … 360 377 361 378 // measure the source moments: tophat windowing, no pixel S/N cutoff 362 if (!pmSourceMoments(source, maxRadius, 0.0, 1.0)) { 379 // XXX probably should be passing the maskVal to this function so we can pass it along here... 380 if (!pmSourceMoments(source, maxRadius, 0.0, 1.0, maskVal)) { 363 381 // Can't do anything about it; limp along as best we can 364 382 psErrorClear(); … … 393 411 394 412 pmSourceFitModelInit(SOURCE_FIT_ITERATIONS, 0.01, VARIANCE_VAL, true); 413 pmModelClassSetLimits(PM_MODEL_LIMITS_STRICT); // Important for getting a good stack target PSF 395 414 396 415 pmPSFtry *try = pmPSFtryModel(fakes, modelName, options, 0, 0xff);
Note:
See TracChangeset
for help on using the changeset viewer.
