- Timestamp:
- Jun 6, 2011, 1:56:22 PM (15 years ago)
- Location:
- branches/czw_branch/20110406
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406
- Property svn:mergeinfo changed
-
branches/czw_branch/20110406/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20110404/psphot (added) merged: 31313-31314,31328,31337,31362,31364,31381,31384,31437,31444
- Property svn:mergeinfo changed
-
branches/czw_branch/20110406/psphot/src/psphotFitSourcesLinear.c
r31154 r31606 137 137 if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue; 138 138 139 // do not include MOMENTS_FAILURES in the fit 140 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue; 141 139 142 // XXX count saturated stars 140 143 if (source->mode & PM_SOURCE_MODE_SATSTAR) { … … 164 167 165 168 // check the integral of the model : is it large enough? 169 // apply mask? 166 170 float modelSum = 0.0; 171 float maskedSum = 0.0; 167 172 for (int iy = 0; iy < source->modelFlux->numRows; iy++) { 168 173 for (int ix = 0; ix < source->modelFlux->numCols; ix++) { 169 174 modelSum += source->modelFlux->data.F32[iy][ix]; 175 if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue; 176 maskedSum += source->modelFlux->data.F32[iy][ix]; 170 177 } 171 178 } 172 179 if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit) 173 // if (modelSum < 0.01) continue; // skip sources with no model constraint (somewhat arbitrary limit)174 180 if (modelSum < 0.8) { 175 fprintf (stderr, "low-sig model @ %f, %f (%f sum, %f peak)\n",176 source->peak->xf, source->peak->yf, m odelSum, source->peak->rawFlux);181 fprintf (stderr, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n", 182 source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux); 177 183 } 178 179 pmModel *model = pmSourceGetModel (NULL, source); 184 if (maskedSum < 0.5) { 185 fprintf (stderr, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n", 186 source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux); 187 } 188 189 bool isPSF = false; 190 pmModel *model = pmSourceGetModel (&isPSF, source); 180 191 181 192 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 182 193 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, model->fitRadius, "OR", markVal); 183 194 184 source->mode |= PM_SOURCE_MODE_LINEAR_FIT; 195 // we call this function multiple times. for the first time, we have only PSF models for all objects 196 // the second time has extended sources. If we ever fit the PSF model, we should raise this bit 197 source->mode |= PM_SOURCE_MODE_LINEAR_FIT; 198 if (isPSF) { 199 source->mode |= PM_SOURCE_MODE_PSFMODEL; 200 } 201 185 202 psArrayAdd (fitSources, 100, source); 186 203 } … … 260 277 } 261 278 } 279 280 # if (0) 281 static int npass = 0; 282 char name[128]; 283 FILE *f1 = NULL; 284 int fd = -1; 285 286 snprintf (name, 128, "sparse.Aij.%02d.dat", npass); 287 f1 = fopen (name, "w"); 288 psAssert (f1, "failed to open file\n"); 289 fd = fileno (f1); 290 p_psVectorPrint (fd, sparse->Aij, "Aij"); 291 fclose (f1); 292 293 snprintf (name, 128, "sparse.Bfj.%02d.dat", npass); 294 f1 = fopen (name, "w"); 295 psAssert (f1, "failed to open file\n"); 296 fd = fileno (f1); 297 p_psVectorPrint (fd, sparse->Bfj, "Bfj"); 298 fclose (f1); 299 300 snprintf (name, 128, "sparse.Qii.%02d.dat", npass); 301 f1 = fopen (name, "w"); 302 psAssert (f1, "failed to open file\n"); 303 fd = fileno (f1); 304 p_psVectorPrint (fd, sparse->Qii, "Qii"); 305 fclose (f1); 306 npass ++; 307 # endif 262 308 263 309 psSparseResort (sparse);
Note:
See TracChangeset
for help on using the changeset viewer.
