sda.signal.smooth#
Created on Wed May 3 09:24:38 2017.
@author: p38
Summary#
Useful 1d smoothing functions Basic 2d smoothing functions Baseline smoothing functions
Classes#
Whittaker Smoother. |
Functions#
|
Smooth the data using a window with requested size. |
|
|
|
Smooth the data using a kernel with requested size. |
|
Compute the asymmetric least squares baseline. |
Module Contents#
- sda.signal.smooth.smooth(x, window_len=11, window='hanning')#
Smooth the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the begining and end part of the output signal.
- Parameters:
- Returns:
The smoothed signal.
- Return type:
array_like
Examples
>>> t = linspace(-5, 5, 1000) >>> x = sin(t) + randn(len(t)) * 0.1 >>> y = smooth(x, 11, "hanning")
See also
np.hanning,np.hamming,np.bartlett,np.blackman,np.convolve,scipy.signal.lfilterTODOthe window parameter could be the window itself if an array instead of a string
- sda.signal.smooth.smooth_matrix(x, window_len, window='hanning', axis=0)#
- sda.signal.smooth.smooth2d(x, kernel_dim=(11, 11), kernel='flat')#
Smooth the data using a kernel with requested size.
This method is based on the convolution of a scaled kernel with the signal. This method is based on the convolve2d method of scipy.signal.
The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the begining and end part of the output signal. (‘symm’ option convolve2d)
- Parameters:
- Returns:
the smoothed signal
- Return type:
array_like
- sda.signal.smooth.als_baseline(intensities, asymmetry_param=0.05, smoothness_param=1000000.0, max_iters=10, conv_thresh=1e-05, verbose=False)#
Compute the asymmetric least squares baseline.
- Parameters:
intensities (
array_like) – vector to smoothasymmetry_param (
float) – value will shift the baseline fit below or above your average line. To cancel gaussian noise, you would want the value to be0.5. To remove a positive peak would want it to be close to0. To remove a negative peaks (from a transmittance signal for instance) you would want it to be close to1. Default0.05smoothness_param (
float) – Relative importance of smoothness of the predicted response: the higher, the smoother the baseline. Suggested range:1e2to1e8. Default1e6max_iters (
int) – number of iterationsconv_thresh (
float) – convergenceverbose (
boolean)
Examples
from sda.signal.smooth import als_baseline I = als_baseline(I, smoothness_param=1e5, aymmetry_param=0.1)
References
https://zanran_storage.s3.amazonaws.com/www.science.uva.nl/ContentPages/443199618.pdf
http://www.science.uva.nl/~hboelens/publications/draftpub/Eilers_2005.pdf
Notes
Implementation:
uses
WhittakerSmoother()internally
See also