Windowfilter

From Eigenvector Research Documentation Wiki
Revision as of 15:27, 10 September 2018 by imported>Neal (→‎Options)
Jump to navigation Jump to search

Purpose

Spectral filtering.

Synopsis

xf = windowfilter(x,win,options);
xf = windowfilter(x,win,'algorithm');

Description

Rows of X are filtered using a windowed filtering. Note: To allow robust statistics the filter is based on a moving window (or box), and is slow compared to other filter methods.

Inputs

  • x = data of class 'double' or 'dataset'.
If 'dataset' it must x.type=='data' or 'image'.
If 'double' it must be MxN.
  • win = an odd integer corresponding to the window width of the filter.

Optional Inputs

  • algorithm = an string which will be used as the options.algorithm input (only valid when options input is omitted)

Outputs

  • xf = Filtered spectra class 'dataset'.

Options

options = a structure array with the following fields:

  • display: [ {'on'} | 'off' ], governs level of display,
  • algorithm: [ {'mean'} | 'median' | 'max' | 'min' | 'despike' | 'meantrimmed' | 'mediantrimmed' ] governs filter method.

despike parameters

  • tol: { [] } if empty then despike uses the std(median(x)) within each window to define the tolerance within the window. If tol>0 scalar, then tol defines the tolerance for all the windows. If tol<=0, then tol is estimated by the mean absolute deviation of madc(x.data(:)) and is the tolerance used for all the windows (see MADAC) .
  • dsthreshold: [ {2} ] Threshold used for the 'despike' algorithm. In contrast to replacing all values with the meidan (e.g., for options.algorithm = 'median'), 'despike' replaces only values outside |x-median(x)|>options.dsthreshold*options.tol with the median. (see options.tol)
  • trbflag: [ {'middle'} | 'bottom' | 'top' ] top-or-bottom flag. For trbflag = 'middle' the filter replaces values outside |x-median(x)|>dsthreshold*options.tol) with the median. For trbflag = 'bottom' the filter replaces values outside (x-median(x))>dsthreshold*options.tol with the median. For trbflag = 'top' the filter replaces values outside (median(x)-x)>dsthreshold*soptions.tol with the median.

ntrim parameters

  • ntrim: when algorithm = 'meantrimmed' or 'mediantrimmed', (ntrim) is the input (n) to the functions MEANTRIMMED or MEDIANTRIMED {default = 2}.

See Also

line_filter, box_filter