upd
This commit is contained in:
parent
07c5534d40
commit
c69dd81d2d
2 changed files with 18 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
__version__ = '0.1.7.3'
|
__version__ = '0.1.7.4'
|
||||||
|
|
19
labsw/io.py
19
labsw/io.py
|
@ -42,12 +42,25 @@ def load_data_RH_logger(filepath, every=1):
|
||||||
return df.iloc[::every]
|
return df.iloc[::every]
|
||||||
|
|
||||||
|
|
||||||
def process_data_RH_logger(filepath, every, diff_period=1_000, SG_window_short=100, SG_window_long=10_000):
|
def process_data_RH_logger(filepath, every,
|
||||||
df = load_data_RH_logger(filepath, every=1)
|
median_window=1,
|
||||||
|
diff_period=1_000,
|
||||||
|
SG_window_short=100,
|
||||||
|
SG_window_long=10_000):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We load all the datapoints
|
||||||
|
df = load_data_RH_logger(filepath, every=1)
|
||||||
df = df.drop(columns=['time'])
|
df = df.drop(columns=['time'])
|
||||||
df = df.rename(columns={'duration': 'time'})
|
df = df.rename(columns={'duration': 'time'})
|
||||||
|
|
||||||
|
|
||||||
|
# Median filter
|
||||||
|
df['weight'] = df['weight'].rolling(window=median_window, center=True).median()
|
||||||
|
df = df.dropna(subset=['weight'])
|
||||||
|
|
||||||
|
|
||||||
m0 = df['weight'].iloc[0]
|
m0 = df['weight'].iloc[0]
|
||||||
mf = df['weight'].tail(300).mean()
|
mf = df['weight'].tail(300).mean()
|
||||||
# Variation
|
# Variation
|
||||||
|
@ -66,6 +79,8 @@ def process_data_RH_logger(filepath, every, diff_period=1_000, SG_window_short=1
|
||||||
|
|
||||||
h5path = os.path.splitext(filepath)[0]
|
h5path = os.path.splitext(filepath)[0]
|
||||||
h5path += '-processed.h5'
|
h5path += '-processed.h5'
|
||||||
|
|
||||||
|
# Apply the subset
|
||||||
df = df.iloc[::every]
|
df = df.iloc[::every]
|
||||||
df.to_hdf(h5path, key='data')
|
df.to_hdf(h5path, key='data')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue