|
|
|
@ -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'
|
|
|
|
|