From 5294d7adbcb4727ce607677b94ea4524a1252ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Mon, 25 Nov 2024 16:39:51 +0100 Subject: [PATCH] add derivative --- labsw/__init__.py | 2 +- labsw/io.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/labsw/__init__.py b/labsw/__init__.py index cc3d3a9..f0edc35 100644 --- a/labsw/__init__.py +++ b/labsw/__init__.py @@ -1 +1 @@ -__version__ = '0.1.5.3' +__version__ = '0.1.5.4' diff --git a/labsw/io.py b/labsw/io.py index 647b1af..baedce4 100644 --- a/labsw/io.py +++ b/labsw/io.py @@ -2,6 +2,8 @@ import pandas as pd import numpy as np import yaml +from scipy.signal import savgol_filter + def load_data_RH_logger(filepath, every=1): """ @@ -21,6 +23,10 @@ def load_data_RH_logger(filepath, every=1): # Crop data df = df.reset_index() del df['index'] + + # Derivative + df['dmdt'] = savgol_filter(df['weight'], window_length=10000, polyorder=1, deriv=1) + return df.iloc[::every]