From e69f87b93e7ec8a3c4d75e69b3abf8f7731bf5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Fri, 6 Dec 2024 13:31:07 +0100 Subject: [PATCH] update dimless --- labsw/__init__.py | 2 +- labsw/io.py | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/labsw/__init__.py b/labsw/__init__.py index a67bd07..f3cc595 100644 --- a/labsw/__init__.py +++ b/labsw/__init__.py @@ -1 +1 @@ -__version__ = '0.1.6.7' +__version__ = '0.1.6.8' diff --git a/labsw/io.py b/labsw/io.py index e24e5b8..4d4e6a8 100644 --- a/labsw/io.py +++ b/labsw/io.py @@ -45,21 +45,19 @@ def load_data_RH_logger(filepath, every=1): def process_data_RH_logger(filepath, every, diff_period=1_000, SG_window=10_000): df = load_data_RH_logger(filepath, every=1) - # Variation - df['dm'] = df['weight'] - df['weight'].iloc[0] - df['dm_m'] = (df['weight'] - df['weight'].iloc[0]) / df['weight'].iloc[0] - - # weight normalized between 0 and 1 begin to end + m0 = df['weight'].iloc[0] mf = df['dm_m'].tail(300).mean() - df['m_mf'] = df['dm_m'] / mf + # Variation + df['m'] = df['weight'] - m0 + df['M'] = (df['weight'] - m0) / (mf - m0) # Derivative delta = np.mean(df['time'].diff()) - df['dMdt_SG'] = savgol_filter(df['m_mf'], window_length=SG_window, polyorder=1, deriv=1, delta=delta) - df['dMdt_diff'] = df['m_mf'].diff(periods=diff_period) / df['time'].diff(periods=diff_period) + df['dMdt_SG'] = savgol_filter(df['M'], window_length=SG_window, polyorder=1, deriv=1, delta=delta) + df['dMdt_diff'] = df['M'].diff(periods=diff_period) / df['time'].diff(periods=diff_period) - df['dweightdt_SG'] = savgol_filter(df['weight'], window_length=SG_window, polyorder=1, deriv=1, delta=delta) - df['dweightdt_diff'] = df['weight'].diff(periods=diff_period) / df['time'].diff(periods=diff_period) + df['dmdt_SG'] = savgol_filter(df['m'], window_length=SG_window, polyorder=1, deriv=1, delta=delta) + df['dmdt_diff'] = df['m'].diff(periods=diff_period) / df['time'].diff(periods=diff_period) h5path = os.path.splitext(filepath)[0] h5path += '-processed.h5'