remove_noise
remove_noise(x, [method="wiener"], [window=5], [noise_var=])
Input: x, method, window, noise_var · Output: no output
What it is
x is a length-N number vector or Signal. method="wiener" (default): a local adaptive Wiener filter — for each sample, compares the local variance in a window-wide neighborhood (shrinking at the edges rather than padding) to the estimated noise variance (noise_var=, or the mean of every local variance across the record if not given); where local variance is at or below the noise floor the sample is fully smoothed to its local mean, where it is well above the original value is mostly kept. method="median": delegates to the existing medfilt(x, window), for outlier-shaped (impulsive/salt-pepper) corruption a Wiener filter would blur into a smear rather than remove — see tv_denoise above for a third option shaped for step-like signals instead of Gaussian-like noise. A Signal keeps its Fs.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
remove_noise(x, [method="wiener"], [window=5], [noise_var=]) | x number, vector, or Signalx is a length-N number vector or Signal.method optional (default "wiener")method="wiener" (default): a local adaptive Wiener filter — for each sample, compares the local variance in a window-wide neighborhood (shrinking at the edges rather than padding) to the estimated noise variance (noise_var=, or the mean of every local variance across the record if not given).window optional (default 5)method="wiener" (default): a local adaptive Wiener filter — for each sample, compares the local variance in a window-wide neighborhood (shrinking at the edges rather than padding) to the estimated noise variance (noise_var=, or the mean of every local variance across the record if not given).noise_var optionalmethod="wiener" (default): a local adaptive Wiener filter — for each sample, compares the local variance in a window-wide neighborhood (shrinking at the edges rather than padding) to the estimated noise variance (noise_var=, or the mean of every local variance across the record if not given). | not documented yet | A Signal keeps its Fs. |
Examples
No documentation example calls this form yet. The Noise chapter is where one belongs.
How it works
remove_noise(x, [method="wiener"], [window=5], [noise_var=]) — denoises x. method="wiener": a local adaptive Wiener filter (the same algorithm SciPy's wiener implements) — for each sample, compares the local variance in a window around it to the estimated noise variance (the mean of every local variance across the record, unless noise_var= is given explicitly): where local variance is at or below the noise floor, the sample is fully smoothed to the local mean (there is nothing but noise there); where it is well above, the original value is mostly kept. method="median" — delegates to the existing medfilt, for outlier-shaped noise a Wiener filter would blur instead of removing. window= is shared by both. A Signal keeps its Fs.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.