Header menu logo FSharp.Stats

Filtering Module

Functions and values

Function or value Description

correlateValid kernel signal

Full Usage: correlateValid kernel signal

Parameters:
    kernel : Vector<float> - Vector of length K (FIR filter, etc.).
    signal : Vector<float> - Vector of length N.

Returns: float[] An array of length max(1, N-K+1) with the "valid" correlation result. Typically used for FIR filtering.

"Valid" cross-correlation of a kernel kernel with a signal signal. Returns an array of length (signal.Length - kernel.Length + 1) if signal.Length >= kernel.Length, otherwise a single dot product if kernel.Length > signal.Length.

kernel : Vector<float>

Vector of length K (FIR filter, etc.).

signal : Vector<float>

Vector of length N.

Returns: float[]

An array of length max(1, N-K+1) with the "valid" correlation result. Typically used for FIR filtering.

optimizeWindowWidth polOrder windowWidthToTest blankSignal signalOfInterest

Full Usage: optimizeWindowWidth polOrder windowWidthToTest blankSignal signalOfInterest

Parameters:
    polOrder : int -
    windowWidthToTest : int[] -
    blankSignal : float[] -
    signalOfInterest : float[] -

Returns: int

Estimates the autocorrelation at lag 1 of a blank signal (containing only noise). Subsequently, the signal of interest is smoothed
several times by a savitzky golay filter using constant polynomial order and variing windowWidth. For each iteration, the deviation
of the smoothed to the original signal is computed and the autocorrelation at lag 1 of this residual noise is computed. The function returns the optimized
window width yielding a autocorrelation at lag 1 closest to the value computed for the blank signal.

Method is based on: https://doi.org/10.1021/ac0600196

polOrder : int

windowWidthToTest : int[]

blankSignal : float[]

signalOfInterest : float[]

Returns: int

Example

savitzkyGolay windowSize order deriv rate data

Full Usage: savitzkyGolay windowSize order deriv rate data

Parameters:
    windowSize : int - Must be odd and at least (order+2) if deriving.
    order : int - Polynomial order (must be >= deriv). A higher order can better fit curvature.
    deriv : int - Order of derivative to compute (0 => smoothing).
    rate : float - Scaling factor for derivative, typically sampling rate = 1.0 if no special scale needed.
    data : Vector<float> - The data vector to filter (length N).

Returns: float[] A float[] array with the filtered (or derived) signal, of length = data.Length.

Smooth (or differentiate) data with a Savitzky–Golay filter of given windowSize and polynomial order. The deriv parameter specifies the derivative order to compute (0 = smoothing only). The rate helps scale the derivative if deriv > 0.

windowSize : int

Must be odd and at least (order+2) if deriving.

order : int

Polynomial order (must be >= deriv). A higher order can better fit curvature.

deriv : int

Order of derivative to compute (0 => smoothing).

rate : float

Scaling factor for derivative, typically sampling rate = 1.0 if no special scale needed.

data : Vector<float>

The data vector to filter (length N).

Returns: float[]

A float[] array with the filtered (or derived) signal, of length = data.Length.

Type something to start searching.