Changeset 12957 for branches/eam_02_branch/psphot/src/psphotReplaceUnfit.c
- Timestamp:
- Apr 22, 2007, 5:39:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_02_branch/psphot/src/psphotReplaceUnfit.c
r12955 r12957 1 1 # include "psphotInternal.h" 2 2 3 // replace the flux for sources which failed 3 4 bool psphotReplaceUnfit (psArray *sources) { 4 5 … … 15 16 16 17 replace: 17 if (source->modelPSF == NULL) continue; 18 19 psTrace ("psphot", 3, "replacing object at %f,%f\n", 20 source->modelPSF->params->data.F32[PM_PAR_XPOS], source->modelPSF->params->data.F32[PM_PAR_YPOS]); 21 22 // why am i assuming below that this is a PSF? 23 // pmSourceAdd (!NORM, +) 24 pmModelAdd (source->pixels, source->mask, source->modelPSF, PM_MODEL_ADD_FULL); 18 pmSourceAdd (source, PM_MODEL_OP_FULL); 25 19 source->mode &= ~PM_SOURCE_MODE_SUBTRACTED; 26 20 source->mode &= ~PM_SOURCE_MODE_TEMPSUB; … … 42 36 if (!(source->mode & PM_SOURCE_MODE_SUBTRACTED)) continue; 43 37 44 // select appropriate model 45 pmModel *model = pmSourceGetModel (NULL, source); 46 if (model == NULL) continue; // model must be defined 47 48 psTrace ("psphot", 3, "replacing object at %f,%f\n", 49 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]); 50 51 // pmSourceAdd (source, !NORM, "+"); 52 // XXX remove model selection and ps 53 pmModelAdd (source->pixels, source->mask, model, PM_MODEL_ADD_FULL); 38 pmSourceAdd (source, PM_MODEL_OP_FULL); 54 39 source->mode &= ~PM_SOURCE_MODE_SUBTRACTED; 55 40 } … … 58 43 } 59 44 60 // add or sub source replace or if the source has45 // add source, if the source has been subtracted (or if we ignore the state) 61 46 bool psphotAddWithTest (pmSource *source, bool useState) { 62 47 … … 64 49 bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED); 65 50 if (state && useState) return true; 66 67 // select appropriate model68 pmModel *model = pmSourceGetModel (NULL, source);69 if (model == NULL) return false; // model must be defined70 71 psTrace ("psphot", 3, "replacing object at %f,%f\n",72 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);73 51 74 52 // replace the model if 1) state says it is missing or 2) useState is false (just do it) 75 53 if (!state || !useState) { 76 pm ModelAdd (source->pixels, source->mask, model, PM_MODEL_ADD_FULL);54 pmSourceAdd (source, PM_MODEL_OP_FULL); 77 55 } 78 56 return true; 79 57 } 80 58 81 // add or sub source replace or if the source has59 // sub source, if the source has been added (or if we ignore the state) 82 60 bool psphotSubWithTest (pmSource *source, bool useState) { 83 61 … … 86 64 if (state && useState) return true; 87 65 88 // select appropriate model89 pmModel *model = pmSourceGetModel (NULL, source);90 if (model == NULL) return false; // model must be defined91 92 psTrace ("psphot", 3, "replacing object at %f,%f\n",93 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);94 95 66 // replace the model if 1) state says it is missing or 2) useState is false (just do it) 96 67 if (!state || !useState) { 97 // pmSourceSub (!NORM, -) 98 pmModelSub (source->pixels, source->mask, model, PM_MODEL_ADD_FULL); 68 pmSourceSub (source, PM_MODEL_OP_FULL); 99 69 } 100 70 return true; … … 107 77 bool newState = !(source->mode & PM_SOURCE_MODE_SUBTRACTED); 108 78 if (curState == newState) return true; 109 110 // select appropriate model111 pmModel *model = pmSourceGetModel (NULL, source);112 if (model == NULL) return false; // model must be defined113 114 psTrace ("psphot", 3, "replacing object at %f,%f\n",115 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);116 79 117 80 if (curState && !newState) { 118 // pmSourceSub (!NORM, -) 119 pmModelSub (source->pixels, source->mask, model, PM_MODEL_ADD_FULL); 81 pmSourceSub (source, PM_MODEL_OP_FULL); 120 82 } 121 83 if (newState && !curState) { 122 // pmSourceAdd (!NORM, +) 123 pmModelAdd (source->pixels, source->mask, model, PM_MODEL_ADD_FULL); 84 pmSourceAdd (source, PM_MODEL_OP_FULL); 124 85 } 125 86 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
