2021-06-24 13:58:03 +00:00
|
|
|
from Handle_emg_data import *
|
2021-06-23 09:01:02 +00:00
|
|
|
import matplotlib.pyplot as plt
|
2021-06-25 08:43:59 +00:00
|
|
|
#from Signal_prep import *
|
2021-06-22 19:30:55 +00:00
|
|
|
|
2021-06-23 09:01:02 +00:00
|
|
|
def test_df_extraction(emg_nr):
|
2021-06-22 19:30:55 +00:00
|
|
|
handler = CSV_handler()
|
|
|
|
|
2021-06-23 09:01:02 +00:00
|
|
|
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
subject1_left_emg1 = handler.get_time_emg_table(file, emg_nr)
|
|
|
|
print(subject1_left_emg1.head)
|
2021-06-22 19:30:55 +00:00
|
|
|
|
2021-06-23 09:01:02 +00:00
|
|
|
return subject1_left_emg1, emg_nr
|
2021-06-22 19:30:55 +00:00
|
|
|
|
2021-06-23 13:56:35 +00:00
|
|
|
def test_load_func():
|
2021-06-25 07:37:49 +00:00
|
|
|
handler = CSV_handler()
|
|
|
|
test_dict = handler.load_hard_PP_emg_data()
|
2021-06-25 08:43:59 +00:00
|
|
|
subject2_container = test_dict.get(2)
|
2021-06-25 08:52:33 +00:00
|
|
|
#print(subject2_container)
|
2021-06-25 08:43:59 +00:00
|
|
|
print(subject2_container.data_dict_round1.get('left')[1])
|
2021-06-23 13:56:35 +00:00
|
|
|
|
2021-06-24 08:06:01 +00:00
|
|
|
def test_min_max_func():
|
|
|
|
handler = CSV_handler()
|
|
|
|
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
df = handler.get_time_emg_table(file, 1)
|
|
|
|
min, max = get_min_max_timestamp(df)
|
|
|
|
print(min)
|
|
|
|
print(max)
|
|
|
|
|
2021-06-24 08:29:11 +00:00
|
|
|
def test_fft_prep():
|
|
|
|
handler = CSV_handler()
|
|
|
|
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
df = handler.get_time_emg_table(file, 1)
|
|
|
|
|
2021-06-24 13:48:54 +00:00
|
|
|
def test_plot_wavelet_both_ways():
|
|
|
|
handler = CSV_handler()
|
|
|
|
file = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
df = handler.get_time_emg_table(file, 1)
|
2021-06-24 13:58:03 +00:00
|
|
|
N = get_xory_from_df('x', df)
|
|
|
|
plot_df(df)
|
2021-06-24 13:48:54 +00:00
|
|
|
#print(len(N))
|
|
|
|
#print(len(get_xory_from_df('y', df)))
|
2021-06-24 13:58:03 +00:00
|
|
|
x, cA, cD = wavelet_db4_denoising(df)
|
|
|
|
plot_arrays(x, cA)
|
2021-06-24 13:48:54 +00:00
|
|
|
#print(len(cA))
|
|
|
|
cA_filt, cD_filt = soft_threshold_filter(cA, cD)
|
2021-06-24 13:58:03 +00:00
|
|
|
plot_arrays(x, cA_filt)
|
2021-06-24 13:48:54 +00:00
|
|
|
#print(len(cA_filt))
|
2021-06-25 07:05:10 +00:00
|
|
|
y_new_values = inverse_wavelet(df, cA_filt, cD_filt)
|
2021-06-24 13:48:54 +00:00
|
|
|
#print(len(y_new_values))
|
2021-06-24 13:58:03 +00:00
|
|
|
plot_arrays(N, y_new_values)
|
|
|
|
|
2021-06-25 08:43:59 +00:00
|
|
|
test_load_func()
|