- Timestamp:
- Jun 25, 2012, 5:15:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120601/psphot/src/psphotFitSourcesLinear.c
r34060 r34071 273 273 source->mode |= PM_SOURCE_MODE_PSFMODEL; 274 274 } 275 275 276 276 psArrayAdd (fitSources, 100, source); 277 277 } … … 308 308 309 309 // diagonal elements of the sparse matrix (auto-cross-product) 310 f = pmSourceModelDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal);311 psSparseMatrixElement (sparse, i, i, f);310 float MM = pmSourceModelDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal); 311 psSparseMatrixElement (sparse, i, i, MM); 312 312 313 313 // if we have used CONSTANT errors, then we need to re-calculate the value of the parameter error 314 if (fitVarMode == PM_SOURCE_PHOTFIT_CONST) {314 if (fitVarMode != PM_SOURCE_PHOTFIT_IMAGE_VAR) { 315 315 float var = pmSourceModelDotModel (SRCi, SRCi, PM_SOURCE_PHOTFIT_IMAGE_VAR, covarFactor, maskVal); 316 316 errors->data.F32[i] = 1.0 / sqrt(var); 317 317 } else { 318 errors->data.F32[i] = 1.0 / sqrt( f);318 errors->data.F32[i] = 1.0 / sqrt(MM); 319 319 } 320 320 321 321 // find the image x model value 322 f = pmSourceDataDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal);323 psSparseVectorElement (sparse, i, f);322 float FM = pmSourceDataDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal); 323 psSparseVectorElement (sparse, i, FM); 324 324 325 325 // add the per-source variances (border region) … … 435 435 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "sub models: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem); 436 436 437 // mean stats on fit windows 438 float sumRadius = 0.0; 439 float sumPixels = 0.0; 440 float sumSource = 0.0; 441 437 442 // measure chisq for each source 438 443 // for (int i = 0; final && (i < fitSources->n); i++) { … … 440 445 pmSource *source = fitSources->data[i]; 441 446 pmModel *model = pmSourceGetModel (NULL, source); 447 448 // accumulate fit windows statistics 449 sumRadius += model->fitRadius; 450 sumPixels += M_PI*PS_SQR(model->fitRadius); 451 sumSource += 1.0; 452 442 453 if (!(source->mode & PM_SOURCE_MODE_NONLINEAR_FIT)) { 443 454 model->nPar = 1; // LINEAR-only sources have 1 parameter; NONLINEAR sources have their original value … … 446 457 } 447 458 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "get chisqs: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem); 459 460 float meanRadius = sumRadius / sumSource; 461 float meanPixels = sumPixels / sumSource; 448 462 449 463 // psFree (index); … … 455 469 psFree (border); 456 470 457 psLogMsg ("psphot.ensemble", PS_LOG_WARN, "measure ensemble of PSFs : %f sec\n", psTimerMark ("psphot.linear"));471 psLogMsg ("psphot.ensemble", PS_LOG_WARN, "measure ensemble of PSFs (mean radius = %f pixels, mean area = %f pixels: %f sec\n", meanRadius, meanPixels, psTimerMark ("psphot.linear")); 458 472 459 473 psphotVisualPlotChisq (sources); … … 466 480 return true; 467 481 } 468 469 // XXX do we need this?470 // XXX disallow the simultaneous sky fit and remove this code...471 482 472 483 // Calculate the weight terms for the sky fit component of the matrix. This function operates … … 558 569 ); 559 570 560 bool psphotGenerateModelVariance (pmConfig *config, const pmFPAview *view, pmFPAfile *file, int index, psMetadata *recipe, pmReadout *readout, psArray *sources) {571 bool psphotGenerateModelVariance (pmConfig *config, const pmFPAview *view, pmFPAfile *file, int index, psMetadata *recipe, pmReadout *readout, psArray *sources) { 561 572 562 573 bool status = false; … … 599 610 return false; 600 611 } 601 602 612 psFree (varModel); 603 613 psFree (varModelStdev); … … 612 622 } 613 623 if (gain > 2.0) { /* warn? */ } 624 // XXX we are not actually using the gain, but need to test it to avoid gcc pedantic warnings 614 625 615 626 // insert all of the source models
Note:
See TracChangeset
for help on using the changeset viewer.
