IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12436


Ignore:
Timestamp:
Mar 13, 2007, 4:42:49 PM (19 years ago)
Author:
eugene
Message:

adding SKY_CLIP_SIGMA option, using statsDefaults to reset stats options

File:
1 edited

Legend:

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

    r11384 r12436  
    6262        stats->options |= PS_STAT_USE_BINSIZE;
    6363    }
     64
     65    psMetadataConfigPrint (stderr, recipe);
     66
     67    // optionally set the sigma clipping
     68    stats->clipSigma = psMetadataLookupF32 (&status, recipe, "SKY_CLIP_SIGMA");
     69    if (!status) {
     70        stats->clipSigma = 1.0;
     71    }
     72
     73    // stats is not initialized by psStats???  use this to save the input options
     74    psStats *statsDefaults = psStatsAlloc (statsOption);
     75    *statsDefaults = *stats;
    6476
    6577    // find the currently selected readout
     
    142154            int sx = ix*DX - xOffset;
    143155            int sy = iy*DY - yOffset;
     156
     157            // XXX test override
     158            // sx = 1955;
     159            // sy = 4;
     160
    144161            region = psRegionSet (sx, sx + 2*DX, sy, sy + 2*DY);
    145162            region = psRegionForImage (image, region);
     
    152169            psImage *submask = psImageSubset (mask, region);
    153170
     171            // reset the default values
     172            *stats = *statsDefaults;
     173
    154174            // Use the selected background statistic for the first pass
    155175            // If it fails, fall back on the "ROBUST_MEDIAN" version
    156176            // If both fail, set the pixel to NAN and (below) interpolate
    157177            // XXX psImageBackground will probably be renamed psImageStats
     178            // XXX don't bother trying if there are no valid pixels...
    158179            if (psImageBackground(stats, subset, submask, 0xff, rng)) {
    159180                if (stats->options & PS_STAT_ROBUST_QUARTILE) {
     
    164185            } else {
    165186                psStatsOptions currentOptions = stats->options;
    166                 stats->options |= PS_STAT_ROBUST_MEDIAN;
     187                stats->options = PS_STAT_ROBUST_MEDIAN;
    167188                if (!psImageBackground(stats, subset, submask, 0xff, rng)) {
    168189                    psLogMsg ("psphot", PS_LOG_WARN, "Failed to estimate background using ROBUST_MEDIAN for "
     
    299320# ifdef TESTSAVE
    300321    psphotSaveImage (NULL, image, "backsub.fits");
     322    exit (1);
    301323# endif
    302324
    303325    psLogMsg ("psphot", PS_LOG_INFO, "subtracted background model: %f sec\n", psTimerMark ("psphot"));
    304326    psFree(stats);
     327    psFree(statsDefaults);
    305328    psFree(rng);
    306329
Note: See TracChangeset for help on using the changeset viewer.