diff --git a/Handle_emg_data.py b/Handle_emg_data.py index 8209178..caca294 100644 --- a/Handle_emg_data.py +++ b/Handle_emg_data.py @@ -14,15 +14,16 @@ class CSV_handler: # Extracts out the timestamp and the selected emg signal into a new dataframe def get_time_emg_table(self, filename, emg_nr): - tot_data_frame = self.make_df(filename) - emg_str = self.get_emg_str(emg_nr) + emg_str = 'emg' + str(emg_nr) filtered_df = tot_data_frame[["timestamp", emg_str]] return filtered_df def get_emg_str(emg_nr): return 'emg' + str(emg_nr) + + diff --git a/Test_functions.py b/Test_functions.py index e31dc68..334364b 100644 --- a/Test_functions.py +++ b/Test_functions.py @@ -1,11 +1,21 @@ from Handle_emg_data import CSV_handler +import matplotlib.pyplot as plt -def test_df_extraction(): +def test_df_extraction(emg_nr): handler = CSV_handler() - filename = "Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv" - subject1_left_emg1 = handler.get_time_emg_table(filename, 1) + 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) - print(subject1_left_emg1.head()) + return subject1_left_emg1, emg_nr -test_df_extraction() + + +# running +handler = CSV_handler +df, emg_nr = test_df_extraction(1) +print(emg_nr) +emg_str = handler.get_emg_str(emg_nr) +lines = df.plot.line(x='timestamp', y=emg_str) +plt.show() \ No newline at end of file diff --git a/__pycache__/Handle_emg_data.cpython-38.pyc b/__pycache__/Handle_emg_data.cpython-38.pyc index 180017f..8361845 100644 Binary files a/__pycache__/Handle_emg_data.cpython-38.pyc and b/__pycache__/Handle_emg_data.cpython-38.pyc differ