Changeset 13035 for trunk/psphot/src/psphotReplaceUnfit.c
- Timestamp:
- Apr 25, 2007, 3:35:50 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotReplaceUnfit.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotReplaceUnfit.c
r12792 r13035 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 pmModelAdd (source->pixels, source->mask, source->modelPSF, false, false); 18 pmSourceAdd (source, PM_MODEL_OP_FULL); 23 19 source->mode &= ~PM_SOURCE_MODE_SUBTRACTED; 24 20 source->mode &= ~PM_SOURCE_MODE_TEMPSUB; … … 40 36 if (!(source->mode & PM_SOURCE_MODE_SUBTRACTED)) continue; 41 37 42 // select appropriate model 43 pmModel *model = pmSourceGetModel (NULL, source); 44 if (model == NULL) continue; // model must be defined 45 46 psTrace ("psphot", 3, "replacing object at %f,%f\n", 47 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]); 48 49 pmModelAdd (source->pixels, source->mask, model, false, false); 38 pmSourceAdd (source, PM_MODEL_OP_FULL); 50 39 source->mode &= ~PM_SOURCE_MODE_SUBTRACTED; 51 40 } … … 54 43 } 55 44 56 // add or sub source replace or if the source has45 // add source, if the source has been subtracted (or if we ignore the state) 57 46 bool psphotAddWithTest (pmSource *source, bool useState) { 58 47 … … 60 49 bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED); 61 50 if (state && useState) return true; 62 63 // select appropriate model64 pmModel *model = pmSourceGetModel (NULL, source);65 if (model == NULL) return false; // model must be defined66 67 psTrace ("psphot", 3, "replacing object at %f,%f\n",68 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);69 51 70 52 // replace the model if 1) state says it is missing or 2) useState is false (just do it) 71 53 if (!state || !useState) { 72 pm ModelAdd (source->pixels, source->mask, model, false, false);54 pmSourceAdd (source, PM_MODEL_OP_FULL); 73 55 } 74 56 return true; 75 57 } 76 58 77 // add or sub source replace or if the source has59 // sub source, if the source has been added (or if we ignore the state) 78 60 bool psphotSubWithTest (pmSource *source, bool useState) { 79 61 … … 82 64 if (state && useState) return true; 83 65 84 // select appropriate model85 pmModel *model = pmSourceGetModel (NULL, source);86 if (model == NULL) return false; // model must be defined87 88 psTrace ("psphot", 3, "replacing object at %f,%f\n",89 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);90 91 66 // replace the model if 1) state says it is missing or 2) useState is false (just do it) 92 67 if (!state || !useState) { 93 pm ModelSub (source->pixels, source->mask, model, false, false);68 pmSourceSub (source, PM_MODEL_OP_FULL); 94 69 } 95 70 return true; … … 102 77 bool newState = !(source->mode & PM_SOURCE_MODE_SUBTRACTED); 103 78 if (curState == newState) return true; 104 105 // select appropriate model106 pmModel *model = pmSourceGetModel (NULL, source);107 if (model == NULL) return false; // model must be defined108 109 psTrace ("psphot", 3, "replacing object at %f,%f\n",110 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);111 79 112 80 if (curState && !newState) { 113 pm ModelSub (source->pixels, source->mask, model, false, false);81 pmSourceSub (source, PM_MODEL_OP_FULL); 114 82 } 115 83 if (newState && !curState) { 116 pm ModelAdd (source->pixels, source->mask, model, false, false);84 pmSourceAdd (source, PM_MODEL_OP_FULL); 117 85 } 118 86 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
