fix: sort out error in min_max

This commit is contained in:
Skudalen 2021-06-24 10:10:28 +02:00
parent 2fdc9c9247
commit 85dbab5561
3 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import pandas as pd import pandas as pd
from pathlib import Path from pathlib import Path
import numpy as np
from pandas.core.frame import DataFrame from pandas.core.frame import DataFrame
@ -42,8 +43,8 @@ def get_emg_str(emg_nr):
return 'emg' + str(emg_nr) return 'emg' + str(emg_nr)
def get_min_max_timestamp(df:DataFrame): def get_min_max_timestamp(df:DataFrame):
min = df['timestamp'].min() min = int(np.floor(df['timestamp'].min()))
max = df['timestamp'].max() max = int(np.ceil(df['timestamp'].max()))
return min, max return min, max

View File

@ -100,7 +100,6 @@ def load_user_emg_data():
def prep_df_for_trans(df:DataFrame): def prep_df_for_trans(df:DataFrame):
sample_rate = SAMPLE_RATE sample_rate = SAMPLE_RATE
min, duration = Handler.get_min_max_timestamp(df) min, duration = Handler.get_min_max_timestamp(df)
print(duration)
x = np.linspace(0, duration, SAMPLE_RATE * duration, endpoint=False) x = np.linspace(0, duration, SAMPLE_RATE * duration, endpoint=False)
y = np.array(df.iloc(1)) y = np.array(df.iloc(1))
return x, y, duration return x, y, duration