IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 20, 2007, 10:45:00 AM (19 years ago)
Author:
Paul Price
Message:

Adding boxcar/gaussian smoothing of overscan vector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmBias.c

    r13810 r13920  
    1717#include "pmBias.h"
    1818
     19#define SMOOTH_NSIGMA 4.0               // Number of Gaussian sigma the smoothing kernel extends
     20
     21
    1922static void overscanOptionsFree(pmOverscanOptions *options)
    2023{
     
    2427}
    2528
    26 pmOverscanOptions *pmOverscanOptionsAlloc(bool single, pmFit fitType, unsigned int order, psStats *stat)
     29pmOverscanOptions *pmOverscanOptionsAlloc(bool single, pmFit fitType, unsigned int order, psStats *stat,
     30                                          int boxcar, float gauss)
    2731{
    2832    pmOverscanOptions *opts = psAlloc(sizeof(pmOverscanOptions));
     
    3438    opts->order = order;
    3539    opts->stat = psMemIncrRefCounter(stat);
     40
     41    // Smoothing
     42    opts->boxcar = boxcar;
     43    opts->gauss = gauss;
    3644
    3745    // Outputs
     
    151159            mask->data.U8[i] = 1;
    152160        }
     161    }
     162
     163    // Smooth the reduced vector
     164    if (overscanOpts->boxcar > 0) {
     165        psVector *smoothed = psVectorBoxcar(NULL, reduced, overscanOpts->boxcar); // Smoothed vector
     166        psFree(reduced);
     167        reduced = smoothed;
     168    }
     169    if (isfinite(overscanOpts->gauss) && overscanOpts->gauss > 0) {
     170        if (overscanOpts->boxcar > 0) {
     171            psWarning("Gaussian smoothing the boxcar smoothed overscan --- you asked for it.");
     172        }
     173        psVector *smoothed = psVectorSmooth(NULL, reduced, overscanOpts->gauss, SMOOTH_NSIGMA);
     174        psFree(reduced);
     175        reduced = smoothed;
    153176    }
    154177
Note: See TracChangeset for help on using the changeset viewer.