change def derivative

master
François Boulogne 1 month ago
parent 2c908e05b5
commit 339c90db25

@ -1 +1 @@
__version__ = '0.1.6.0' __version__ = '0.1.6.1'

@ -20,8 +20,6 @@ def load_data_RH_logger(filepath, every=1):
df = df.drop(columns='X') df = df.drop(columns='X')
df = df.drop(np.arange(1)) df = df.drop(np.arange(1))
df['dm_m'] = (df['weight'] - df['weight'].iloc[0]) / df['weight'].iloc[0]
# Crop data # Crop data
df = df.reset_index() df = df.reset_index()
del df['index'] del df['index']
@ -32,10 +30,19 @@ def load_data_RH_logger(filepath, every=1):
def process_data_RH_logger(filepath, every): def process_data_RH_logger(filepath, every):
df = load_data_RH_logger(filepath, every=1) 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
mf = df['dm_m'].tail(300).mean()
df['m_mf'] = df['dm_m'] / mf
# Derivative # Derivative
delta = np.mean(df['time'].diff()) delta = np.mean(df['time'].diff())
df['dmdt_SG'] = savgol_filter(df['weight'], window_length=10000, polyorder=1, deriv=1, delta=delta) df['dMdt_SG'] = savgol_filter(df['dm_m'], window_length=10000, polyorder=1, deriv=1, delta=delta)
df['dmdt_diff'] = df['weight'].diff(periods=1000) / df['time'].diff(periods=1000) df['dMdt_diff'] = df['dm_m'].diff(periods=1000) / df['time'].diff(periods=1000)
h5path = os.path.splitext(filepath)[0] h5path = os.path.splitext(filepath)[0]
h5path += '-processed.h5' h5path += '-processed.h5'

Loading…
Cancel
Save