- Timestamp:
- Jun 19, 2012, 5:24:19 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 22 edited
-
. (modified) (1 prop)
-
psModules (modified) (1 prop)
-
psModules/src/objects/models/pmModel_QGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_SERSIC.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintCullPeaks.c (modified) (1 diff)
-
psModules/src/objects/pmModelFuncs.h (modified) (2 diffs)
-
psModules/src/objects/pmModelUtils.c (modified) (1 diff)
-
psModules/src/objects/pmPCMdata.c (modified) (1 diff)
-
psModules/src/objects/pmPSF.c (modified) (1 diff)
-
psModules/src/objects/pmPSFtryFitEXT.c (modified) (2 diffs)
-
psModules/src/objects/pmSource.c (modified) (13 diffs)
-
psModules/src/objects/pmSource.h (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_CMF.c.in (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_DV1.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceMoments.c (modified) (1 diff)
-
psModules/src/objects/pmSourceOutputs.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceOutputs.h (modified) (1 diff)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (15 diffs)
-
psModules/src/objects/pmSourcePhotometry.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psModules
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psModules/src/objects/models/pmModel_QGAUSS.c
r33415 r34041 402 402 assert (psf->params->n > PM_PAR_YPOS); 403 403 assert (psf->params->n > PM_PAR_XPOS); 404 405 if (! isfinite(Io)) { 406 fprintf(stderr, "non-finite Io passed to PM_MODEL_PARAMS_FROM_PSF\n"); 407 return false; 408 } 404 409 405 410 PAR[PM_PAR_SKY] = 0.0; -
branches/meh_branches/ppstack_test/psModules/src/objects/models/pmModel_SERSIC.c
r33415 r34041 192 192 psF32 z0 = PAR[PM_PAR_I0]*f1; 193 193 psF32 f0 = PAR[PM_PAR_SKY] + z0; 194 195 if (!isfinite(z0)) { 196 fprintf(stderr, "z0 is not finite for %f %f %f %f %f. Parameters: \n", X, Y, radius, z, f1); 197 fprintf(stderr, "%f %f %f %f %f %f %f %f\n", PAR[0], PAR[1], PAR[2], PAR[3], PAR[4], 198 PAR[5], PAR[6], PAR[7]); 199 } 194 200 195 201 assert (isfinite(f2)); -
branches/meh_branches/ppstack_test/psModules/src/objects/pmFootprintCullPeaks.c
r33415 r34041 178 178 psArray *myFP = pmFootprintsFind(subImg, threshold, 5); 179 179 if (!myFP) { 180 psWarning ("missing footprint? ");180 psWarning ("missing footprint? threshold: %.f", threshold); 181 181 continue; 182 182 } 183 183 if (!myFP->n) { 184 psWarning ("empty footprint? ");184 psWarning ("empty footprint? threshold: %.f", threshold); 185 185 psFree (myFP); 186 186 continue; -
branches/meh_branches/ppstack_test/psModules/src/objects/pmModelFuncs.h
r29004 r34041 29 29 # define PM_MODEL_FUNCS_H 30 30 31 # define HAVE_MODEL_VAR 1 32 31 33 /// @addtogroup Objects Object Detection / Analysis Functions 32 34 /// @{ … … 46 48 47 49 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, 50 PM_MODEL_OP_NONE = 0x00, 51 PM_MODEL_OP_FUNC = 0x01, 52 PM_MODEL_OP_RES0 = 0x02, 53 PM_MODEL_OP_RES1 = 0x04, 54 PM_MODEL_OP_FULL = 0x07, 55 PM_MODEL_OP_SKY = 0x08, 56 PM_MODEL_OP_CENTER = 0x10, 57 PM_MODEL_OP_NORM = 0x20, 58 PM_MODEL_OP_NOISE = 0x40, 59 # if (HAVE_MODEL_VAR) 60 PM_MODEL_OP_MODELVAR = 0x80, 61 # endif 57 62 } pmModelOpMode; 58 63 -
branches/meh_branches/ppstack_test/psModules/src/objects/pmModelUtils.c
r33415 r34041 144 144 145 145 *Io = source->peak->rawFlux; 146 147 #ifndef ALLOW_NONFINITE_PEAK 148 // Gene says fail of peak !finite 149 if (!isfinite(*Io)) return false; 150 #else 151 // This is the way it used to be. Somtimes an infinite value Io made it's way down the pipeline 152 // causing assertion failures 146 153 if (!isfinite(*Io) && !source->moments) return false; 147 154 148 155 *Io = source->moments->Peak; 149 156 if (!isfinite(*Io)) return false; 157 #endif 150 158 151 159 return true; -
branches/meh_branches/ppstack_test/psModules/src/objects/pmPCMdata.c
r33415 r34041 136 136 sum += value; 137 137 } 138 } 139 140 if (!(sum > 0.0)) { 141 // Crazy PSF image print out some debugging information ... 142 fprintf(stderr, "invalid kernel sum %f found by pmPCMkernelFromPSF\n", sum); for (int j = psf->yMin; j <= psf->yMax; j++) { 143 fprintf(stderr, "Row %d\n", j); 144 for (int i = psf->xMin; i <= psf->xMax; i++) { 145 double value = source->psfImage->data.F32[y0 + j][x0 + i]; 146 fprintf(stderr, " %d %f\n", i, value); 147 } 148 } 149 fflush(stderr); 150 // ... but avoid the asssertion two lines down by escaping 151 goto escape; 138 152 } 139 153 assert (sum > 0.0); -
branches/meh_branches/ppstack_test/psModules/src/objects/pmPSF.c
r33415 r34041 455 455 return NAN; 456 456 } 457 457 //MEH -- multiple ways of doing this in past? add param details to log useful for ppStack? 458 458 459 // get the model full-width at half-max 459 460 float fwhmMajor = 2*model->modelRadius (model->params, 0.5); -
branches/meh_branches/ppstack_test/psModules/src/objects/pmPSFtryFitEXT.c
r30621 r34041 73 73 continue; 74 74 } 75 // If mask object does not exist, mark the source as bad. 76 // We cannot proceed with it because psImageMaskPixels leaves an uncleared error code last which causes 77 // psphot to exit with a fault. 78 if (source->maskObj == NULL) { 79 psTrace ("psModules.objects", 4, "source %d (%d,%d) : null maskObj\n", i, source->peak->x, source->peak->y); 80 psfTry->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PSFTRY_MASK_EXT_FAIL; 81 continue; 82 } 75 83 76 84 source->modelEXT = pmSourceModelGuess (source, options->type); … … 89 97 90 98 // clear object mask to define valid pixels 91 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask99 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask 92 100 93 101 // exclude the poor fits -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSource.c
r33415 r34041 39 39 #include "pmSourceExtendedPars.h" 40 40 #include "pmSourceDiffStats.h" 41 #include "pmSourcePhotometry.h" 41 42 #include "pmSource.h" 42 43 … … 50 51 psFree(tmp->pixels); 51 52 psFree(tmp->variance); 53 # if (HAVE_MODEL_VAR) 54 psFree(tmp->modelVar); 55 # endif 52 56 psFree(tmp->maskObj); 53 57 psFree(tmp->maskView); … … 76 80 psFree (source->pixels); 77 81 psFree (source->variance); 82 # if (HAVE_MODEL_VAR) 83 psFree (source->modelVar); 84 # endif 78 85 psFree (source->maskObj); 79 86 psFree (source->maskView); … … 83 90 source->pixels = NULL; 84 91 source->variance = NULL; 92 # if (HAVE_MODEL_VAR) 93 source->modelVar = NULL; 94 # endif 85 95 source->maskObj = NULL; 86 96 source->maskView = NULL; … … 112 122 source->pixels = NULL; 113 123 source->variance = NULL; 124 # if (HAVE_MODEL_VAR) 125 source->modelVar = NULL; 126 # endif 114 127 source->maskObj = NULL; 115 128 source->maskView = NULL; … … 159 172 source->radialAper = NULL; 160 173 source->parent = NULL; 174 source->tmpPtr = NULL; 161 175 source->imageID = -1; 176 source->nFrames = 0; 162 177 163 178 psMemSetDeallocator(source, (psFreeFunc) sourceFree); … … 197 212 source->pixels = in->pixels ? psImageCopyView(NULL, in->pixels) : NULL; 198 213 source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL; 214 # if (HAVE_MODEL_VAR) 215 source->modelVar = NULL; 216 # endif 199 217 source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL; 200 218 … … 1026 1044 bool addNoise = mode & PM_MODEL_OP_NOISE; 1027 1045 1046 # if (HAVE_MODEL_VAR) 1047 bool addModelVar = mode & PM_MODEL_OP_MODELVAR; 1048 if (addModelVar) psAssert (source->modelVar, "programming error"); 1049 # endif 1050 1028 1051 // require the use of pmModelAddWithOffset if we are adding noise (because the model size and norm are rescaled) 1029 1052 if (!addNoise && source->modelFlux) { … … 1047 1070 } 1048 1071 1072 # if (HAVE_MODEL_VAR) 1073 psF32 **target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32; 1074 # else 1049 1075 psF32 **target = source->pixels->data.F32; 1076 # endif 1050 1077 1051 1078 for (int iy = 0; iy < source->modelFlux->numRows; iy++) { … … 1062 1089 } 1063 1090 } 1091 # if (HAVE_MODEL_VAR) 1092 if (!addModelVar) { 1093 if (add) { 1094 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 1095 } else { 1096 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1097 } 1098 } 1099 # else 1064 1100 if (add) { 1065 1101 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; … … 1067 1103 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1068 1104 } 1105 # endif 1069 1106 return true; 1070 1107 } … … 1074 1111 target = source->variance; 1075 1112 } 1113 # if (HAVE_MODEL_VAR) 1114 if (addModelVar) { 1115 target = source->modelVar; 1116 } 1117 # endif 1076 1118 1077 1119 if (add) { 1078 1120 status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy); 1121 # if (HAVE_MODEL_VAR) 1122 if (!addNoise && !addModelVar) source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 1123 # else 1079 1124 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 1125 # endif 1080 1126 } else { 1081 1127 status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy); 1128 # if (HAVE_MODEL_VAR) 1129 if (!addNoise && !addModelVar) source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1130 # else 1082 1131 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 1132 # endif 1083 1133 } 1084 1134 … … 1156 1206 PAR[PM_PAR_SYY] = oldshape.sy; 1157 1207 PAR[PM_PAR_SXY] = oldshape.sxy; 1208 1209 return true; 1210 } 1211 1212 bool pmSourceSmoothOp (pmSource *source, pmModelOpMode mode, psImage *target, float sigma, bool add, psImageMaskType maskVal, int dx, int dy) 1213 { 1214 // assert (mode & PM_MODEL_OP_NOISE); 1215 PS_ASSERT_PTR_NON_NULL(source, false); 1216 PS_ASSERT_PTR_NON_NULL(source->peak, false); 1217 PS_ASSERT_PTR_NON_NULL(target, false); 1218 1219 if (add) { 1220 psTrace ("psphot", 3, "adding smoothed object at %f,%f\n", source->peak->xf, source->peak->yf); 1221 } else { 1222 psTrace ("psphot", 3, "removing smooted object at %f,%f\n", source->peak->xf, source->peak->yf); 1223 } 1224 1225 pmModel *model = pmSourceGetModel(NULL, source); 1226 if (!model) { 1227 return false; 1228 } 1229 pmSourceSmoothOpModel (model, source, mode, target, sigma, add, maskVal, dx, dy); 1230 1231 return true; 1232 } 1233 1234 bool pmSourceSmoothOpModel (pmModel *model, pmSource *source, pmModelOpMode mode, psImage *target, float sigma, bool add, psImageMaskType maskVal, int dx, int dy) 1235 { 1236 bool status; 1237 psEllipseShape oldshape; 1238 psEllipseShape newshape; 1239 psEllipseAxes axes; 1240 1241 if (add) { 1242 psTrace ("psphot", 4, "adding smoothed object at %f,%f\n", model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]); 1243 } else { 1244 psTrace ("psphot", 4, "removing smoothed object at %f,%f\n", model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]); 1245 } 1246 1247 psF32 *PAR = model->params->data.F32; 1248 1249 // Isn't this hanging around somewhere? 1250 float oldFlux = NAN; 1251 if (!pmSourcePhotometryModel (NULL, &oldFlux, model)) return false; 1252 1253 // save original values 1254 float oldI0 = PAR[PM_PAR_I0]; 1255 float oldsxx = PAR[PM_PAR_SXX]; 1256 float oldsyy = PAR[PM_PAR_SYY]; 1257 float oldsxy = PAR[PM_PAR_SXY]; 1258 1259 // Since we are going to scale the flux correctly we need to get our 1260 // factors of sqrt(2) right 1261 oldshape.sx = oldsxx / M_SQRT2; 1262 oldshape.sy = oldsyy / M_SQRT2; 1263 oldshape.sxy = oldsxy; 1264 1265 // XXX can this be done more intelligently? 1266 if (oldI0 == 0.0) return false; 1267 if (!isfinite(oldI0)) return false; 1268 1269 // increase size and height of source 1270 axes = psEllipseShapeToAxes (oldshape, 20.0); 1271 axes.major = sqrt(PS_SQR(axes.major) + PS_SQR(sigma)); 1272 axes.minor = sqrt(PS_SQR(axes.minor) + PS_SQR(sigma)); 1273 newshape = psEllipseAxesToShape (axes); 1274 PAR[PM_PAR_SXX] = newshape.sx * M_SQRT2; 1275 PAR[PM_PAR_SYY] = newshape.sy * M_SQRT2; 1276 PAR[PM_PAR_SXY] = newshape.sxy; 1277 1278 PAR[PM_PAR_I0] = 1.0; 1279 1280 float newFlux; 1281 if (!pmSourcePhotometryModel (NULL, &newFlux, model)) return false; 1282 1283 PAR[PM_PAR_I0] = oldFlux / newFlux; 1284 1285 if (add) { 1286 status = pmModelAddWithOffset (target, source->maskObj, model, mode, maskVal, dx, dy); 1287 } else { 1288 status = pmModelSubWithOffset (target, source->maskObj, model, mode, maskVal, dx, dy); 1289 } 1290 1291 // restore original values 1292 PAR[PM_PAR_I0] = oldI0; 1293 PAR[PM_PAR_SXX] = oldsxx; 1294 PAR[PM_PAR_SYY] = oldsyy; 1295 PAR[PM_PAR_SXY] = oldsxy; 1158 1296 1159 1297 return true; -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSource.h
r33415 r34041 72 72 psImage *pixels; ///< Rectangular region including object pixels. 73 73 psImage *variance; ///< Image variance. 74 # if (HAVE_MODEL_VAR) 75 psImage *modelVar; ///< variance based on current models 76 # endif 74 77 psImage *maskObj; ///< unique mask for this object which marks included pixels associated with objects. 75 78 psImage *maskView; ///< view into global image mask for this object region … … 117 120 psArray *radialAper; ///< radial flux in circular apertures 118 121 pmSource *parent; ///< reference to the master source from which this is derived 122 psPtr *tmpPtr; ///< pointer that may be used to store data in a particular module. e.g. psphotKronIterate. 119 123 int imageID; 124 psU16 nFrames; 120 125 }; 121 126 … … 301 306 bool pmSourceNoiseOp (pmSource *source, pmModelOpMode mode, float FACTOR, float SIZE, bool add, psImageMaskType maskVal, int dx, int dy); 302 307 308 bool pmSourceSmoothOp (pmSource *source, pmModelOpMode mode, psImage *target, float sigma, bool add, psImageMaskType maskVal, int dx, int dy); 309 bool pmSourceSmoothOpModel (pmModel *model, pmSource *source, pmModelOpMode mode, psImage *target, float sigma, bool add, psImageMaskType maskVal, int dx, int dy); 310 303 311 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psImageMaskType maskVal, int dx, int dy); 304 312 bool pmSourceCacheModel (pmSource *source, psImageMaskType maskVal); -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceIO.c
r33415 r34041 1069 1069 for (long i = sources->n -1; i >= 0; i--) { 1070 1070 pmSource *source = sources->data[i]; 1071 if (source->seq < 0) { 1072 // This can happen cmf files that have been corrupted 1073 psError(PS_ERR_IO, true, "seq < 0 for source %ld: Suspect %s is corrupt", i, file->origname); 1074 return false; 1075 } 1071 1076 if (source->seq > seq_max) { 1072 1077 seq_max = source->seq; -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceIO_CMF.c.in
r33415 r34041 80 80 table = psArrayAllocEmpty (sources->n); 81 81 82 short nImageOverlap;83 82 float magOffset; 84 83 float zeroptErr; 85 84 float fwhmMajor; 86 85 float fwhmMinor; 87 pmSourceOutputsCommonValues (& nImageOverlap, &magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);86 pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader); 88 87 89 88 // we write out PSF-fits for all sources, regardless of quality. the source flags tell us the state … … 179 178 180 179 // XXX not sure how to get this : need to load Nimages with weight? 181 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", nImageOverlap);180 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", source->nFrames); 182 181 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PADDING", PS_DATA_S16, "padding", 0); 183 182 -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceIO_CMF_PS1_DV1.c
r33415 r34041 81 81 } 82 82 83 short nImageOverlap;84 83 float magOffset; 85 84 float zeroptErr; 86 85 float fwhmMajor; 87 86 float fwhmMinor; 88 pmSourceOutputsCommonValues (& nImageOverlap, &magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);87 pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader); 89 88 90 89 table = psArrayAllocEmpty (sources->n); … … 161 160 psMetadataAdd (row, PS_LIST_TAIL, "FLAGS", PS_DATA_U32, "psphot analysis flags", source->mode); 162 161 163 // XXX not sure how to get this : need to load Nimages with weight? 164 psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", nImageOverlap); 162 psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", source->nFrames); 165 163 psMetadataAdd (row, PS_LIST_TAIL, "PADDING", PS_DATA_S16, "padding", 0); 166 164 -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c
r33415 r34041 82 82 table = psArrayAllocEmpty (sources->n); 83 83 84 short nImageOverlap;85 84 float magOffset; 86 85 float zeroptErr; 87 86 float fwhmMajor; 88 87 float fwhmMinor; 89 pmSourceOutputsCommonValues (& nImageOverlap, &magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);88 pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader); 90 89 91 90 // we write out PSF-fits for all sources, regardless of quality. the source flags tell us the state … … 180 179 181 180 // XXX not sure how to get this : need to load Nimages with weight? 182 psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", nImageOverlap);181 psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", source->nFrames); 183 182 psMetadataAdd (row, PS_LIST_TAIL, "PADDING", PS_DATA_S16, "padding", 0); 184 183 -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c
r33415 r34041 84 84 table = psArrayAllocEmpty (sources->n); 85 85 86 short nImageOverlap;87 86 float magOffset; 88 87 float zeroptErr; 89 88 float fwhmMajor; 90 89 float fwhmMinor; 91 pmSourceOutputsCommonValues (& nImageOverlap, &magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);90 pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader); 92 91 93 92 // we write out PSF-fits for all sources, regardless of quality. the source flags tell us the state … … 170 169 psMetadataAdd (row, PS_LIST_TAIL, "FLAGS2", PS_DATA_U32, "psphot analysis flags", source->mode2); 171 170 172 // XXX not sure how to get this : need to load Nimages with weight? 173 psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", nImageOverlap); 171 psMetadataAdd (row, PS_LIST_TAIL, "N_FRAMES", PS_DATA_U16, "Number of frames overlapping source center", source->nFrames); 174 172 psMetadataAdd (row, PS_LIST_TAIL, "PADDING", PS_DATA_S16, "padding", 0); 175 173 -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceMoments.c
r33415 r34041 319 319 } 320 320 321 source->moments->Mrf = RF/RS;322 321 source->moments->Mrh = RH/RS; 323 322 324 // if Mrf (first radial moment) is very small, we are getting into low-significance323 // if Mrf = RF/RS (first radial moment) is very small, we are getting into low-significance 325 324 // territory. saturate at minKronRadius. conversely, if Mrf is >> radius for faint 326 325 // sources, we are clearly making an error. saturate at radius. 327 float kronRefRadius = MAX(minKronRadius, source->moments->Mrf);326 float kronRefRadius = MAX(minKronRadius, RF/RS); 328 327 if (source->moments->SN < 10) { 329 328 kronRefRadius = MIN(radius, kronRefRadius); 330 329 } 330 source->moments->Mrf = kronRefRadius; 331 331 332 332 // *** now calculate the kron flux values using the 1st radial moment -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceOutputs.c
r33415 r34041 40 40 #include "pmSourceOutputs.h" 41 41 42 bool pmSourceOutputsCommonValues ( short *nImageOverlap,float *magOffset, float *zeroptErr, float *fwhmMajor, float *fwhmMinor, pmReadout *readout, psMetadata *header) {42 bool pmSourceOutputsCommonValues (float *magOffset, float *zeroptErr, float *fwhmMajor, float *fwhmMinor, pmReadout *readout, psMetadata *header) { 43 43 44 44 pmFPA *fpa = readout->parent->parent->parent; … … 72 72 } 73 73 74 *nImageOverlap = psMetadataLookupS32 (&status2, header, "NINPUTS");75 74 return true; 76 75 -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceOutputs.h
r33415 r34041 56 56 } pmSourceOutputsMoments; 57 57 58 bool pmSourceOutputsCommonValues ( short *nImageOverlap,float *magOffset, float *zeroptErr, float *fwhmMajor, float *fwhmMinor, pmReadout *readout, psMetadata *header);58 bool pmSourceOutputsCommonValues (float *magOffset, float *zeroptErr, float *fwhmMajor, float *fwhmMinor, pmReadout *readout, psMetadata *header); 59 59 60 60 bool pmSourceOutputsSetValues (pmSourceOutputs *outputs, pmSource *source, pmChip *chip, float fwhmMajor, float fwhmMinor, float magOffset); -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourcePhotometry.c
r33415 r34041 899 899 } 900 900 901 # if (HAVE_MODEL_VAR) 902 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal) 903 # else 901 904 double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal) 905 # endif 902 906 { 903 907 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 908 # if (HAVE_MODEL_VAR) 909 double flux = 0, wt = 1.0, factor = 0; 910 # else 904 911 double flux = 0, wt = 0, factor = 0; 912 # endif 905 913 906 914 const psImage *Pi = Mi->modelFlux; 907 915 assert (Pi != NULL); 916 917 # if (HAVE_MODEL_VAR) 918 const psImage *Wi = NULL; 919 switch (fitVarMode) { 920 case PM_SOURCE_PHOTFIT_CONST: 921 break; 922 case PM_SOURCE_PHOTFIT_IMAGE_VAR: 923 Wi = Mi->variance; 924 psAssert (Wi, "programming error"); 925 break; 926 case PM_SOURCE_PHOTFIT_MODEL_VAR: 927 Wi = Mi->modelVar; 928 psAssert (Wi, "programming error"); 929 break; 930 case PM_SOURCE_PHOTFIT_NONE: 931 psAbort("programming error"); 932 } 933 # else 908 934 const psImage *Wi = Mi->variance; 909 935 if (!unweighted_sum) { 910 936 assert (Wi != NULL); 911 937 } 938 # endif 912 939 const psImage *Ti = Mi->maskObj; 913 940 assert (Ti != NULL); … … 917 944 if (Ti->data.PS_TYPE_IMAGE_MASK_DATA[yi][xi] & maskVal) 918 945 continue; 946 # if (HAVE_MODEL_VAR) 947 if (fitVarMode != PM_SOURCE_PHOTFIT_CONST) { 948 wt = covarFactor * Wi->data.F32[yi][xi]; 949 if (wt == 0) continue; 950 } 951 # else 919 952 if (!unweighted_sum) { 920 953 wt = covarFactor * Wi->data.F32[yi][xi]; … … 922 955 continue; 923 956 } 957 # endif 924 958 925 959 switch (term) { … … 937 971 } 938 972 973 # if (HAVE_MODEL_VAR) 974 // wt is 1.0 for CONST 975 flux += (factor * Pi->data.F32[yi][xi]) / wt; 976 # else 939 977 if (unweighted_sum) { 940 978 flux += (factor * Pi->data.F32[yi][xi]); … … 942 980 flux += (factor * Pi->data.F32[yi][xi]) / wt; 943 981 } 982 # endif 944 983 } 945 984 } … … 947 986 } 948 987 988 # if (HAVE_MODEL_VAR) 989 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal) 990 # else 949 991 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal) 992 # endif 950 993 { 951 994 PS_ASSERT_PTR_NON_NULL(Mi, NAN); … … 955 998 int xIs, xJs, yIs, yJs; 956 999 int xIe, yIe; 1000 # if (HAVE_MODEL_VAR) 1001 double flux; 1002 double wt = 1.0; 1003 # else 957 1004 double flux, wt; 1005 # endif 958 1006 959 1007 const psImage *Pi = Mi->modelFlux; … … 962 1010 assert (Pj != NULL); 963 1011 1012 # if (HAVE_MODEL_VAR) 1013 const psImage *Wi = NULL; 1014 switch (fitVarMode) { 1015 case PM_SOURCE_PHOTFIT_CONST: 1016 break; 1017 case PM_SOURCE_PHOTFIT_IMAGE_VAR: 1018 Wi = Mi->variance; 1019 psAssert (Wi, "programming error"); 1020 break; 1021 case PM_SOURCE_PHOTFIT_MODEL_VAR: 1022 Wi = Mi->modelVar; 1023 psAssert (Wi, "programming error"); 1024 break; 1025 case PM_SOURCE_PHOTFIT_NONE: 1026 psAbort("programming error"); 1027 } 1028 # else 964 1029 const psImage *Wi = Mi->variance; 965 1030 if (!unweighted_sum) { 966 1031 assert (Wi != NULL); 967 1032 } 1033 # endif 968 1034 969 1035 const psImage *Ti = Mi->maskObj; … … 995 1061 continue; 996 1062 1063 # if (HAVE_MODEL_VAR) 1064 float value = (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]); 1065 switch (fitVarMode) { 1066 case PM_SOURCE_PHOTFIT_CONST: 1067 wt = 1.0; 1068 break; 1069 case PM_SOURCE_PHOTFIT_IMAGE_VAR: 1070 case PM_SOURCE_PHOTFIT_MODEL_VAR: 1071 wt = covarFactor * Wi->data.F32[yi][xi]; 1072 break; 1073 case PM_SOURCE_PHOTFIT_NONE: 1074 psAbort("programming error"); 1075 } 1076 // skip pixels with nonsense weight values 1077 if (wt <= 0) continue; 1078 1079 flux += value / wt; 1080 # else 997 1081 // XXX skip the nonsense weight pixels? 998 1082 if (unweighted_sum) { … … 1004 1088 } 1005 1089 } 1090 # endif 1006 1091 } 1007 1092 } … … 1009 1094 } 1010 1095 1096 # if (HAVE_MODEL_VAR) 1097 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal) 1098 # else 1011 1099 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal) 1100 # endif 1012 1101 { 1013 1102 PS_ASSERT_PTR_NON_NULL(Mi, NAN); … … 1017 1106 int xIs, xJs, yIs, yJs; 1018 1107 int xIe, yIe; 1108 # if (HAVE_MODEL_VAR) 1109 double flux; 1110 double wt = 1.0; 1111 # else 1019 1112 double flux, wt; 1113 # endif 1020 1114 1021 1115 const psImage *Pi = Mi->pixels; … … 1024 1118 assert (Pj != NULL); 1025 1119 1120 # if (HAVE_MODEL_VAR) 1121 const psImage *Wi = NULL; 1122 switch (fitVarMode) { 1123 case PM_SOURCE_PHOTFIT_CONST: 1124 break; 1125 case PM_SOURCE_PHOTFIT_IMAGE_VAR: 1126 Wi = Mi->variance; 1127 psAssert (Wi, "programming error"); 1128 break; 1129 case PM_SOURCE_PHOTFIT_MODEL_VAR: 1130 Wi = Mi->modelVar; 1131 psAssert (Wi, "programming error"); 1132 break; 1133 case PM_SOURCE_PHOTFIT_NONE: 1134 psAbort("programming error"); 1135 } 1136 # else 1026 1137 const psImage *Wi = Mi->variance; 1027 1138 if (!unweighted_sum) { 1028 1139 assert (Wi != NULL); 1029 1140 } 1141 # endif 1030 1142 1031 1143 const psImage *Ti = Mi->maskObj; … … 1057 1169 continue; 1058 1170 1171 # if (HAVE_MODEL_VAR) 1172 float value = (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]); 1173 switch (fitVarMode) { 1174 case PM_SOURCE_PHOTFIT_CONST: 1175 wt = 1.0; 1176 break; 1177 case PM_SOURCE_PHOTFIT_IMAGE_VAR: 1178 case PM_SOURCE_PHOTFIT_MODEL_VAR: 1179 wt = covarFactor * Wi->data.F32[yi][xi]; 1180 break; 1181 case PM_SOURCE_PHOTFIT_NONE: 1182 psAbort("programming error"); 1183 } 1184 // skip pixels with nonsense weight values 1185 if (wt <= 0) continue; 1186 1187 flux += value / wt; 1188 1189 # else 1059 1190 // XXX skip the nonsense weight pixels? 1060 1191 if (unweighted_sum) { … … 1066 1197 } 1067 1198 } 1199 # endif 1068 1200 } 1069 1201 } -
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourcePhotometry.h
r31670 r34041 38 38 } pmSourcePhotometryMode; 39 39 40 # if (HAVE_MODEL_VAR) 41 typedef enum { 42 PM_SOURCE_PHOTFIT_NONE = 0, 43 PM_SOURCE_PHOTFIT_CONST = 1, 44 PM_SOURCE_PHOTFIT_IMAGE_VAR = 2, 45 PM_SOURCE_PHOTFIT_MODEL_VAR = 3, 46 } pmSourceFitVarMode; 47 # endif 48 40 49 bool pmSourcePhotometryModel( 41 50 float *fitMag, ///< integrated fit magnitude … … 75 84 bool pmSourceMeasureDiffStats (pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 76 85 86 # if (HAVE_MODEL_VAR) 87 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal); 88 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal); 89 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal); 90 # else 77 91 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal); 78 92 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal); 79 93 double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal); 94 # endif 80 95 81 96 bool pmSourceNeighborFlags (pmSource *source);
Note:
See TracChangeset
for help on using the changeset viewer.
