Changeset 5772 for trunk/psphot/src/psphotMarkPSF.c
- Timestamp:
- Dec 13, 2005, 6:43:44 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotMarkPSF.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotMarkPSF.c
r5672 r5772 1 1 # include "psphot.h" 2 3 // given a pmSource which has been fitted using modelPSF, evaluate the 4 // resulting fit: did the fit succeed? is this object PSF-like? is this object 5 // extended? return status is TRUE for a valid PSF, FALSE otherwise. 2 6 3 7 // identify objects consistent with PSF shape/magnitude distribution … … 14 18 // this includes a minimum buffer (DS) for the brighter objects 15 19 16 // saturated stars should fall outside ( but are already IDed)17 // galaxies should be larger, cosmic rays smaller , but need to test?20 // saturated stars should fall outside (larger), but have peaks above SATURATE 21 // galaxies should be larger, cosmic rays smaller 18 22 // we also reject objects with S/N too low or ChiSquare to high 19 20 // any object which meets the criterion is marked as PM_SOURCE_BRIGHTSTAR21 23 22 24 // floor for DS value … … 33 35 34 36 // do we actually have a valid PSF model? 35 if (model == NULL) return (false); 37 if (model == NULL) { 38 source->mode &= ~PM_SOURCE_FITTED; 39 return false; 40 } 36 41 37 42 // did the model fit fail for one or another reason? 38 43 switch (model->status) { 44 case PM_MODEL_UNTRIED: 45 source->mode &= ~PM_SOURCE_FITTED; 46 return false; 39 47 case PM_MODEL_BADARGS: 40 case PM_MODEL_UNTRIED: 41 source->type = PM_SOURCE_FAIL_FIT_PSF; // better choice? 48 source->mode |= PM_SOURCE_FAIL; 42 49 return false; 43 50 case PM_MODEL_SUCCESS: … … 46 53 case PM_MODEL_OFFIMAGE: 47 54 psLogMsg ("psphot", 5, "PSF fit failed for %f, %f (%d iterations)\n", model->params->data.F32[2], model->params->data.F32[3], model->nIter); 48 source-> type = PM_SOURCE_FAIL_FIT_PSF; // better choice?55 source->mode |= PM_SOURCE_FAIL; 49 56 return false; 50 57 default: … … 52 59 } 53 60 61 // unless we prove otherwise, this object is a star. 62 source->type = PM_SOURCE_STAR; 63 54 64 // if the object has fitted peak above saturation, label as SATSTAR 55 65 // this is a valid PSF object, but ignore the other quality tests 56 66 // remember: fit does not use saturated pixels (masked) 67 // XXX no extended object can saturate and stay extended... 57 68 if (model->params->data.F32[1] >= SATURATE) { 58 if (source-> type ==PM_SOURCE_PSFSTAR) {69 if (source->mode & PM_SOURCE_PSFSTAR) { 59 70 psLogMsg ("psphot", 5, "PSFSTAR marked SATSTAR\n"); 60 71 } 61 source->type = PM_SOURCE_SATSTAR; 62 return (true); 72 source->mode &= ~PM_SOURCE_PSFSTAR; 73 source->mode |= PM_SOURCE_SATSTAR; 74 return true; 63 75 } 64 76 65 77 // if the object has a fitted peak below 0, the fit did not converge cleanly 66 78 if (model->params->data.F32[1] < 0) { 67 source-> type = PM_SOURCE_FAIL_FIT_PSF;68 return (false);79 source->mode |= PM_SOURCE_FAIL; 80 return false; 69 81 } 70 82 71 83 // if the source was predicted to be a SATSTAR, but it fitted below saturation, 72 84 // make a note to the user 73 if (source-> type ==PM_SOURCE_SATSTAR) {74 psLogMsg ("psphot", 5, "SATSTAR marked GOODSTAR(fitted peak below saturation)\n");75 source-> type = PM_SOURCE_GOODSTAR;85 if (source->mode & PM_SOURCE_SATSTAR) { 86 psLogMsg ("psphot", 5, "SATSTAR marked normal (fitted peak below saturation)\n"); 87 source->mode &= ~PM_SOURCE_SATSTAR; 76 88 } 77 89 … … 93 105 keep &= (SN > minSN); 94 106 keep &= (Chi < maxChi); 95 if (keep) {96 if (source->type == PM_SOURCE_PSFSTAR) return (true); 97 source->type = PM_SOURCE_GOODSTAR; 98 return (true); 99 }100 101 if (source->type == PM_SOURCE_PSFSTAR) { 107 if (keep) return true; 108 109 // this source is not a star, unflag as PSFSTAR 110 // XXX : if this object was used to build the PSF, this flag should 111 // be set even if the object is not a star... 112 if (source->mode & PM_SOURCE_PSFSTAR) { 113 source->mode &= ~PM_SOURCE_PSFSTAR; 102 114 psLogMsg ("psphot", 5, "PSFSTAR demoted based on fit quality\n"); 103 115 } … … 106 118 if ((nSx <= -shapeNsigma) || (nSy <= -shapeNsigma)) { 107 119 source->type = PM_SOURCE_DEFECT; 108 return (false);120 return false; 109 121 } 110 122 … … 112 124 if ((nSx >= shapeNsigma) || (nSy >= shapeNsigma)) { 113 125 source->type = PM_SOURCE_GALAXY; 114 return (false);126 return false; 115 127 } 116 128 117 // object appears to be extremely faint: what is this? 118 if (SN < minSN) { 119 source->type = PM_SOURCE_FAINTSTAR; 120 return (false); 121 } 122 123 // these are pooly fitted, probable stars near other stars? 124 source->type = PM_SOURCE_POOR_FIT_PSF; 125 return (false); 129 // poor-quality fit; only keep if nothing else works... 130 source->mode |= PM_SOURCE_POOR; 131 return false; 126 132 }
Note:
See TracChangeset
for help on using the changeset viewer.
