neurotools.signal.savitskygolay module
- neurotools.signal.savitskygolay.SGOrd(m, fc, fs)[source]
Compute polynomial order for Savitsky-Golay filter
Fc = (N+1)/(3.2M-4.6) For fixed M, Fc N = Fc*(3.2M-4.6)-1
- Parameters:
m (length of filter in samples)
fc (low frequency cutoff)
fs (sample rate)
- neurotools.signal.savitskygolay.SGKern(m, n)[source]
Generate kernel for Savitsky-Golay smoothing.
- Parameters:
m (positive int) – Radius of kernel in samples
n (positive int) – Degree of polynomial
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGKernV(m, n)[source]
Generate kernel for Savitsky-Golay differentiation.
- Parameters:
m (positive int) – Radius of kernel in samples
n (positive int) – Degree of polynomial
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGKernA(m, n)[source]
Generate kernel for Savitsky-Golay second-derivative.
- Parameters:
m (positive int) – Radius of kernel in samples
n (positive int) – Degree of polynomial
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGKernJ(m, n)[source]
Generate kernel for Savitsky-Golay third derivative.
- Parameters:
m (positive int) – Radius of kernel in samples
n (positive int) – Degree of polynomial
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGfilt(m, fc, fs)[source]
Generate kernel for Savitsky-Golay smoothing, based on the desired low-pass frequency cutoff fc (in Hz) for a signal with sample rate fs (in Hz).
- Parameters:
m (positive int) – Radius of kernel in samples
fc (positive float) – Low-frequency cutoff in Hz
fs (positive float) – Sample rate, in Hz
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGfiltA(m, fc, fs)[source]
Generate kernel for Savitsky-Golay second derivative, based on the desired low-pass frequency cutoff fc (in Hz) for a signal with sample rate fs (in Hz).
- Parameters:
m (positive int) – Radius of kernel in samples
fc (positive float) – Low-frequency cutoff in Hz
fs (positive float) – Sample rate, in Hz
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGfiltJ(m, fc, fs)[source]
Generate kernel for Savitsky-Golay third derivative, based on the desired low-pass frequency cutoff fc (in Hz) for a signal with sample rate fs (in Hz).
- Parameters:
m (positive int) – Radius of kernel in samples
fc (positive float) – Low-frequency cutoff in Hz
fs (positive float) – Sample rate, in Hz
- Returns:
k – Length 2*m+1 convolution kernel representing the specified filter.
- Return type:
np.array
- neurotools.signal.savitskygolay.SGsmooth(x, m, fc, fs)[source]
Smooth using a Savitsky-Golay filter
- Parameters:
x (signal to smooth)
m (length of filter in samples)
fc (low frequency cutoff)
fs (sample rate)
- neurotools.signal.savitskygolay.SGdifferentiate(x, m, fc, fs)[source]
Differentiate and smooth using a Savitsky-Golay filter
- Parameters:
x (signal to smooth + differentiate)
m (length of filter in samples)
fc (low frequency cutoff)
fs (sample rate)