forked from ddandur/CDIPS-EEG-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatefeature.py
More file actions
68 lines (62 loc) · 3.24 KB
/
createfeature.py
File metadata and controls
68 lines (62 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from glob import glob
import pandas as pd
from ecog_tools import *
import sys
#### change this to true only for the first run!!!
# otherwise you will delete all the functions you uploaded to the csv files!
create_new_files = False
if create_new_files == True:
### create Patient csv files
for i in range(1,9):
subject = 'Patient_%i'%(i)
search_string = '../%s/*.mat' %(subject)
filenames = glob(search_string)
feature_dataframe = pd.DataFrame(index = filenames)
feature_dataframe.to_csv('%s_features'%(subject))
temp_df = pd.DataFrame()
temp_df.to_csv('%s_functions'%(subject))
### create Dog csv files
for i in range(1,5):
subject = 'Dog_%i'%(i)
search_string = '../%s/*.mat' %(subject)
filenames = glob(search_string)
feature_dataframe = pd.DataFrame(index = filenames)
feature_dataframe.to_csv('%s_features'%(subject))
temp_df = pd.DataFrame()
temp_df.to_csv('%s_functions'%(subject))
#creates a list of subjects
subjects = []
for i in range(1,9):
subject = 'Patient_%i'%(i)
subjects.append(subject)
for i in range(1,5):
subject = 'Dog_%i'%(i)
subjects.append(subject)
#runs over the list of subjects!
#### this is where you need to add functions basically just change the function
# name in add_to_featuredb with your function!
# once you've ran this program once you don't need to keep adding the functions again. so comment them out or delete them!
for subject in subjects:
print subject
sys.stdout.flush()
#add_to_featuredb(corr,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(var,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(ictal,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(early_ictal,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(deltapower,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(thetapower,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(alphapower,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(betapower,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(lgammapower,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(hgammapower,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(deltapowervar,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(thetapowervar,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(alphapowervar,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(betapowervar,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(lgammapowervar,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(hgammapowervar,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(var_of_windowed_var,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(rawkurtosis,'%s_features'%(subject),'%s_functions'%(subject))
#add_to_featuredb(rawskew,'%s_features'%(subject),'%s_functions'%(subject))
add_to_featuredb(freqkurtosis,'%s_features'%(subject),'%s_functions'%(subject))
add_to_featuredb(freqskew,'%s_features'%(subject),'%s_functions'%(subject))