Changeset 37633
- Timestamp:
- Nov 19, 2014, 1:02:03 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotGalaxyParams.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotGalaxyParams.c
r37626 r37633 10 10 11 11 fprintf (stdout, "\n"); 12 psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Galaxy Param ters ---");12 psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Galaxy Parameters ---"); 13 13 14 14 // select the appropriate recipe information … … 33 33 for (int i = 0; i < num; i++) { 34 34 if (!psphotGalaxyParamsReadout (config, view, filerule, i, recipe)) { 35 psError (PSPHOT_ERR_CONFIG, false, "failed on galaxy param ter measurements for %s entry %d", filerule, i);35 psError (PSPHOT_ERR_CONFIG, false, "failed on galaxy parameter measurements for %s entry %d", filerule, i); 36 36 return false; 37 37 } … … 256 256 // don't try and use bad models 257 257 pmModelStatus badModel = PM_MODEL_STATUS_NONE; 258 badModel |= PM_MODEL_STATUS_NONCONVERGE; 258 259 badModel |= PM_MODEL_STATUS_BADARGS; 259 260 badModel |= PM_MODEL_STATUS_OFFIMAGE; … … 337 338 // do we need this? 338 339 source->mode |= PM_SOURCE_MODE_NONLINEAR_FIT; 339 if (source->modelEXT->isPCM) { 340 pmPCMCacheModel (source, maskVal, psfSize, fitNsigmaConv); 341 } else { 342 pmSourceCacheModel (source, maskVal); 343 } 344 } 340 #ifdef notdef 341 #endif 342 } 343 345 344 346 345 psF32 *PAR = sersicModel->params->data.F32; 347 346 psF32 Xo = PAR[PM_PAR_XPOS]; 348 347 psF32 Yo = PAR[PM_PAR_YPOS]; 349 348 psF32 Io = PAR[PM_PAR_I0]; 350 349 // For now: set the half light radius to the major axis of the model 351 350 psEllipseAxes axes = pmPSF_ModelToAxes (PAR, sersicModel->class->useReff); … … 363 362 pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, 2*radius); 364 363 364 // RedefinePixels frees modelFlux 365 if (source->modelEXT->isPCM) { 366 pmPCMCacheModel (source, maskVal, psfSize, fitNsigmaConv); 367 } else { 368 pmSourceCacheModel (source, maskVal); 369 } 365 370 366 371 #ifdef DUMP_IMAGES … … 485 490 vPix = source->pixels->data.F32; 486 491 vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA; 492 psF32 **vVar = source->variance->data.F32; 493 psF32 **vModel = source->modelFlux->data.F32; 487 494 // Accumulate Rt and Ra 488 495 psF32 sumRt = 0; 489 496 psF32 sumRa = 0; 490 497 int numPixels = 0; 498 psF32 sumB = 0; 499 psF32 sumModel = 0; 500 int numB = 0; 491 501 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 492 502 psF32 yDiff = row - yCM; … … 506 516 if (r2 > R2) continue; 507 517 518 // Measurement of bumpiness parameter excludes the pixels 519 // within 2 pixels of the center 520 if (r2 > 4) { 521 psF32 variance = vVar[row][col]; 522 if (isfinite(variance)) { 523 psF32 modelPixel = vModel[row][col]; 524 if (!isfinite(modelPixel)) { 525 // XXX: Can this happen in a good model? 526 fprintf(stderr, "non-finite modelPixel %4d (%4d, %4d)\n", source->id, col, row); 527 } 528 numB++; 529 sumB += PS_SQR(pixel) - variance; 530 sumModel += Io * modelPixel; 531 } 532 } 533 508 534 // x coordinate of mirror pixel 509 535 int xFlip = xCM - xDiff; … … 519 545 ++numPixels; 520 546 } 547 } 548 549 if (numB > 0) { 550 source->extpars->gbumpy = sqrt(sumB/numB) / (sumModel / numB); 521 551 } 522 552
Note:
See TracChangeset
for help on using the changeset viewer.
