2021-06-22 13:32:51 +00:00
|
|
|
import pandas as pd
|
2021-06-22 18:31:16 +00:00
|
|
|
from pathlib import Path
|
2021-06-24 08:10:28 +00:00
|
|
|
import numpy as np
|
2021-06-22 18:31:16 +00:00
|
|
|
|
2021-06-23 09:33:23 +00:00
|
|
|
from pandas.core.frame import DataFrame
|
|
|
|
|
2021-06-23 09:17:59 +00:00
|
|
|
class Data_container:
|
|
|
|
|
2021-06-23 09:33:23 +00:00
|
|
|
def __init__(self, subject_nr:int, subject_name:str):
|
|
|
|
self.subject_nr = subject_nr
|
|
|
|
self.subject_name = subject_name
|
2021-06-25 08:07:35 +00:00
|
|
|
self.data_dict_round1 = {'left': [None]*8, 'right': [None]*8}
|
|
|
|
self.data_dict_round2 = {'left': [None]*8, 'right': [None]*8}
|
|
|
|
self.data_dict_round3 = {'left': [None]*8, 'right': [None]*8}
|
|
|
|
self.data_dict_round4 = {'left': [None]*8, 'right': [None]*8}
|
2021-06-23 09:17:59 +00:00
|
|
|
|
2021-06-22 18:31:16 +00:00
|
|
|
class CSV_handler:
|
|
|
|
|
2021-06-22 18:54:42 +00:00
|
|
|
def __init__(self):
|
2021-06-23 09:33:23 +00:00
|
|
|
self.working_dir = str(Path.cwd())
|
|
|
|
self.data_container_dict = {} # Dict with keys equal subject numbers and values equal the relvant datacontainer
|
2021-06-22 18:31:16 +00:00
|
|
|
|
2021-06-22 19:00:51 +00:00
|
|
|
# Makes dataframe from the csv files in the working directory
|
2021-06-22 19:30:55 +00:00
|
|
|
def make_df(self, filename):
|
2021-06-22 18:31:16 +00:00
|
|
|
filepath = self.working_dir + str(filename)
|
|
|
|
df = pd.read_csv(filepath)
|
|
|
|
return df
|
2021-06-22 19:00:51 +00:00
|
|
|
|
2021-06-23 09:33:23 +00:00
|
|
|
# Extracts out the timestamp and the selected emg signal into a new dataframe and stores the data on the subject
|
2021-06-23 11:52:18 +00:00
|
|
|
def get_time_emg_table(self, filename:str, emg_nr:int):
|
2021-06-23 08:32:38 +00:00
|
|
|
tot_data_frame = self.make_df(filename)
|
2021-06-23 09:01:02 +00:00
|
|
|
emg_str = 'emg' + str(emg_nr)
|
2021-06-22 19:00:51 +00:00
|
|
|
filtered_df = tot_data_frame[["timestamp", emg_str]]
|
2021-06-23 11:52:18 +00:00
|
|
|
return filtered_df
|
|
|
|
|
2021-06-25 09:12:32 +00:00
|
|
|
# Takes in a df and stores the information in a Data_container object
|
2021-06-25 08:43:59 +00:00
|
|
|
def store_df_in_container(self, filename:str, emg_nr:int, which_arm:str, data_container:Data_container, round:int):
|
|
|
|
df = self.get_time_emg_table(filename, emg_nr+1)
|
|
|
|
|
2021-06-23 09:41:06 +00:00
|
|
|
# Places the data correctly:
|
2021-06-25 08:43:59 +00:00
|
|
|
if round == 1:
|
2021-06-25 08:07:35 +00:00
|
|
|
if which_arm == 'left':
|
2021-06-25 08:43:59 +00:00
|
|
|
data_container.data_dict_round1['left'][emg_nr] = df # Zero indexed emg_nr in the dict
|
2021-06-25 08:07:35 +00:00
|
|
|
else:
|
2021-06-25 08:43:59 +00:00
|
|
|
data_container.data_dict_round1['right'][emg_nr] = df
|
2021-06-25 08:07:35 +00:00
|
|
|
elif round == 2:
|
|
|
|
if which_arm == 'left':
|
2021-06-25 08:43:59 +00:00
|
|
|
data_container.data_dict_round2['left'][emg_nr] = df
|
2021-06-25 08:07:35 +00:00
|
|
|
else:
|
2021-06-25 08:43:59 +00:00
|
|
|
data_container.data_dict_round2['right'][emg_nr] = df
|
2021-06-25 08:07:35 +00:00
|
|
|
elif round == 3:
|
|
|
|
if which_arm == 'left':
|
2021-06-25 08:43:59 +00:00
|
|
|
data_container.data_dict_round3['left'][emg_nr] = df
|
2021-06-25 08:07:35 +00:00
|
|
|
else:
|
2021-06-25 08:43:59 +00:00
|
|
|
data_container.data_dict_round3['right'][emg_nr] = df
|
|
|
|
elif round == 4:
|
|
|
|
if which_arm == 'left':
|
|
|
|
data_container.data_dict_round4['left'][emg_nr] = df
|
|
|
|
else:
|
|
|
|
data_container.data_dict_round4['right'][emg_nr] = df
|
2021-06-25 08:07:35 +00:00
|
|
|
else:
|
|
|
|
raise IndexError('Not a valid index')
|
2021-06-22 19:00:51 +00:00
|
|
|
|
2021-06-25 09:12:32 +00:00
|
|
|
# Links the data container for a subject to the handler object
|
2021-06-25 08:43:59 +00:00
|
|
|
def link_container_to_handler(self, data_container:Data_container):
|
|
|
|
# Links the retrieved data with the subjects data_container
|
|
|
|
subject_nr = data_container.subject_nr
|
|
|
|
self.data_container_dict[subject_nr] = data_container
|
|
|
|
|
2021-06-25 07:29:23 +00:00
|
|
|
# Loads the data from the csv files into a storing system in an CSV_handler object
|
2021-06-25 09:12:32 +00:00
|
|
|
# (hard, hardPP, soft and softPP)
|
2021-06-25 07:29:23 +00:00
|
|
|
def load_hard_PP_emg_data(self):
|
|
|
|
|
|
|
|
# CSV data from subject 1
|
|
|
|
file1_subject1_left = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
file2_subject1_left = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1830/myoLeftEmg.csv"
|
|
|
|
file3_subject1_left = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1845/myoLeftEmg.csv"
|
|
|
|
file4_subject1_left = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1855/myoLeftEmg.csv"
|
|
|
|
subject1_left_files = [file1_subject1_left, file2_subject1_left, file3_subject1_left, file4_subject1_left]
|
|
|
|
file1_subject1_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1810/myoRightEmg.csv"
|
|
|
|
file2_subject1_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1830/myoRightEmg.csv"
|
|
|
|
file3_subject1_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1845/myoRightEmg.csv"
|
|
|
|
file4_subject1_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMarek_20201207_1855/myoRightEmg.csv"
|
|
|
|
subject1_right_files = [file1_subject1_rigth, file2_subject1_rigth, file3_subject1_rigth, file4_subject1_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 2
|
|
|
|
file1_subject2_left = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2010/myoLeftEmg.csv"
|
|
|
|
file2_subject2_left = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2025/myoLeftEmg.csv"
|
|
|
|
file3_subject2_left = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2035/myoLeftEmg.csv"
|
|
|
|
file4_subject2_left = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2045/myoLeftEmg.csv"
|
|
|
|
subject2_left_files = [file1_subject2_left, file2_subject2_left, file3_subject2_left, file4_subject2_left]
|
|
|
|
file1_subject2_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2010/myoRightEmg.csv"
|
|
|
|
file2_subject2_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2025/myoRightEmg.csv"
|
|
|
|
file3_subject2_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2035/myoRightEmg.csv"
|
|
|
|
file4_subject2_rigth = "/Exp20201205_2myo_hardTypePP/HaluskaMaros_20201205_2045/myoRightEmg.csv"
|
|
|
|
subject2_right_files = [file1_subject2_rigth, file2_subject2_rigth, file3_subject2_rigth, file4_subject2_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 3
|
|
|
|
file1_subject3_left = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1700/myoLeftEmg.csv"
|
|
|
|
file2_subject3_left = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1715/myoLeftEmg.csv"
|
|
|
|
file3_subject3_left = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1725/myoLeftEmg.csv"
|
|
|
|
file4_subject3_left = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1735/myoLeftEmg.csv"
|
|
|
|
subject3_left_files = [file1_subject3_left, file2_subject3_left, file3_subject3_left, file4_subject3_left]
|
|
|
|
file1_subject3_rigth = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1700/myoRightEmg.csv"
|
|
|
|
file2_subject3_rigth = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1715/myoRightEmg.csv"
|
|
|
|
file3_subject3_rigth = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1725/myoRightEmg.csv"
|
|
|
|
file4_subject3_rigth = "/Exp20201205_2myo_hardTypePP/HaluskovaBeata_20201205_1735/myoRightEmg.csv"
|
|
|
|
subject3_right_files = [file1_subject3_rigth, file2_subject3_rigth, file3_subject3_rigth, file4_subject3_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 4
|
|
|
|
file1_subject4_left = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1900/myoLeftEmg.csv"
|
|
|
|
file2_subject4_left = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1915/myoLeftEmg.csv"
|
|
|
|
file3_subject4_left = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1925/myoLeftEmg.csv"
|
|
|
|
file4_subject4_left = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1935/myoLeftEmg.csv"
|
|
|
|
subject4_left_files = [file1_subject4_left, file2_subject4_left, file3_subject4_left, file4_subject4_left]
|
|
|
|
file1_subject4_rigth = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1900/myoRightEmg.csv"
|
|
|
|
file2_subject4_rigth = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1915/myoRightEmg.csv"
|
|
|
|
file3_subject4_rigth = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1925/myoRightEmg.csv"
|
|
|
|
file4_subject4_rigth = "/Exp20201205_2myo_hardTypePP/KelisekDavid_20201209_1935/myoRightEmg.csv"
|
|
|
|
subject4_right_files = [file1_subject4_rigth, file2_subject4_rigth, file3_subject4_rigth, file4_subject4_rigth]
|
|
|
|
|
|
|
|
|
|
|
|
# CSV data from subject 5
|
|
|
|
file1_subject5_left = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2030/myoLeftEmg.csv"
|
|
|
|
file2_subject5_left = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2040/myoLeftEmg.csv"
|
|
|
|
file3_subject5_left = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2050/myoLeftEmg.csv"
|
|
|
|
file4_subject5_left = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2100/myoLeftEmg.csv"
|
|
|
|
subject5_left_files = [file1_subject5_left, file2_subject5_left, file3_subject5_left, file4_subject5_left]
|
|
|
|
file1_subject5_rigth = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2030/myoRightEmg.csv"
|
|
|
|
file2_subject5_rigth = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2040/myoRightEmg.csv"
|
|
|
|
file3_subject5_rigth = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2050/myoRightEmg.csv"
|
|
|
|
file4_subject5_rigth = "/Exp20201205_2myo_hardTypePP/KelisekRichard_20201209_2100/myoRightEmg.csv"
|
|
|
|
subject5_right_files = [file1_subject5_rigth, file2_subject5_rigth, file3_subject5_rigth, file4_subject5_rigth]
|
|
|
|
|
|
|
|
left_list = [subject1_left_files, subject2_left_files, subject3_left_files, subject4_left_files, subject5_left_files]
|
|
|
|
right_list = [subject1_right_files, subject2_right_files, subject3_right_files, subject4_right_files, subject5_right_files]
|
|
|
|
|
|
|
|
|
2021-06-25 09:09:36 +00:00
|
|
|
subject1_data_container = Data_container(1, 'HaluskaMarek')
|
|
|
|
subject2_data_container = Data_container(2, 'HaluskaMaros')
|
|
|
|
subject3_data_container = Data_container(3, 'HaluskovaBeata')
|
|
|
|
subject4_data_container = Data_container(4, 'KelisekDavid')
|
|
|
|
subject5_data_container = Data_container(5, 'KelisekRichard')
|
|
|
|
subject_data_container_list = [subject1_data_container, subject2_data_container, subject3_data_container,
|
|
|
|
subject4_data_container, subject5_data_container]
|
|
|
|
|
|
|
|
for subject_nr in range(5):
|
|
|
|
data_container = subject_data_container_list[subject_nr]
|
|
|
|
# left variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
|
|
|
filename = left_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'left', data_container, round+1)
|
|
|
|
# right variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
|
|
|
filename = right_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'right', data_container, round+1)
|
|
|
|
# Links the stored data in the data_container to the Handler
|
|
|
|
self.link_container_to_handler(data_container)
|
|
|
|
return self.data_container_dict
|
|
|
|
|
|
|
|
def load_soft_PP_emg_data(self):
|
|
|
|
|
|
|
|
# CSV data from subject 1
|
|
|
|
file1_subject1_left = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
file2_subject1_left = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1830/myoLeftEmg.csv"
|
|
|
|
file3_subject1_left = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1845/myoLeftEmg.csv"
|
|
|
|
file4_subject1_left = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1855/myoLeftEmg.csv"
|
|
|
|
subject1_left_files = [file1_subject1_left, file2_subject1_left, file3_subject1_left, file4_subject1_left]
|
|
|
|
file1_subject1_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1810/myoRightEmg.csv"
|
|
|
|
file2_subject1_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1830/myoRightEmg.csv"
|
|
|
|
file3_subject1_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1845/myoRightEmg.csv"
|
|
|
|
file4_subject1_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMarek_20201207_1855/myoRightEmg.csv"
|
|
|
|
subject1_right_files = [file1_subject1_rigth, file2_subject1_rigth, file3_subject1_rigth, file4_subject1_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 2
|
|
|
|
file1_subject2_left = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2010/myoLeftEmg.csv"
|
|
|
|
file2_subject2_left = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2025/myoLeftEmg.csv"
|
|
|
|
file3_subject2_left = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2035/myoLeftEmg.csv"
|
|
|
|
file4_subject2_left = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2045/myoLeftEmg.csv"
|
|
|
|
subject2_left_files = [file1_subject2_left, file2_subject2_left, file3_subject2_left, file4_subject2_left]
|
|
|
|
file1_subject2_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2010/myoRightEmg.csv"
|
|
|
|
file2_subject2_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2025/myoRightEmg.csv"
|
|
|
|
file3_subject2_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2035/myoRightEmg.csv"
|
|
|
|
file4_subject2_rigth = "/Exp20201205_2myo_softTypePP/HaluskaMaros_20201205_2045/myoRightEmg.csv"
|
|
|
|
subject2_right_files = [file1_subject2_rigth, file2_subject2_rigth, file3_subject2_rigth, file4_subject2_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 3
|
|
|
|
file1_subject3_left = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1700/myoLeftEmg.csv"
|
|
|
|
file2_subject3_left = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1715/myoLeftEmg.csv"
|
|
|
|
file3_subject3_left = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1725/myoLeftEmg.csv"
|
|
|
|
file4_subject3_left = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1735/myoLeftEmg.csv"
|
|
|
|
subject3_left_files = [file1_subject3_left, file2_subject3_left, file3_subject3_left, file4_subject3_left]
|
|
|
|
file1_subject3_rigth = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1700/myoRightEmg.csv"
|
|
|
|
file2_subject3_rigth = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1715/myoRightEmg.csv"
|
|
|
|
file3_subject3_rigth = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1725/myoRightEmg.csv"
|
|
|
|
file4_subject3_rigth = "/Exp20201205_2myo_softTypePP/HaluskovaBeata_20201205_1735/myoRightEmg.csv"
|
|
|
|
subject3_right_files = [file1_subject3_rigth, file2_subject3_rigth, file3_subject3_rigth, file4_subject3_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 4
|
|
|
|
file1_subject4_left = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1900/myoLeftEmg.csv"
|
|
|
|
file2_subject4_left = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1915/myoLeftEmg.csv"
|
|
|
|
file3_subject4_left = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1925/myoLeftEmg.csv"
|
|
|
|
file4_subject4_left = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1935/myoLeftEmg.csv"
|
|
|
|
subject4_left_files = [file1_subject4_left, file2_subject4_left, file3_subject4_left, file4_subject4_left]
|
|
|
|
file1_subject4_rigth = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1900/myoRightEmg.csv"
|
|
|
|
file2_subject4_rigth = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1915/myoRightEmg.csv"
|
|
|
|
file3_subject4_rigth = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1925/myoRightEmg.csv"
|
|
|
|
file4_subject4_rigth = "/Exp20201205_2myo_softTypePP/KelisekDavid_20201209_1935/myoRightEmg.csv"
|
|
|
|
subject4_right_files = [file1_subject4_rigth, file2_subject4_rigth, file3_subject4_rigth, file4_subject4_rigth]
|
|
|
|
|
|
|
|
|
|
|
|
# CSV data from subject 5
|
|
|
|
file1_subject5_left = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2030/myoLeftEmg.csv"
|
|
|
|
file2_subject5_left = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2040/myoLeftEmg.csv"
|
|
|
|
file3_subject5_left = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2050/myoLeftEmg.csv"
|
|
|
|
file4_subject5_left = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2100/myoLeftEmg.csv"
|
|
|
|
subject5_left_files = [file1_subject5_left, file2_subject5_left, file3_subject5_left, file4_subject5_left]
|
|
|
|
file1_subject5_rigth = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2030/myoRightEmg.csv"
|
|
|
|
file2_subject5_rigth = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2040/myoRightEmg.csv"
|
|
|
|
file3_subject5_rigth = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2050/myoRightEmg.csv"
|
|
|
|
file4_subject5_rigth = "/Exp20201205_2myo_softTypePP/KelisekRichard_20201209_2100/myoRightEmg.csv"
|
|
|
|
subject5_right_files = [file1_subject5_rigth, file2_subject5_rigth, file3_subject5_rigth, file4_subject5_rigth]
|
|
|
|
|
|
|
|
left_list = [subject1_left_files, subject2_left_files, subject3_left_files, subject4_left_files, subject5_left_files]
|
|
|
|
right_list = [subject1_right_files, subject2_right_files, subject3_right_files, subject4_right_files, subject5_right_files]
|
|
|
|
|
|
|
|
|
2021-06-25 07:29:23 +00:00
|
|
|
subject1_data_container = Data_container(1, 'HaluskaMarek')
|
2021-06-25 08:52:33 +00:00
|
|
|
subject2_data_container = Data_container(2, 'HaluskaMaros')
|
|
|
|
subject3_data_container = Data_container(3, 'HaluskovaBeata')
|
|
|
|
subject4_data_container = Data_container(4, 'KelisekDavid')
|
|
|
|
subject5_data_container = Data_container(5, 'KelisekRichard')
|
2021-06-25 07:29:23 +00:00
|
|
|
subject_data_container_list = [subject1_data_container, subject2_data_container, subject3_data_container,
|
|
|
|
subject4_data_container, subject5_data_container]
|
|
|
|
|
|
|
|
for subject_nr in range(5):
|
2021-06-25 08:52:33 +00:00
|
|
|
data_container = subject_data_container_list[subject_nr]
|
2021-06-25 07:29:23 +00:00
|
|
|
# left variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
2021-06-25 08:52:33 +00:00
|
|
|
filename = left_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'left', data_container, round+1)
|
2021-06-25 07:29:23 +00:00
|
|
|
# right variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
2021-06-25 08:52:33 +00:00
|
|
|
filename = right_list[subject_nr][round]
|
2021-06-25 09:01:01 +00:00
|
|
|
self.store_df_in_container(filename, emg_nr, 'right', data_container, round+1)
|
2021-06-25 08:52:33 +00:00
|
|
|
# Links the stored data in the data_container to the Handler
|
|
|
|
self.link_container_to_handler(data_container)
|
2021-06-25 07:29:23 +00:00
|
|
|
return self.data_container_dict
|
|
|
|
|
|
|
|
def load_hard_original_emg_data(self):
|
|
|
|
|
|
|
|
# CSV data from subject 1
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject1_left = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
file2_subject1_left = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1830/myoLeftEmg.csv"
|
|
|
|
file3_subject1_left = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1845/myoLeftEmg.csv"
|
|
|
|
file4_subject1_left = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1855/myoLeftEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject1_left_files = [file1_subject1_left, file2_subject1_left, file3_subject1_left, file4_subject1_left]
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject1_rigth = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1810/myoRightEmg.csv"
|
|
|
|
file2_subject1_rigth = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1830/myoRightEmg.csv"
|
|
|
|
file3_subject1_rigth = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1845/myoRightEmg.csv"
|
|
|
|
file4_subject1_rigth = "/Exp20201205_2myo_hardType/HaluskaMarek_20201207_1855/myoRightEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject1_right_files = [file1_subject1_rigth, file2_subject1_rigth, file3_subject1_rigth, file4_subject1_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 2
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject2_left = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2010/myoLeftEmg.csv"
|
|
|
|
file2_subject2_left = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2025/myoLeftEmg.csv"
|
|
|
|
file3_subject2_left = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2035/myoLeftEmg.csv"
|
|
|
|
file4_subject2_left = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2045/myoLeftEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject2_left_files = [file1_subject2_left, file2_subject2_left, file3_subject2_left, file4_subject2_left]
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject2_rigth = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2010/myoRightEmg.csv"
|
|
|
|
file2_subject2_rigth = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2025/myoRightEmg.csv"
|
|
|
|
file3_subject2_rigth = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2035/myoRightEmg.csv"
|
|
|
|
file4_subject2_rigth = "/Exp20201205_2myo_hardType/HaluskaMaros_20201205_2045/myoRightEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject2_right_files = [file1_subject2_rigth, file2_subject2_rigth, file3_subject2_rigth, file4_subject2_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 3
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject3_left = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1700/myoLeftEmg.csv"
|
|
|
|
file2_subject3_left = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1715/myoLeftEmg.csv"
|
|
|
|
file3_subject3_left = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1725/myoLeftEmg.csv"
|
|
|
|
file4_subject3_left = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1735/myoLeftEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject3_left_files = [file1_subject3_left, file2_subject3_left, file3_subject3_left, file4_subject3_left]
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject3_rigth = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1700/myoRightEmg.csv"
|
|
|
|
file2_subject3_rigth = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1715/myoRightEmg.csv"
|
|
|
|
file3_subject3_rigth = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1725/myoRightEmg.csv"
|
|
|
|
file4_subject3_rigth = "/Exp20201205_2myo_hardType/HaluskovaBeata_20201205_1735/myoRightEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject3_right_files = [file1_subject3_rigth, file2_subject3_rigth, file3_subject3_rigth, file4_subject3_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 4
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject4_left = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1900/myoLeftEmg.csv"
|
|
|
|
file2_subject4_left = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1915/myoLeftEmg.csv"
|
|
|
|
file3_subject4_left = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1925/myoLeftEmg.csv"
|
|
|
|
file4_subject4_left = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1935/myoLeftEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject4_left_files = [file1_subject4_left, file2_subject4_left, file3_subject4_left, file4_subject4_left]
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject4_rigth = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1900/myoRightEmg.csv"
|
|
|
|
file2_subject4_rigth = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1915/myoRightEmg.csv"
|
|
|
|
file3_subject4_rigth = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1925/myoRightEmg.csv"
|
|
|
|
file4_subject4_rigth = "/Exp20201205_2myo_hardType/KelisekDavid_20201209_1935/myoRightEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject4_right_files = [file1_subject4_rigth, file2_subject4_rigth, file3_subject4_rigth, file4_subject4_rigth]
|
|
|
|
|
|
|
|
|
|
|
|
# CSV data from subject 5
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject5_left = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2030/myoLeftEmg.csv"
|
|
|
|
file2_subject5_left = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2040/myoLeftEmg.csv"
|
|
|
|
file3_subject5_left = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2050/myoLeftEmg.csv"
|
|
|
|
file4_subject5_left = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2100/myoLeftEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject5_left_files = [file1_subject5_left, file2_subject5_left, file3_subject5_left, file4_subject5_left]
|
2021-06-25 07:37:49 +00:00
|
|
|
file1_subject5_rigth = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2030/myoRightEmg.csv"
|
|
|
|
file2_subject5_rigth = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2040/myoRightEmg.csv"
|
|
|
|
file3_subject5_rigth = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2050/myoRightEmg.csv"
|
|
|
|
file4_subject5_rigth = "/Exp20201205_2myo_hardType/KelisekRichard_20201209_2100/myoRightEmg.csv"
|
2021-06-25 07:29:23 +00:00
|
|
|
subject5_right_files = [file1_subject5_rigth, file2_subject5_rigth, file3_subject5_rigth, file4_subject5_rigth]
|
|
|
|
|
|
|
|
left_list = [subject1_left_files, subject2_left_files, subject3_left_files, subject4_left_files, subject5_left_files]
|
|
|
|
right_list = [subject1_right_files, subject2_right_files, subject3_right_files, subject4_right_files, subject5_right_files]
|
|
|
|
|
|
|
|
|
|
|
|
subject1_data_container = Data_container(1, 'HaluskaMarek')
|
2021-06-25 09:09:36 +00:00
|
|
|
subject2_data_container = Data_container(2, 'HaluskaMaros')
|
|
|
|
subject3_data_container = Data_container(3, 'HaluskovaBeata')
|
|
|
|
subject4_data_container = Data_container(4, 'KelisekDavid')
|
|
|
|
subject5_data_container = Data_container(5, 'KelisekRichard')
|
2021-06-25 07:29:23 +00:00
|
|
|
subject_data_container_list = [subject1_data_container, subject2_data_container, subject3_data_container,
|
|
|
|
subject4_data_container, subject5_data_container]
|
|
|
|
|
|
|
|
for subject_nr in range(5):
|
2021-06-25 09:09:36 +00:00
|
|
|
data_container = subject_data_container_list[subject_nr]
|
2021-06-25 07:29:23 +00:00
|
|
|
# left variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
2021-06-25 09:09:36 +00:00
|
|
|
filename = left_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'left', data_container, round+1)
|
2021-06-25 07:29:23 +00:00
|
|
|
# right variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
2021-06-25 09:09:36 +00:00
|
|
|
filename = right_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'right', data_container, round+1)
|
|
|
|
# Links the stored data in the data_container to the Handler
|
|
|
|
self.link_container_to_handler(data_container)
|
|
|
|
|
2021-06-25 07:29:23 +00:00
|
|
|
return self.data_container_dict
|
|
|
|
|
2021-06-25 09:09:36 +00:00
|
|
|
def load_soft_original_emg_data(self):
|
|
|
|
|
|
|
|
# CSV data from subject 1
|
|
|
|
file1_subject1_left = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1810/myoLeftEmg.csv"
|
|
|
|
file2_subject1_left = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1830/myoLeftEmg.csv"
|
|
|
|
file3_subject1_left = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1845/myoLeftEmg.csv"
|
|
|
|
file4_subject1_left = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1855/myoLeftEmg.csv"
|
|
|
|
subject1_left_files = [file1_subject1_left, file2_subject1_left, file3_subject1_left, file4_subject1_left]
|
|
|
|
file1_subject1_rigth = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1810/myoRightEmg.csv"
|
|
|
|
file2_subject1_rigth = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1830/myoRightEmg.csv"
|
|
|
|
file3_subject1_rigth = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1845/myoRightEmg.csv"
|
|
|
|
file4_subject1_rigth = "/Exp20201205_2myo_softType/HaluskaMarek_20201207_1855/myoRightEmg.csv"
|
|
|
|
subject1_right_files = [file1_subject1_rigth, file2_subject1_rigth, file3_subject1_rigth, file4_subject1_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 2
|
|
|
|
file1_subject2_left = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2010/myoLeftEmg.csv"
|
|
|
|
file2_subject2_left = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2025/myoLeftEmg.csv"
|
|
|
|
file3_subject2_left = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2035/myoLeftEmg.csv"
|
|
|
|
file4_subject2_left = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2045/myoLeftEmg.csv"
|
|
|
|
subject2_left_files = [file1_subject2_left, file2_subject2_left, file3_subject2_left, file4_subject2_left]
|
|
|
|
file1_subject2_rigth = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2010/myoRightEmg.csv"
|
|
|
|
file2_subject2_rigth = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2025/myoRightEmg.csv"
|
|
|
|
file3_subject2_rigth = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2035/myoRightEmg.csv"
|
|
|
|
file4_subject2_rigth = "/Exp20201205_2myo_softType/HaluskaMaros_20201205_2045/myoRightEmg.csv"
|
|
|
|
subject2_right_files = [file1_subject2_rigth, file2_subject2_rigth, file3_subject2_rigth, file4_subject2_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 3
|
|
|
|
file1_subject3_left = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1700/myoLeftEmg.csv"
|
|
|
|
file2_subject3_left = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1715/myoLeftEmg.csv"
|
|
|
|
file3_subject3_left = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1725/myoLeftEmg.csv"
|
|
|
|
file4_subject3_left = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1735/myoLeftEmg.csv"
|
|
|
|
subject3_left_files = [file1_subject3_left, file2_subject3_left, file3_subject3_left, file4_subject3_left]
|
|
|
|
file1_subject3_rigth = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1700/myoRightEmg.csv"
|
|
|
|
file2_subject3_rigth = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1715/myoRightEmg.csv"
|
|
|
|
file3_subject3_rigth = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1725/myoRightEmg.csv"
|
|
|
|
file4_subject3_rigth = "/Exp20201205_2myo_softType/HaluskovaBeata_20201205_1735/myoRightEmg.csv"
|
|
|
|
subject3_right_files = [file1_subject3_rigth, file2_subject3_rigth, file3_subject3_rigth, file4_subject3_rigth]
|
|
|
|
|
|
|
|
# CSV data from subject 4
|
|
|
|
file1_subject4_left = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1900/myoLeftEmg.csv"
|
|
|
|
file2_subject4_left = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1915/myoLeftEmg.csv"
|
|
|
|
file3_subject4_left = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1925/myoLeftEmg.csv"
|
|
|
|
file4_subject4_left = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1935/myoLeftEmg.csv"
|
|
|
|
subject4_left_files = [file1_subject4_left, file2_subject4_left, file3_subject4_left, file4_subject4_left]
|
|
|
|
file1_subject4_rigth = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1900/myoRightEmg.csv"
|
|
|
|
file2_subject4_rigth = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1915/myoRightEmg.csv"
|
|
|
|
file3_subject4_rigth = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1925/myoRightEmg.csv"
|
|
|
|
file4_subject4_rigth = "/Exp20201205_2myo_softType/KelisekDavid_20201209_1935/myoRightEmg.csv"
|
|
|
|
subject4_right_files = [file1_subject4_rigth, file2_subject4_rigth, file3_subject4_rigth, file4_subject4_rigth]
|
|
|
|
|
|
|
|
|
|
|
|
# CSV data from subject 5
|
|
|
|
file1_subject5_left = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2030/myoLeftEmg.csv"
|
|
|
|
file2_subject5_left = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2040/myoLeftEmg.csv"
|
|
|
|
file3_subject5_left = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2050/myoLeftEmg.csv"
|
|
|
|
file4_subject5_left = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2100/myoLeftEmg.csv"
|
|
|
|
subject5_left_files = [file1_subject5_left, file2_subject5_left, file3_subject5_left, file4_subject5_left]
|
|
|
|
file1_subject5_rigth = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2030/myoRightEmg.csv"
|
|
|
|
file2_subject5_rigth = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2040/myoRightEmg.csv"
|
|
|
|
file3_subject5_rigth = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2050/myoRightEmg.csv"
|
|
|
|
file4_subject5_rigth = "/Exp20201205_2myo_softType/KelisekRichard_20201209_2100/myoRightEmg.csv"
|
|
|
|
subject5_right_files = [file1_subject5_rigth, file2_subject5_rigth, file3_subject5_rigth, file4_subject5_rigth]
|
|
|
|
|
|
|
|
left_list = [subject1_left_files, subject2_left_files, subject3_left_files, subject4_left_files, subject5_left_files]
|
|
|
|
right_list = [subject1_right_files, subject2_right_files, subject3_right_files, subject4_right_files, subject5_right_files]
|
|
|
|
|
|
|
|
|
|
|
|
subject1_data_container = Data_container(1, 'HaluskaMarek')
|
|
|
|
subject2_data_container = Data_container(2, 'HaluskaMaros')
|
|
|
|
subject3_data_container = Data_container(3, 'HaluskovaBeata')
|
|
|
|
subject4_data_container = Data_container(4, 'KelisekDavid')
|
|
|
|
subject5_data_container = Data_container(5, 'KelisekRichard')
|
|
|
|
subject_data_container_list = [subject1_data_container, subject2_data_container, subject3_data_container,
|
|
|
|
subject4_data_container, subject5_data_container]
|
|
|
|
|
|
|
|
for subject_nr in range(5):
|
|
|
|
data_container = subject_data_container_list[subject_nr]
|
|
|
|
# left variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
|
|
|
filename = left_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'left', data_container, round+1)
|
|
|
|
# right variant proccessed here
|
|
|
|
for round in range(4):
|
|
|
|
for emg_nr in range(8):
|
|
|
|
filename = right_list[subject_nr][round]
|
|
|
|
self.store_df_in_container(filename, emg_nr, 'right', data_container, round+1)
|
|
|
|
# Links the stored data in the data_container to the Handler
|
|
|
|
self.link_container_to_handler(data_container)
|
|
|
|
return self.data_container_dict
|
2021-06-25 07:29:23 +00:00
|
|
|
|
2021-06-23 13:56:35 +00:00
|
|
|
def get_emg_str(emg_nr):
|
|
|
|
return 'emg' + str(emg_nr)
|
2021-06-22 19:00:51 +00:00
|
|
|
|
2021-06-23 13:56:35 +00:00
|
|
|
def get_min_max_timestamp(df:DataFrame):
|
2021-06-24 08:10:28 +00:00
|
|
|
min = int(np.floor(df['timestamp'].min()))
|
2021-06-24 10:02:49 +00:00
|
|
|
max = df['timestamp'].max()
|
2021-06-23 13:56:35 +00:00
|
|
|
return min, max
|
2021-06-22 18:31:16 +00:00
|
|
|
|
2021-06-22 13:32:51 +00:00
|
|
|
|