Changeset 37811
- Timestamp:
- Jan 11, 2015, 2:57:41 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
psLib/src/imageops/psImageMapFit.c (modified) (1 diff)
-
psLib/src/math/psMinimizePolyFit.c (modified) (1 prop)
-
psModules/src/objects/pmPSFtryMakePSF.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF.c.in (modified) (1 prop)
-
psModules/src/objects/pmTrend2D.c (modified) (2 diffs)
-
psphot/src/psphotChoosePSF.c (modified) (2 diffs)
-
psphot/src/psphotExtendedSourceAnalysis.c (modified) (1 diff)
-
psphot/src/psphotGalaxyParams.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageMapFit.c
r37721 r37811 286 286 // fprintf (stderr, "Total: %f\n", Total); 287 287 288 double MaxPivot = 0.0; 289 for (int i = 0; i < Nx*Ny; i++) { 290 MaxPivot = PS_MAX(MaxPivot, fabs(A->data.F32[i][i])); 291 // fprintf (stderr, "piv, max: %f : %f\n", A->data.F32[i][i], MaxPivot); 292 } 293 288 294 // test for empty diagonal elements (unconstained cells), mark, and set pivots to 1.0 289 295 psVector *Empty = psVectorAlloc (Nx*Ny, PS_TYPE_S8); 290 296 psVectorInit (Empty, 0); 297 double MinPivot = 0.025*MaxPivot; 291 298 for (int i = 0; i < Nx*Ny; i++) { 292 if (A->data.F32[i][i] == 0.0) {299 if (fabs(A->data.F32[i][i]) < MinPivot) { 293 300 Empty->data.S8[i] = 1; 294 301 for (int j = 0; j < Nx*Ny; j++) { -
trunk/psLib/src/math/psMinimizePolyFit.c
- Property svn:mergeinfo changed
/tags/ipp-20141224/psLib/src/math/psMinimizePolyFit.c (added) merged: 37809-37810
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/pmPSFtryMakePSF.c
r36858 r37811 45 45 #include "pmSourceVisual.h" 46 46 47 bool pmPSF_DataDump (char *filename, psVector *x, psVector *y, psVector *e0, psVector *e1, psVector *e2, psVector *mask); 48 47 49 /***************************************************************************** 48 50 pmPSFFromPSFtry (psfTry): build a PSF model from a collection of source->modelEXT entries … … 356 358 } 357 359 360 bool pmPSF_DataDump (char *filename, psVector *x, psVector *y, psVector *e0, psVector *e1, psVector *e2, psVector *mask) { 361 362 363 FILE *f = fopen (filename, "w"); 364 if (!f) return false; 365 366 for (int i = 0; i < x->n; i++) { 367 368 fprintf (f, "%6.1f %6.1f : %5.2f %5.2f %5.2f : %2d\n", 369 x->data.F32[i], 370 y->data.F32[i], 371 e0->data.F32[i], 372 e1->data.F32[i], 373 e2->data.F32[i], 374 mask->data.U8[i]); 375 } 376 fclose (f); 377 return true; 378 } -
trunk/psModules/src/objects/pmSourceIO_CMF.c.in
- Property svn:mergeinfo changed
/tags/ipp-20141224/psModules/src/objects/pmSourceIO_CMF.c.in (added) merged: 37773,37809-37810
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/pmTrend2D.c
r30044 r37811 211 211 // XXX need to add the API which adjusts the scale 212 212 status = psImageMapClipFit(pGoodFit, trend->map, trend->stats, mask, maskVal, x, y, f, df); 213 if (!status) { 214 psError(PS_ERR_UNKNOWN, true, "failed to build PSF model map"); 215 return false; 216 } 217 218 // the psf model map can have nan pixels: repair this by extrapolation / interpolation 219 // XXX TEST: p_psImagePrint(0, trend->map->map, "before"); 220 status = psImageMapRepair (trend->map->map); 221 // XXX TEST: p_psImagePrint(0, trend->map->map, "after"); 222 if (!status) { 223 psError(PS_ERR_UNKNOWN, true, "failed to repair PSF model map"); 224 return false; 225 } 213 226 break; 214 227 … … 217 230 } 218 231 return status; 232 } 233 234 bool psImageMapRepair (psImage *map) { 235 236 237 // XXX why is my repair not working?? 238 239 // patch over bad regions (use average of 8 possible neighbor pixels) 240 // XXX consider testing all pixels against the 8 neighbors and replacing outliers... 241 double Count = 0; // number of good pixels 242 double Value = 0; // sum of good pixel's value 243 for (int iy = 0; iy < map->numRows; iy++) { 244 for (int ix = 0; ix < map->numCols; ix++) { 245 if (isfinite(map->data.F32[iy][ix])) { 246 Value += map->data.F32[iy][ix]; 247 Count++; 248 continue; 249 } 250 251 double value = 0; 252 double count = 0; 253 for (int jy = iy - 1; jy <= iy + 1; jy++) { 254 if (jy < 0) continue; 255 if (jy >= map->numRows) continue; 256 for (int jx = ix - 1; jx <= ix + 1; jx++) { 257 if (!jx && !jy) continue; 258 if (jx < 0) continue; 259 if (jx >= map->numCols) continue; 260 if (!isfinite(map->data.F32[jy][jx])) continue; 261 value += map->data.F32[jy][jx]; 262 count += 1.0; 263 } 264 } 265 if (count > 0) { 266 // psLogMsg ("psphot", PS_LOG_DETAIL, "patching image map %d, %d: %f (%d pts)\n", ix, iy, (value / count), (int) count); 267 map->data.F32[iy][ix] = value / count; 268 } 269 } 270 } 271 if (Count == 0) { 272 psError(PS_ERR_UNKNOWN, true, "failed to repair PSF model map"); 273 return false; 274 } 275 Value /= Count; 276 277 // patch over remaining bad regions (use global average) 278 for (int iy = 0; iy < map->numRows; iy++) { 279 for (int ix = 0; ix < map->numCols; ix++) { 280 if (!isnan(map->data.F32[iy][ix])) continue; 281 map->data.F32[iy][ix] = Value; 282 } 283 } 284 return true; 219 285 } 220 286 -
trunk/psphot/src/psphotChoosePSF.c
r37767 r37811 476 476 psFree (modelPSF); 477 477 478 float fwhmtest = pmPSFtoFWHM(psf, xc, yc);479 fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);478 // float fwhmtest = pmPSFtoFWHM(psf, xc, yc); 479 // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest); 480 480 } 481 481 } … … 630 630 psFree (modelPSF); 631 631 632 float fwhmtest = pmPSFtoFWHM(psf, xc, yc);633 fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);632 // float fwhmtest = pmPSFtoFWHM(psf, xc, yc); 633 // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest); 634 634 } 635 635 -
trunk/psphot/src/psphotExtendedSourceAnalysis.c
r36375 r37811 38 38 39 39 /*** for the moment, this test code : it is not thread safe ***/ 40 int Nall = 0;41 int Nskip1 = 0;42 int Nskip2 = 0;43 int Nskip3 = 0;44 int Nskip4 = 0;45 int Nskip5 = 0;46 int Nskip6 = 0;40 static int Nall = 0; 41 static int Nskip1 = 0; 42 static int Nskip2 = 0; 43 static int Nskip3 = 0; 44 static int Nskip4 = 0; 45 static int Nskip5 = 0; 46 static int Nskip6 = 0; 47 47 48 48 # define SKIP(VALUE) { VALUE++; continue; } -
trunk/psphot/src/psphotGalaxyParams.c
r37772 r37811 1 1 # include "psphotInternal.h" 2 2 3 #define USE_FOOTPRINTS 1 3 # define PRINT_STUFF 0 4 # define USE_FOOTPRINTS 1 4 5 5 6 // measure some properties on the exended objects … … 40 41 } 41 42 42 #ifdef notdef 43 // # define COUNT_SKIPS 44 # ifdef COUNT_SKIPS 43 45 /*** for the moment, this test code : it is not thread safe ***/ 44 int Nall= 0;45 int Nskip1= 0;46 int Nskip2= 0;47 int Nskip3= 0;48 int Nskip4= 0;49 int Nskip5= 0;50 int Nskip6= 0;51 46 static int Nskip1 = 0; 47 static int Nskip2 = 0; 48 static int Nskip3 = 0; 49 static int Nskip4 = 0; 50 static int Nskip5 = 0; 51 static int Nskip6 = 0; 52 static int Nskip7 = 0; 53 static int Nskip8 = 0; 52 54 # define SKIP(VALUE) { VALUE++; continue; } 53 54 #endif //notdef 55 56 #define SKIP(VALUE) {continue;} 55 # else 56 # define SKIP(VALUE) {continue;} 57 # endif //notdef 57 58 58 59 // aperture-like measurements for extended sources … … 104 105 105 106 psImage *footprintImage = NULL; 106 #if defUSE_FOOTPRINTS107 #if USE_FOOTPRINTS 107 108 footprintImage = psImageAlloc(readout->image->numCols, readout->image->numRows, PS_TYPE_S32); 108 109 psImageInit(footprintImage, 0); 109 pmSetFootprintArrayIDsForImage(footprintImage, detections->footprints, true);110 pmSetFootprintArrayIDsForImage(footprintImage, detections->footprints, false); 110 111 #endif 111 112 … … 207 208 208 209 // # if (PS_TRACE_ON) 209 # if (0)210 # ifdef COUNT_SKIPS 210 211 fprintf (stderr, "ext analysis skipped @ 1 : %d\n", Nskip1); 211 212 fprintf (stderr, "ext analysis skipped @ 2 : %d\n", Nskip2); … … 214 215 fprintf (stderr, "ext analysis skipped @ 5 : %d\n", Nskip5); 215 216 fprintf (stderr, "ext analysis skipped @ 6 : %d\n", Nskip6); 217 fprintf (stderr, "ext analysis skipped @ 7 : %d\n", Nskip7); 218 fprintf (stderr, "ext analysis skipped @ 8 : %d\n", Nskip8); 216 219 #endif 217 220 … … 221 224 222 225 // psphotVisualShowPetrosians (sources); 226 227 // XXX TEST: SAVE IMAGE: 228 // psphotSaveImage (NULL, readout->image, "resid.fits"); 223 229 224 230 return true; … … 240 246 psMetadata *recipe = job->args->data[3]; 241 247 242 #if ndef USE_FOOTPRINTS248 #if (!USE_FOOTPRINTS) 243 249 float skynoise = PS_SCALAR_VALUE(job->args->data[4],F32); 244 250 #endif … … 256 262 // don't try and use bad models 257 263 pmModelStatus badModel = PM_MODEL_STATUS_NONE; 258 badModel |= PM_MODEL_STATUS_NONCONVERGE; 264 // badModel |= PM_MODEL_STATUS_NONCONVERGE; this causes most objects to get unmeasured 259 265 badModel |= PM_MODEL_STATUS_BADARGS; 260 266 badModel |= PM_MODEL_STATUS_OFFIMAGE; … … 291 297 292 298 // Nall ++; 299 300 bool testObject = FALSE; 301 // testObject = testObject || ((fabs(source->peak->xf - 5788) < 10) && (fabs(source->peak->yf - 5711) < 10)); 302 // testObject = testObject || ((fabs(source->peak->xf - 96) < 10) && (fabs(source->peak->yf - 5550) < 10)); 303 // testObject = testObject || ((fabs(source->peak->xf - 300) < 10) && (fabs(source->peak->yf - 5988) < 10)); 304 if (testObject) { 305 fprintf (stderr, "test object: %f, %f\n", source->peak->xf, source->peak->yf); 306 testObject = TRUE; 307 } 293 308 294 309 // rules for measuring petrosian parameters for specific objects are set in … … 403 418 #endif 404 419 405 #if def USE_FOOTPRINTS420 #if (USE_FOOTPRINTS) 406 421 psS32 **vFootprint = footprintImage->data.S32; 407 422 #else … … 436 451 } 437 452 438 #ifdef USE_FOOTPRINTS 439 if (vFootprint[yImage][xImage]) { 440 #else 441 if (fabs(pixel) >= threshold) { 442 #endif 453 #if (USE_FOOTPRINTS) 454 // this is a pixel in the object 455 if (vFootprint[yImage][xImage] == source->peak->footprint->id) { 443 456 SET_MARK(MARK_SOURCE); 444 457 continue; 458 } 459 // this is a pixel in another object 460 if (vFootprint[yImage][xImage] > 0.0) continue; 461 #else 462 // this is a pixel in an object (this or the other) 463 if (fabs(pixel) >= threshold) { 464 continue 445 465 } 466 #endif 446 467 // we have a background pixel. 447 468 // Check whether it's mirror is a background pixel as well. … … 456 477 if (isnan(mirrorPixel)) continue; 457 478 458 #if def USE_FOOTPRINTS479 #if (USE_FOOTPRINTS) 459 480 if (vFootprint[yFlip + row0][xFlip + col0] == 0) { 460 481 #else … … 581 602 source->extpars->gS2 = source->extpars->gRT + source->extpars->gRA; 582 603 583 #if def PRINT_STUFF604 #if (PRINT_STUFF) 584 605 if (Ngood % 40 == 1) { 585 printf(" id sumI rHL rad sumI gRT gRA sumRt sumBt numPixels numBGPixels\n"); 586 } 587 printf("%5d %5.2e %3.1f %10.1f %6.3f %6.3f %5.2e %5.2e %10d %6ld\n", 588 source->id, sumI, source->extpars->ghalfLightRadius, radius, source->extpars->gRT, source->extpars->gRA, sumRt, sumBt, numPixels, bgPixels->n); 606 fprintf (stderr, " id sumI rHL rad sumI gRT gRA sumRt sumBt numPixels numBGPixels\n"); 607 } 608 fprintf (stderr, "%5d %5.1f %5.1f : %5.2e %4.1f %10.1f %6.3f %6.3f %5.2e %5.2e %10d %6ld\n", 609 source->id, source->peak->xf, source->peak->yf, 610 sumI, source->extpars->ghalfLightRadius, 611 radius, 612 source->extpars->gRT, 613 source->extpars->gRA, sumRt, sumBt, numPixels, bgPixels->n); 589 614 #endif 590 615 … … 592 617 restoreModel: 593 618 594 if ((extModel != sersicModel) || !isExtended) { 619 if (testObject) { 620 fprintf (stderr, "done with %d\n", source->id); 621 } 622 623 # define USE_BEST_FIT TRUE 624 // XXX TEST: Keep the sersic model regardless 625 if (USE_BEST_FIT && ((extModel != sersicModel) || !isExtended)) { 595 626 // add the sersic model back in 596 627 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) {
Note:
See TracChangeset
for help on using the changeset viewer.
