File:Comparaison filtres median savitzky golay scipy.svg
Summary
| Description |
Français : Comparaison des filtres médian et de Savitzky-Golay mis en œuvre dans le module signal de la bibliothèque SciPy pour Python.
English: Comparison between the median and Savitzky-Golay filters implemented in the signal module of the Python SciPy library.
|
| Date | |
| Source | Own work |
| Author | Cdang |
Source code
Python code
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
epsilon = 0.1 # amplitude du bruit
x = np.linspace(0, 2, 40) # points d'abscisse
# Génération d'un signal gaussien bruité
y = 0.1*np.exp(-(10*(x - 1)*x + 0.125)) + epsilon*np.random.normal(x)
# Lissage
ylissemf = signal.medfilt(y, 7)
ylissesg = signal.savgol_filter(y, 7, 3)
# Affichage
fig, liste_axes = plt.subplots(1, 2, constrained_layout=True, figsize = [10, 6])
#fig = plt.figure(figsize = [10, 6])
liste_axes[0].plot(x, y, "b.")
liste_axes[0].plot(x, ylissemf, "k-", linewidth="0.5")
liste_axes[0].set_title("scipy.signal.medfilt(y, 7)")
liste_axes[1].plot(x, y, "b.")
liste_axes[1].plot(x, ylissesg, "k-", linewidth="0.5")
liste_axes[1].set_title("scipy.signal.savgol_filter(y, 7, 3)")
plt.savefig("comparaison_filtres_median_savitzky_golay_scipy.svg", format="svg")
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.