Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-dzaye committed Apr 5, 2023
1 parent 6cb8d7d commit a9ab703
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 125 deletions.
84 changes: 44 additions & 40 deletions berlin_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main():
for remove_subject in remove_subjects:
files = [file for file in files if remove_subject not in file]
files = preprocessing.pick_runs(files)
files_x = [f for f in files if "003" in f]
files_x = [f for f in files if "004" in f]

# Define variables
burst_char_pd_all = []
Expand Down Expand Up @@ -91,6 +91,7 @@ def main():
df_gavg_dist, df_sub_dist = postprocessing.avg_distribution(M1_burst_dynamics_all)

plot_utils.plot_avgm1_burst_features(avg_features)
plot_utils.plot_m1_burst_features(features)

plot_utils.plot_distribution(df_gavg_dist, df_sub_dist)

Expand Down Expand Up @@ -241,11 +242,11 @@ def statistic(x, y):

# PLOTS #
# Features
plot_utils.plot_avgm1_burst_features(avg_features)
plot_utils.plot_m1_burst_features(features)
#plot_utils.plot_avgm1_burst_features(avg_features)
#plot_utils.plot_m1_burst_features(features)

# Distribution of Duration
plot_utils.plot_distribution(df_gavg_dist, df_sub_dist)
#plot_utils.plot_distribution(df_gavg_dist, df_sub_dist)

print("done")

Expand All @@ -267,6 +268,9 @@ def statistic(x, y):

# peak analyse

from matplotlib.patheffects import PathPatchEffect, SimpleLineShadow, Normal
sns.set()

x_ticks = np.arange(-2,9)
# find peak in plot and write frequency down
peak_3_off = psd_s3off[4:15]
Expand Down Expand Up @@ -300,18 +304,18 @@ def statistic(x, y):
peak_g_on = psd_on[6:17]

plt.subplot(1,2,1)
plt.plot(x_ticks, peak_3_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_4_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_5_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_6_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_7_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_8_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_9_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_11_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_12_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_13_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_14_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_15_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_3_off, label='3')
plt.plot(x_ticks, peak_4_off, label='4')
plt.plot(x_ticks, peak_5_off, label='5')
plt.plot(x_ticks, peak_6_off, label='6')
plt.plot(x_ticks, peak_7_off, label='7')
plt.plot(x_ticks, peak_8_off, label='8')
plt.plot(x_ticks, peak_9_off, label='9')
plt.plot(x_ticks, peak_11_off, label='11')
plt.plot(x_ticks, peak_12_off, label='12')
plt.plot(x_ticks, peak_13_off, label='13')
plt.plot(x_ticks, peak_14_off, label='14')
plt.plot(x_ticks, peak_15_off, label='15')
plt.plot(x_ticks, peak_g_off, color='red', linewidth=3, path_effects=[SimpleLineShadow(shadow_color="red", linewidth=4),Normal()])
plt.legend(title="Theta", frameon=False)
plt.xlabel("Frequency (Hz)")
Expand All @@ -320,18 +324,18 @@ def statistic(x, y):
plt.title('OFF')

plt.subplot(1,2,2)
plt.plot(x_ticks, peak_3_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_4_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_5_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_6_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_7_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_8_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_9_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_11_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_12_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_13_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_14_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_15_on, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_3_on, label='3')
plt.plot(x_ticks, peak_4_on, label='4')
plt.plot(x_ticks, peak_5_on, label='5')
plt.plot(x_ticks, peak_6_on, label='6')
plt.plot(x_ticks, peak_7_on, label='7')
plt.plot(x_ticks, peak_8_on, label='8')
plt.plot(x_ticks, peak_9_on, label='9')
plt.plot(x_ticks, peak_11_on, label='11')
plt.plot(x_ticks, peak_12_on, label='12')
plt.plot(x_ticks, peak_13_on, label='13')
plt.plot(x_ticks, peak_14_on, label='14')
plt.plot(x_ticks, peak_15_on, label='15')
plt.plot(x_ticks, peak_g_on, color='red', linewidth=3, path_effects=[SimpleLineShadow(shadow_color="red", linewidth=4),Normal()])
plt.legend(title="Theta", frameon=False)
plt.xlabel("Frequency (Hz)")
Expand Down Expand Up @@ -375,18 +379,18 @@ def statistic(x, y):
peak_g_on = psd_on[17:28]

plt.subplot(1,2,1)
plt.plot(x_ticks, peak_3_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_4_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_5_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_6_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_7_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_8_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_9_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_11_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_12_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_13_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_14_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_15_off, color='grey', alpha=0.5)
plt.plot(x_ticks, peak_3_off, label='3')
plt.plot(x_ticks, peak_4_off, label='4')
plt.plot(x_ticks, peak_5_off, label='5')
plt.plot(x_ticks, peak_6_off, label='6')
plt.plot(x_ticks, peak_7_off, label='7')
plt.plot(x_ticks, peak_8_off, label='8')
plt.plot(x_ticks, peak_9_off, label='9')
plt.plot(x_ticks, peak_11_off, label='11')
plt.plot(x_ticks, peak_12_off, label='12')
plt.plot(x_ticks, peak_13_off, label='13')
plt.plot(x_ticks, peak_14_off, label='14')
plt.plot(x_ticks, peak_15_off, label='15')
plt.plot(x_ticks, peak_g_off, color='red', linewidth=3, path_effects=[SimpleLineShadow(shadow_color="red", linewidth=5),Normal()])
plt.legend(title="Beta", frameon=False)
plt.xlabel("Frequency (Hz)")
Expand Down
Binary file modified src/__pycache__/burst_calc.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/pipeline.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/plot_utils.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/postprocessing.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/preprocessing.cpython-310.pyc
Binary file not shown.
82 changes: 41 additions & 41 deletions src/burst_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def beta_bands(run_TF):

def beta_bands_sub3(run_TF):
indTHETA = (5, 8)
indBETA = (14, 17)
indBETA = (19, 22)

l_theta = []
l_beta = []
Expand All @@ -54,8 +54,8 @@ def beta_bands_sub3(run_TF):
return l_theta, l_beta

def beta_bands_sub3_on(run_TF):
indTHETA = (7, 10)
indBETA = (14, 17)
indTHETA = (4, 7)
indBETA = (11, 14)

l_theta = []
l_beta = []
Expand All @@ -67,8 +67,8 @@ def beta_bands_sub3_on(run_TF):
return l_theta, l_beta

def beta_bands_sub4(run_TF):
indTHETA = (7, 10)
indBETA = (14, 17)
indTHETA = (4, 7)
indBETA = (13, 16)

l_theta = []
l_beta = []
Expand All @@ -80,8 +80,8 @@ def beta_bands_sub4(run_TF):
return l_theta, l_beta

def beta_bands_sub4_on(run_TF):
indTHETA = (7, 10)
indBETA = (16, 19)
indTHETA = (4, 7)
indBETA = (25, 28)

l_theta = []
l_beta = []
Expand All @@ -93,8 +93,8 @@ def beta_bands_sub4_on(run_TF):
return l_theta, l_beta

def beta_bands_sub5(run_TF):
indTHETA = (4, 7)
indBETA = (16, 19)
indTHETA = (5, 8)
indBETA = (14, 17)

l_theta = []
l_beta = []
Expand All @@ -106,8 +106,8 @@ def beta_bands_sub5(run_TF):
return l_theta, l_beta

def beta_bands_sub5_on(run_TF):
indTHETA = (5, 8)
indBETA = (26, 29)
indTHETA = (4, 7)
indBETA = (14, 17)

l_theta = []
l_beta = []
Expand All @@ -119,8 +119,8 @@ def beta_bands_sub5_on(run_TF):
return l_theta, l_beta

def beta_bands_sub6(run_TF):
indTHETA = (6, 9)
indBETA = (25, 28)
indTHETA = (4, 7)
indBETA = (24, 27)

l_theta = []
l_beta = []
Expand All @@ -132,7 +132,7 @@ def beta_bands_sub6(run_TF):
return l_theta, l_beta

def beta_bands_sub7(run_TF):
indTHETA = (5, 8)
indTHETA = (4, 7)
indBETA = (20, 23)

l_theta = []
Expand All @@ -145,8 +145,8 @@ def beta_bands_sub7(run_TF):
return l_theta, l_beta

def beta_bands_sub7_on(run_TF):
indTHETA = (4, 7)
indBETA = (21, 24)
indTHETA = (5, 8)
indBETA = (20, 23)

l_theta = []
l_beta = []
Expand All @@ -158,7 +158,7 @@ def beta_bands_sub7_on(run_TF):
return l_theta, l_beta

def beta_bands_sub8(run_TF):
indTHETA = (5, 8)
indTHETA = (4, 7)
indBETA = (15, 18)

l_theta = []
Expand All @@ -171,8 +171,8 @@ def beta_bands_sub8(run_TF):
return l_theta, l_beta

def beta_bands_sub8_on(run_TF):
indTHETA = (4, 7)
indBETA = (10, 13)
indTHETA = (6, 9)
indBETA = (12, 15)

l_theta = []
l_beta = []
Expand All @@ -184,8 +184,8 @@ def beta_bands_sub8_on(run_TF):
return l_theta, l_beta

def beta_bands_sub9(run_TF):
indTHETA = (6, 9)
indBETA = (19, 22)
indTHETA = (9, 12)
indBETA = (18, 21)

l_theta = []
l_beta = []
Expand All @@ -197,8 +197,8 @@ def beta_bands_sub9(run_TF):
return l_theta, l_beta

def beta_bands_sub9_on(run_TF):
indTHETA = (6, 9)
indBETA = (19, 22)
indTHETA = (8, 11)
indBETA = (16, 19)

l_theta = []
l_beta = []
Expand All @@ -210,8 +210,8 @@ def beta_bands_sub9_on(run_TF):
return l_theta, l_beta

def beta_bands_sub11(run_TF):
indTHETA = (4, 7)
indBETA = (13, 16)
indTHETA = (7, 10)
indBETA = (16, 19)

l_theta = []
l_beta = []
Expand All @@ -223,8 +223,8 @@ def beta_bands_sub11(run_TF):
return l_theta, l_beta

def beta_bands_sub11_on(run_TF):
indTHETA = (4, 7)
indBETA = (14, 17)
indTHETA = (7, 10)
indBETA = (17, 20)

l_theta = []
l_beta = []
Expand All @@ -236,8 +236,8 @@ def beta_bands_sub11_on(run_TF):
return l_theta, l_beta

def beta_bands_sub12(run_TF):
indTHETA = (8, 11)
indBETA = (23, 26)
indTHETA = (9, 12)
indBETA = (22, 25)

l_theta = []
l_beta = []
Expand All @@ -249,8 +249,8 @@ def beta_bands_sub12(run_TF):
return l_theta, l_beta

def beta_bands_sub12_on(run_TF):
indTHETA = (8, 11)
indBETA = (24, 27)
indTHETA = (6, 9)
indBETA = (23, 26)

l_theta = []
l_beta = []
Expand All @@ -262,8 +262,8 @@ def beta_bands_sub12_on(run_TF):
return l_theta, l_beta

def beta_bands_sub13(run_TF):
indTHETA = (6, 9)
indBETA = (23, 26)
indTHETA = (7, 10)
indBETA = (22, 25)

l_theta = []
l_beta = []
Expand All @@ -275,7 +275,7 @@ def beta_bands_sub13(run_TF):
return l_theta, l_beta

def beta_bands_sub13_on(run_TF):
indTHETA = (6, 9)
indTHETA = (7, 10)
indBETA = (23, 26)

l_theta = []
Expand All @@ -289,7 +289,7 @@ def beta_bands_sub13_on(run_TF):

def beta_bands_sub14(run_TF):
indTHETA = (4, 7)
indBETA = (20, 23)
indBETA = (19, 22)

l_theta = []
l_beta = []
Expand All @@ -301,8 +301,8 @@ def beta_bands_sub14(run_TF):
return l_theta, l_beta

def beta_bands_sub14_on(run_TF):
indTHETA = (4, 7)
indBETA = (21, 24)
indTHETA = (8, 11)
indBETA = (19, 22)

l_theta = []
l_beta = []
Expand All @@ -314,8 +314,8 @@ def beta_bands_sub14_on(run_TF):
return l_theta, l_beta

def beta_bands_sub15(run_TF):
indTHETA = (6, 9)
indBETA = (14, 17)
indTHETA = (4, 7)
indBETA = (16, 19)

l_theta = []
l_beta = []
Expand All @@ -327,8 +327,8 @@ def beta_bands_sub15(run_TF):
return l_theta, l_beta

def beta_bands_sub15_on(run_TF):
indTHETA = (6, 9)
indBETA = (14, 17)
indTHETA = (4, 7)
indBETA = (20, 23)

l_theta = []
l_beta = []
Expand Down
Loading

0 comments on commit a9ab703

Please sign in to comment.