IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 16, 2010, 10:03:48 PM (16 years ago)
Author:
Paul Price
Message:

Add concept CHIP.SEEING (seeing FWHM in pixels) for easy transport of this value. It's used in ppSub for the parameter scaling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotChoosePSF.c

    r26894 r26971  
    1515    // loop over the available readouts
    1616    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)) {
    1818            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        }
    2121    }
    2222    return true;
     
    3939    // do not generate a PSF if we already were supplied one
    4040    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);
    4242        return true;
    4343    }
     
    5050
    5151    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;
    5454    }
    5555
     
    111111    float gaussSigma = psMetadataLookupF32 (&status, readout->analysis, "MOMENTS_GAUSS_SIGMA");
    112112    if (!status) {
    113         gaussSigma = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");
     113        gaussSigma = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");
    114114    }
    115115    float fitScale = psMetadataLookupF32(&status, recipe, "PSF_FIT_RADIUS_SCALE");
     
    162162
    163163    if (stars->n < 50) {
    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);
     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);
    166166    } 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);
    168168    }
    169169
     
    354354    // save PSF on readout->analysis
    355355    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");
    357357        return false;
    358358    }
    359359    psFree (psf); // XXX double-check
    360360
    361     // move into psphotChoosePSF 
     361    // move into psphotChoosePSF
    362362    psphotVisualShowPSFModel (readout, psf);
    363363
     
    391391            pmModel *modelPSF = pmModelFromPSFforXY (psf, xc, yc, 1.0);
    392392            if (!modelPSF) {
    393                 fprintf (stderr, "?");
    394                 continue;
    395             }
     393                fprintf (stderr, "?");
     394                continue;
     395            }
    396396
    397397            // get the model full-width at half-max
     
    407407            float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
    408408            if (!isfinite(FWHM_MAJOR) || !isfinite(FWHM_MINOR)) {
    409                 fprintf (stderr, "!");
    410                 continue;
    411             }
     409                fprintf (stderr, "!");
     410                continue;
     411            }
    412412            psVectorAppend (fwhmMajor, FWHM_MAJOR);
    413413            psVectorAppend (fwhmMinor, FWHM_MINOR);
     
    426426    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_UQ",   PS_META_REPLACE, "PSF FWHM Major axis (upper quartile)", stats->sampleUQ);
    427427
     428    float fwhmMaj = stats->sampleMean;  // FWHM on major axis
     429
    428430    if (!psVectorStats (stats, fwhmMinor, NULL, NULL, 0)) {
    429431        psError(PS_ERR_UNKNOWN, false, "failure to measure stats for FWHM MINOR");
     
    434436    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_LQ",   PS_META_REPLACE, "PSF FWHM Minor axis (lower quartile)", stats->sampleLQ);
    435437    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    }
    436446
    437447    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",    PS_META_REPLACE, "PSF angle",           axes.theta);
     
    486496    FWHM_Y /= FWHM_N;
    487497    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    }
    488505
    489506    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.