Changeset 33085
- Timestamp:
- Jan 11, 2012, 6:56:47 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20111122/psModules/src/objects
- Files:
-
- 4 edited
-
pmModelFuncs.h (modified) (1 diff)
-
pmSource.c (modified) (9 diffs)
-
pmSourcePhotometry.c (modified) (7 diffs)
-
pmSourcePhotometry.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/psModules/src/objects/pmModelFuncs.h
r29004 r33085 46 46 47 47 typedef enum { 48 PM_MODEL_OP_NONE = 0x00, 49 PM_MODEL_OP_FUNC = 0x01, 50 PM_MODEL_OP_RES0 = 0x02, 51 PM_MODEL_OP_RES1 = 0x04, 52 PM_MODEL_OP_FULL = 0x07, 53 PM_MODEL_OP_SKY = 0x08, 54 PM_MODEL_OP_CENTER = 0x10, 55 PM_MODEL_OP_NORM = 0x20, 56 PM_MODEL_OP_NOISE = 0x40, 48 PM_MODEL_OP_NONE = 0x00, 49 PM_MODEL_OP_FUNC = 0x01, 50 PM_MODEL_OP_RES0 = 0x02, 51 PM_MODEL_OP_RES1 = 0x04, 52 PM_MODEL_OP_FULL = 0x07, 53 PM_MODEL_OP_SKY = 0x08, 54 PM_MODEL_OP_CENTER = 0x10, 55 PM_MODEL_OP_NORM = 0x20, 56 PM_MODEL_OP_NOISE = 0x40, 57 PM_MODEL_OP_MODELVAR = 0x80, 57 58 } pmModelOpMode; 58 59 -
branches/eam_branches/ipp-20111122/psModules/src/objects/pmSource.c
r32695 r33085 50 50 psFree(tmp->pixels); 51 51 psFree(tmp->variance); 52 psFree(tmp->modelVar); 52 53 psFree(tmp->maskObj); 53 54 psFree(tmp->maskView); … … 76 77 psFree (source->pixels); 77 78 psFree (source->variance); 79 psFree (source->modelVar); 78 80 psFree (source->maskObj); 79 81 psFree (source->maskView); … … 83 85 source->pixels = NULL; 84 86 source->variance = NULL; 87 source->modelVar = NULL; 85 88 source->maskObj = NULL; 86 89 source->maskView = NULL; … … 112 115 source->pixels = NULL; 113 116 source->variance = NULL; 117 source->modelVar = NULL; 114 118 source->maskObj = NULL; 115 119 source->maskView = NULL; … … 197 201 source->pixels = in->pixels ? psImageCopyView(NULL, in->pixels) : NULL; 198 202 source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL; 203 source->modelVar = in->modelVar ? psImageCopyView(NULL, in->modelVar) : NULL; 199 204 source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL; 200 205 … … 1025 1030 1026 1031 bool addNoise = mode & PM_MODEL_OP_NOISE; 1032 bool addModelVar = mode & PM_MODEL_OP_MODELVAR; 1033 1034 if (addModelVar) psAssert (source->modelVar, "programming error"); 1027 1035 1028 1036 // require the use of pmModelAddWithOffset if we are adding noise (because the model size and norm are rescaled) … … 1047 1055 } 1048 1056 1049 psF32 **target = source->pixels->data.F32;1057 psF32 **target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32; 1050 1058 1051 1059 for (int iy = 0; iy < source->modelFlux->numRows; iy++) { … … 1062 1070 } 1063 1071 } 1064 if (add) { 1065 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 1066 } else { 1067 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1072 if (!addModelVar) { 1073 if (add) { 1074 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 1075 } else { 1076 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1077 } 1068 1078 } 1069 1079 return true; … … 1074 1084 target = source->variance; 1075 1085 } 1086 if (addModelVar) { 1087 target = source->modelVar; 1088 } 1076 1089 1077 1090 if (add) { 1078 1091 status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy); 1079 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;1092 if (!addNoise && !addModelVar) source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 1080 1093 } else { 1081 1094 status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy); 1082 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;1095 if (!addNoise && !addModelVar) source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1083 1096 } 1084 1097 -
branches/eam_branches/ipp-20111122/psModules/src/objects/pmSourcePhotometry.c
r33044 r33085 903 903 { 904 904 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 905 double flux = 0, wt = 0, factor = 0;905 double flux = 0, wt = 1.0, factor = 0; 906 906 907 907 const psImage *Pi = Mi->modelFlux; … … 920 920 psAssert (Wi, "programming error"); 921 921 break; 922 case PM_SOURCE_PHOTFIT_NONE: 923 psAbort("programming error"); 922 924 } 923 925 … … 947 949 } 948 950 949 if (unweighted_sum) { 950 flux += (factor * Pi->data.F32[yi][xi]); 951 } else { 952 flux += (factor * Pi->data.F32[yi][xi]) / wt; 953 } 951 // wt is 1.0 for CONST 952 flux += (factor * Pi->data.F32[yi][xi]) / wt; 954 953 } 955 954 } … … 984 983 psAssert (Wi, "programming error"); 985 984 break; 985 case PM_SOURCE_PHOTFIT_NONE: 986 psAbort("programming error"); 986 987 } 987 988 … … 1023 1024 wt = covarFactor * Wi->data.F32[yi][xi]; 1024 1025 break; 1026 case PM_SOURCE_PHOTFIT_NONE: 1027 psAbort("programming error"); 1025 1028 } 1026 1029 // skip pixels with nonsense weight values … … 1060 1063 psAssert (Wi, "programming error"); 1061 1064 break; 1065 case PM_SOURCE_PHOTFIT_NONE: 1066 psAbort("programming error"); 1062 1067 } 1063 1068 … … 1099 1104 wt = covarFactor * Wi->data.F32[yi][xi]; 1100 1105 break; 1106 case PM_SOURCE_PHOTFIT_NONE: 1107 psAbort("programming error"); 1101 1108 } 1102 1109 // skip pixels with nonsense weight values -
branches/eam_branches/ipp-20111122/psModules/src/objects/pmSourcePhotometry.h
r33044 r33085 39 39 40 40 typedef enum { 41 PM_SOURCE_PHOTFIT_NONE, 41 42 PM_SOURCE_PHOTFIT_CONST, 42 43 PM_SOURCE_PHOTFIT_IMAGE_VAR,
Note:
See TracChangeset
for help on using the changeset viewer.
