From 9a308f6e2c665e9a5c73851fa68b94dd8640516d Mon Sep 17 00:00:00 2001 From: Sebastian Clerson Date: Wed, 13 Mar 2024 10:16:53 +0100 Subject: [PATCH 1/2] Fix merge conflict --- TP2/README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/TP2/README.md b/TP2/README.md index 8e81e48..624191f 100644 --- a/TP2/README.md +++ b/TP2/README.md @@ -21,19 +21,11 @@ Commencez par cloner ce dépôt: Commencez par configurer Git sur votre PC. -<<<<<<< HEAD -Dans l'explorateur de fichiers, allez jusqu'à l'emplacement du dépôt téléchargé, puis ouvrir une console Git Bash avec un clic droit. - -```bash -# permet de pousser sur une branche qui n'est pas encore présente sur le dépôt distant -git config --global push.autoSetupRemote true -======= ```bash # permet de pousser sur une branche qui n'est pas encore présente sur le dépôt distant git config --global push.autoSetupRemote true git config --global user.name " " git config --global user.email "" ->>>>>>> Add-TP2 ``` Ensuite, installez les packages Python qui seront nécessaires pour exécuter le programme: From 6d810cfa2d199590df68bd31fc311f7329873731 Mon Sep 17 00:00:00 2001 From: Kylian Bujat Date: Wed, 13 Mar 2024 11:40:07 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=20=20lissage=20du=20signal?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP2/imu_analysis/main.py | 15 +++++++++++---- TP2/imu_analysis/processing.py | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/TP2/imu_analysis/main.py b/TP2/imu_analysis/main.py index c2e8996..cd9ee05 100644 --- a/TP2/imu_analysis/main.py +++ b/TP2/imu_analysis/main.py @@ -1,6 +1,6 @@ from plotting import plot_angular_speed, plot_linear_acceleration, show_plots from reader import read_measurements_file - +from processing import calculate_moving_average def main(): """Fonction principale du projet. @@ -20,6 +20,7 @@ def main(): az = [] for measurement in read_measurements_file(): + t.append(measurement.t) wx.append(measurement.wx) wy.append(measurement.wy) @@ -27,9 +28,15 @@ def main(): ax.append(measurement.ax) ay.append(measurement.ay) az.append(measurement.az) - - plot_angular_speed(t, wx, wy, wz) - plot_linear_acceleration(t, ax, ay, az) + wx_l=calculate_moving_average(wx,100) + wy_l=calculate_moving_average(wy,100) + wz_l=calculate_moving_average(wz,100) + ax_l=calculate_moving_average(ax,100) + ay_l=calculate_moving_average(ay,100) + az_l=calculate_moving_average(az,100) + + plot_angular_speed(t, wx_l, wy_l, wz_l) + plot_linear_acceleration(t, ax_l, ay_l, az_l) show_plots() diff --git a/TP2/imu_analysis/processing.py b/TP2/imu_analysis/processing.py index fe6271a..8b1ef59 100644 --- a/TP2/imu_analysis/processing.py +++ b/TP2/imu_analysis/processing.py @@ -2,3 +2,18 @@ Module pour le traitement des mesures ************************************* """ +def calculate_moving_average(data: list[float], interval: int): + av=[] + n=len(data) + for i in range(n-interval): + s=sum(data[i:i+interval])/interval + av.append(s) + return av + + + +data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +n = 4 +print(calculate_moving_average(data,n)) + +