IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10172


Ignore:
Timestamp:
Nov 22, 2006, 7:29:35 PM (20 years ago)
Author:
eugene
Message:

added config option for several possible stats to measure sky

File:
1 edited

Legend:

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

    r10133 r10172  
    1010    psRegion region;
    1111    int MAX_SAMPLE_PIXELS;
     12    static char *defaultStatsName = "FITTED_MEAN";
    1213
    1314    pmReadout *model = NULL;
     
    3536    if (!status) {
    3637        SKY_BIAS = 0;
     38    }
     39
     40    // supply the sky background statistic name:
     41    char *statsName = psMetadataLookupStr (&status, recipe, "SKY_STAT");
     42    if (statsName == NULL) {
     43        statsName = defaultStatsName;
     44    }
     45    psStatsOptions statsOption = psStatsOptionFromString (statsName);
     46    if (!(statsOption & (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_MEDIAN | PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_QUARTILE | PS_STAT_CLIPPED_MEAN | PS_STAT_FITTED_MEAN))) {
     47        statsOption = PS_STAT_FITTED_MEAN;
    3748    }
    3849
     
    105116
    106117            // XXX the value of the upper and lower cuts probably should be studied...
    107             psStats *stats = psImageBackground(subset, submask, 0xff, 0.25, 0.75, MAX_SAMPLE_PIXELS, rng);
    108             modelData[iy][ix] = stats->robustMedian + SKY_BIAS;
     118            psStats *stats = psImageBackground(subset, submask, 0xff, 0.25, 0.75, MAX_SAMPLE_PIXELS, statsOption, rng);
     119            if (stats->options & PS_STAT_ROBUST_QUARTILE) {
     120                modelData[iy][ix] = stats->robustMedian + SKY_BIAS;
     121            } else {   
     122                modelData[iy][ix] = psStatsGetValue (stats, statsOption) + SKY_BIAS;
     123            }
    109124
    110125            psFree (stats);
Note: See TracChangeset for help on using the changeset viewer.