Changeset 26971 for trunk/psphot/src/psphotChoosePSF.c
- Timestamp:
- Feb 16, 2010, 10:03:48 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotChoosePSF.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotChoosePSF.c
r26894 r26971 15 15 // loop over the available readouts 16 16 for (int i = 0; i < num; i++) { 17 if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, recipe)) {17 if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, recipe)) { 18 18 psError (PSPHOT_ERR_CONFIG, false, "failed to choose a psf model for PSPHOT.INPUT entry %d", i); 19 return false;20 }19 return false; 20 } 21 21 } 22 22 return true; … … 39 39 // do not generate a PSF if we already were supplied one 40 40 if (psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF")) { 41 psLogMsg ("psphot", PS_LOG_DETAIL, "psf model supplied for input file %d", index);41 psLogMsg ("psphot", PS_LOG_DETAIL, "psf model supplied for input file %d", index); 42 42 return true; 43 43 } … … 50 50 51 51 if (!sources->n) { 52 psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping PSF model");53 return true;52 psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping PSF model"); 53 return true; 54 54 } 55 55 … … 111 111 float gaussSigma = psMetadataLookupF32 (&status, readout->analysis, "MOMENTS_GAUSS_SIGMA"); 112 112 if (!status) { 113 gaussSigma = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");113 gaussSigma = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA"); 114 114 } 115 115 float fitScale = psMetadataLookupF32(&status, recipe, "PSF_FIT_RADIUS_SCALE"); … … 162 162 163 163 if (stars->n < 50) { 164 // ROBUST is too agressive if we only have a small number of PSF stars165 options->stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);164 // ROBUST is too agressive if we only have a small number of PSF stars 165 options->stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 166 166 } else { 167 options->stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);167 options->stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 168 168 } 169 169 … … 354 354 // save PSF on readout->analysis 355 355 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot psf model", psf)) { 356 psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");356 psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout"); 357 357 return false; 358 358 } 359 359 psFree (psf); // XXX double-check 360 360 361 // move into psphotChoosePSF 361 // move into psphotChoosePSF 362 362 psphotVisualShowPSFModel (readout, psf); 363 363 … … 391 391 pmModel *modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0); 392 392 if (!modelPSF) { 393 fprintf (stderr, "?");394 continue;395 }393 fprintf (stderr, "?"); 394 continue; 395 } 396 396 397 397 // get the model full-width at half-max … … 407 407 float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major); 408 408 if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) { 409 fprintf (stderr, "!");410 continue;411 }409 fprintf (stderr, "!"); 410 continue; 411 } 412 412 psVectorAppend (fwhmMajor, FWHM_MAJOR); 413 413 psVectorAppend (fwhmMinor, FWHM_MINOR); … … 426 426 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_UQ", PS_META_REPLACE, "PSF FWHM Major axis (upper quartile)", stats->sampleUQ); 427 427 428 float fwhmMaj = stats->sampleMean; // FWHM on major axis 429 428 430 if (!psVectorStats (stats, fwhmMinor, NULL, NULL, 0)) { 429 431 psError(PS_ERR_UNKNOWN, false, "failure to measure stats for FWHM MINOR"); … … 434 436 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_LQ", PS_META_REPLACE, "PSF FWHM Minor axis (lower quartile)", stats->sampleLQ); 435 437 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_UQ", PS_META_REPLACE, "PSF FWHM Minor axis (upper quartile)", stats->sampleUQ); 438 439 float fwhmMin = stats->sampleMean; // FWHM on minor axis 440 if (readout->parent) { 441 pmChip *chip = readout->parent->parent; // Parent chip 442 psAssert(chip, "Cell should be attached to a chip."); 443 psMetadataItem *item = psMetadataLookup(chip->analysis, "CHIP.SEEING"); // Item with chip 444 item->data.F32 = 0.5 * (fwhmMaj + fwhmMin); 445 } 436 446 437 447 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE", PS_META_REPLACE, "PSF angle", axes.theta); … … 486 496 FWHM_Y /= FWHM_N; 487 497 FWHM_T /= FWHM_N; 498 499 if (readout->parent) { 500 pmChip *chip = readout->parent->parent; // Parent chip 501 psAssert(chip, "Cell should be attached to a chip."); 502 psMetadataItem *item = psMetadataLookup(chip->analysis, "CHIP.SEEING"); // Item with chip 503 item->data.F32 = 0.5 * (FWHM_X + FWHM_Y); 504 } 488 505 489 506 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FWHM_MAJ", PS_META_REPLACE, "PSF FWHM Major axis (mean)", FWHM_X);
Note:
See TracChangeset
for help on using the changeset viewer.
