Changeset 5828 for trunk/psphot/src/psphotEvalPSF.c
- Timestamp:
- Dec 22, 2005, 4:20:27 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotEvalPSF.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotEvalPSF.c
r5802 r5828 46 46 // examine the model->status, fit parameters, etc and decide if the model succeeded 47 47 // set the source->type and source->mode appropriately 48 bool psphotEvalPSF (pmSource *source ) {48 bool psphotEvalPSF (pmSource *source, pmModel *model) { 49 49 50 50 int keep; 51 51 float dSX, dSY, SX, SY, SN; 52 52 float nSx, nSy, Chi; 53 54 pmModel *model = source->modelPSF;55 53 56 54 // do we actually have a valid PSF model? … … 127 125 // this source is not a star, warn if it was a PSFSTAR 128 126 if (source->mode & PM_SOURCE_PSFSTAR) { 129 psphotSaveImage (NULL, source->pixels, "failpx.fits");130 psphotSaveImage (NULL, source->mask, "failmk.fits");131 psphotSaveImage (NULL, source->weight, "failwt.fits");132 127 psLogMsg ("psphot", 5, "PSFSTAR demoted based on fit quality (%f, %f : %f %f %f %f)\n", 128 model->params->data.F32[2], model->params->data.F32[3], nSx, nSy, SN, Chi); 129 } else { 130 psLogMsg ("psphot", 5, "fails PSF fit (%f, %f : %f %f %f %f)\n", 133 131 model->params->data.F32[2], model->params->data.F32[3], nSx, nSy, SN, Chi); 134 132 } … … 150 148 return false; 151 149 } 150 151 // examine the model->status, fit parameters, etc and decide if the model succeeded 152 // set the source->type and source->mode appropriately 153 bool psphotEvalDBL (pmSource *source, pmModel *model) { 154 155 // do we actually have a valid PSF model? 156 if (model == NULL) { 157 source->mode &= ~PM_SOURCE_FITTED; 158 return false; 159 } 160 161 // did the model fit fail for one or another reason? 162 switch (model->status) { 163 case PM_MODEL_SUCCESS: 164 break; 165 case PM_MODEL_UNTRIED: 166 source->mode &= ~PM_SOURCE_FITTED; 167 return false; 168 case PM_MODEL_BADARGS: 169 case PM_MODEL_NONCONVERGE: 170 case PM_MODEL_OFFIMAGE: 171 default: 172 source->mode |= PM_SOURCE_FAIL; 173 return false; 174 } 175 176 // unless we prove otherwise, this object is a star. 177 source->type = PM_SOURCE_STAR; 178 179 // the following source->mode information pertains to modelPSF: 180 source->mode |= PM_SOURCE_PSFMODEL; 181 182 // if the object has fitted peak above saturation, label as SATSTAR 183 // this is a valid PSF object, but ignore the other quality tests 184 // remember: fit does not use saturated pixels (masked) 185 // XXX no extended object can saturate and stay extended... 186 if (model->params->data.F32[1] >= SATURATION) { 187 if (source->mode & PM_SOURCE_PSFSTAR) { 188 psLogMsg ("psphot", 5, "PSFSTAR marked SATSTAR\n"); 189 } 190 source->mode |= PM_SOURCE_SATSTAR; 191 return true; 192 } 193 194 // if the object has a fitted peak below 0, the fit did not converge cleanly 195 if (model->params->data.F32[1] <= 0) { 196 source->mode |= PM_SOURCE_FAIL; 197 return false; 198 } 199 200 // if the source was predicted to be a SATSTAR, but it fitted below saturation, 201 // make a note to the user 202 if (source->mode & PM_SOURCE_SATSTAR) { 203 psLogMsg ("psphot", 5, "SATSTAR marked normal (fitted peak below saturation)\n"); 204 source->mode &= ~PM_SOURCE_SATSTAR; 205 } 206 return true; 207 }
Note:
See TracChangeset
for help on using the changeset viewer.
