IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13920


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

Adding boxcar/gaussian smoothing of overscan vector

Location:
trunk/psModules/src/detrend
Files:
2 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
  • trunk/psModules/src/detrend/pmBias.h

    r13810 r13920  
    55 * @author Paul Price, IfA
    66 *
    7  * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-06-14 02:03:29 $
     7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-06-20 20:45:00 $
    99 * Copyright 2004--2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    3434{
    3535    // Inputs
    36     bool single;                ///< Reduce all overscan regions to a single value?
    37     pmFit fitType;              ///< Type of fit to overscan
    38     unsigned int order;         ///< Order of polynomial, or number of spline pieces
    39     psStats *stat;              ///< Statistic to use when reducing the minor direction
     36    bool single;                        ///< Reduce all overscan regions to a single value?
     37    pmFit fitType;                      ///< Type of fit to overscan
     38    unsigned int order;                 ///< Order of polynomial, or number of spline pieces
     39    psStats *stat;                      ///< Statistic to use when reducing the minor direction
     40    int boxcar;                         ///< Boxcar smoothing radius
     41    float gauss;                        ///< Gaussian smoothing sigma
    4042    // Outputs
    41     psPolynomial1D *poly;       ///< Result of polynomial fit
    42     psSpline1D *spline;         ///< Result of spline fit
     43    psPolynomial1D *poly;               ///< Result of polynomial fit
     44    psSpline1D *spline;                 ///< Result of spline fit
    4345}
    4446pmOverscanOptions;
     
    4648/// Allocator for overscan options
    4749pmOverscanOptions *pmOverscanOptionsAlloc(bool single, ///< Reduce all overscan regions to a single value?
    48         pmFit fitType, ///< Type of fit to overscan
    49         unsigned int order, ///< Order of polynomial, or number of splines
    50         psStats *stat ///< Statistic to use
     50                                          pmFit fitType, ///< Type of fit to overscan
     51                                          unsigned int order, ///< Order of polynomial, or number of splines
     52                                          psStats *stat, ///< Statistic to use
     53                                          int boxcar, ///< Boxcar smoothing radius
     54                                          float gauss ///< Gaussian smoothing sigma
    5155                                         );
    5256
Note: See TracChangeset for help on using the changeset viewer.