feat: make df from x and y arrays
This commit is contained in:
parent
c650eb928c
commit
46558a075d
@ -461,4 +461,10 @@ def get_min_max_timestamp(df:DataFrame):
|
|||||||
max = df['timestamp'].max()
|
max = df['timestamp'].max()
|
||||||
return min, max
|
return min, max
|
||||||
|
|
||||||
|
# Help: returns df_time_emg
|
||||||
|
def make_df_from_xandy(x, y, emg_nr):
|
||||||
|
print(type(x))
|
||||||
|
print(type(y))
|
||||||
|
df = DataFrame([x, y], columns=['timestamp', get_emg_str(emg_nr)])
|
||||||
|
return df
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ def denoice_dataset(handler:Handler.CSV_handler, subject_nr, which_arm, round, e
|
|||||||
cA_filt, cD_filt = soft_threshold_filter(cA, cD)
|
cA_filt, cD_filt = soft_threshold_filter(cA, cD)
|
||||||
y_values = inverse_wavelet(df, cA_filt, cD_filt)
|
y_values = inverse_wavelet(df, cA_filt, cD_filt)
|
||||||
|
|
||||||
df_new = pandas.DataFrame([N_trans, y_values])
|
df_new = Handler.make_df_from_xandy(N, y_values, emg_nr)
|
||||||
return N, y_values, df_new
|
return N, y_values, df_new
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from numpy import load
|
||||||
from Handle_emg_data import *
|
from Handle_emg_data import *
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from Signal_prep import *
|
from Signal_prep import *
|
||||||
@ -58,4 +59,18 @@ def test_soft_load_func():
|
|||||||
print(subject2_container.subject_name)
|
print(subject2_container.subject_name)
|
||||||
print(subject2_container.data_dict_round2.get('right')[3]) # Round2, right, emg_4
|
print(subject2_container.data_dict_round2.get('right')[3]) # Round2, right, emg_4
|
||||||
|
|
||||||
test_soft_load_func()
|
def test_total_denoising():
|
||||||
|
handler = Handler.CSV_handler('hard')
|
||||||
|
handler.load_hard_original_emg_data()
|
||||||
|
|
||||||
|
# Original df:
|
||||||
|
df = handler.get_df_from_data_dict(3, 'left', 3, 3)
|
||||||
|
print(df.head)
|
||||||
|
plot_df(df)
|
||||||
|
|
||||||
|
# Denoised df:
|
||||||
|
df_denoised = denoice_dataset(handler, 3, 'left', 3, 3)
|
||||||
|
print(df.head)
|
||||||
|
plot_df(df_denoised)
|
||||||
|
|
||||||
|
test_total_denoising()
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user