Changeset 30753
- Timestamp:
- Feb 24, 2011, 12:49:04 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 4 edited
-
psphotChoosePSF.c (modified) (1 diff)
-
psphotGuessModels.c (modified) (3 diffs)
-
psphotSourceStats.c (modified) (4 diffs)
-
psphotVisual.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphotChoosePSF.c
r30624 r30753 335 335 return NULL; 336 336 } 337 338 // XXX does this work here? 339 psphotVisualShowPSFStars (recipe, try->psf, try->sources); 337 340 338 341 // build the flux-to-magnitude conversion information -
branches/eam_branches/ipp-20110213/psphot/src/psphotGuessModels.c
r30038 r30753 160 160 pmSource *source = sources->data[i]; 161 161 162 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) { 163 fprintf (stderr, "moment failure\n"); 164 } 165 162 166 // this is used to mark sources for which the model is measured. We check later that 163 167 // all are used. … … 187 191 useMoments = (useMoments && source->moments); // can't if there are no moments 188 192 useMoments = (useMoments && source->moments->nPixels); // can't if the moments were not measured 189 useMoments = (useMoments && !(source->mode & &PM_SOURCE_MODE_MOMENTS_FAILURE)); // can't if the moments failed...193 useMoments = (useMoments && !(source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE)); // can't if the moments failed... 190 194 191 195 float Xo, Yo; … … 198 202 } 199 203 204 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 205 fprintf (stderr, "satstar: %f,%f vs %f,%f : %c\n", 206 source->moments->Mx, source->moments->My, 207 source->peak->xf, source->peak->yf, 208 (useMoments ? 'T' : 'F')); 209 } 210 200 211 // set PSF parameters for this model (apply 2D shape model to coordinates Xo, Yo) 201 212 pmModel *modelPSF = pmModelFromPSFforXY(psf, Xo, Yo, Io); -
branches/eam_branches/ipp-20110213/psphot/src/psphotSourceStats.c
r29936 r30753 122 122 // allocate space for moments 123 123 source->moments = pmMomentsAlloc(); 124 125 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) { 126 fprintf (stderr, "moment failure\n"); 127 } 124 128 125 129 // allocate image, weight, mask arrays for each peak (square of radius OUTER) … … 361 365 362 366 bool status = false; 363 float BIG_RADIUS;364 367 psScalar *scalar = NULL; 365 368 … … 415 418 continue; 416 419 } 420 421 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 422 fprintf (stderr, "satstar: %f,%f\n", source->peak->xf, source->peak->yf); 423 } 417 424 418 425 // measure basic source moments (no S/N clipping on input pixels) … … 431 438 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 432 439 } 433 if (status ) {440 if (status && (source->moments->Mrf < 2.0*SIGMA)) { 434 441 Nmoments ++; 435 442 continue; 436 443 } 437 444 438 // if no valid pixels, or massive swing, likely saturated source,445 // if no valid pixels, massive swing or very large Mrf, likely saturated source, 439 446 // try a much larger box 440 BIG_RADIUS = PS_MIN (INNER, 3*RADIUS); 447 float BIG_RADIUS = 3.0*RADIUS; 448 float BIG_SIGMA = 3.0*SIGMA; 449 450 { 451 // NOTE this is slightly sleazy, but only slightly: pmSourceRedefinePixels uses the readout 452 // to pass the pointers to the parent image data. I guess the API could be simplified: 453 // we could recover this from the source in the function 454 455 pmReadout tmpReadout; 456 tmpReadout.image = (psImage *)source->pixels->parent; 457 tmpReadout.mask = (psImage *)source->maskView->parent; 458 tmpReadout.variance = (psImage *)source->variance->parent; 459 460 // re-allocate image, weight, mask arrays for each peak (square of radius OUTER) 461 pmSourceRedefinePixels (source, &tmpReadout, source->peak->x, source->peak->y, BIG_RADIUS + 2); 462 } 463 441 464 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y); 442 status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, 0.0, maskVal);465 status = pmSourceMoments (source, BIG_RADIUS, BIG_SIGMA, 0.0, maskVal); 443 466 if (status) { 444 467 source->mode |= PM_SOURCE_MODE_BIG_RADIUS; -
branches/eam_branches/ipp-20110213/psphot/src/psphotVisual.c
r30749 r30753 218 218 } 219 219 220 bool psphotVisualScaleImage (int kapaFD, psImage *inImage, psImage *inMask, const char *name, int channel) {220 bool psphotVisualScaleImage (int kapaFD, psImage *inImage, psImage *inMask, const char *name, float factor, int channel) { 221 221 222 222 KiiImage image; … … 239 239 strcpy (data.name, name); 240 240 strcpy (data.file, name); 241 data.zero = stats->robustMedian - stats->robustStdev; 242 data.range = 5*stats->robustStdev; 241 data.zero = stats->robustMedian - factor*stats->robustStdev; 242 243 // XXX I we have a smoothed image, this make a much-too-tight display range 244 data.range = 5*factor*stats->robustStdev; 243 245 data.logflux = 0; 244 246 … … 283 285 if (kapa == -1) return false; 284 286 287 float factor = 1.0; 288 if (readout->covariance) { 289 factor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); 290 } 291 285 292 psphotVisualShowMask (kapa, readout->mask, "mask", 2); 286 psphotVisualScaleImage (kapa, readout->variance, readout->mask, "variance", 1 );287 psphotVisualScaleImage (kapa, readout->image, readout->mask, "image", 0);293 psphotVisualScaleImage (kapa, readout->variance, readout->mask, "variance", 1.0, 1); 294 psphotVisualScaleImage (kapa, readout->image, readout->mask, "image", sqrt(factor), 0); 288 295 289 296 pmVisualAskUser(NULL); … … 303 310 pmReadout *backgnd = READOUT_OR_INTERNAL(view, file); 304 311 305 psphotVisualScaleImage (kapa, backgnd->image, readout->mask, "backgnd", 2); 306 psphotVisualScaleImage (kapa, readout->image, readout->mask, "backsub", 0); 312 float factor = 1.0; 313 if (readout->covariance) { 314 factor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); 315 } 316 317 psphotVisualScaleImage (kapa, backgnd->image, readout->mask, "backgnd", 1.0, 2); 318 psphotVisualScaleImage (kapa, readout->image, readout->mask, "backsub", sqrt(factor), 0); 307 319 308 320 pmVisualAskUser(NULL); … … 1221 1233 } 1222 1234 1223 psphotVisualScaleImage (myKapa, outsat, NULL, "satstar", 2);1235 psphotVisualScaleImage (myKapa, outsat, NULL, "satstar", 1.0, 2); 1224 1236 1225 1237 pmVisualAskUser(NULL); … … 2490 2502 if (myKapa == -1) return false; 2491 2503 2504 float factor = 1.0; 2505 if (readout->covariance) { 2506 factor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); 2507 } 2508 2492 2509 if (reshow) { 2493 2510 psphotVisualShowMask (myKapa, readout->mask, "mask", 2); 2494 psphotVisualScaleImage (myKapa, readout->variance, readout->mask, "variance", 1 );2495 } 2496 psphotVisualScaleImage (myKapa, readout->image, readout->mask, "resid", 0);2511 psphotVisualScaleImage (myKapa, readout->variance, readout->mask, "variance", 1.0, 1); 2512 } 2513 psphotVisualScaleImage (myKapa, readout->image, readout->mask, "resid", sqrt(factor), 0); 2497 2514 2498 2515 pmVisualAskUser(NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
