get to know my code again XD

This commit is contained in:
Till Raab 2023-08-07 14:12:19 +02:00
parent 159c1060bc
commit dca11a7860
2 changed files with 20 additions and 25 deletions

View File

@ -146,9 +146,8 @@ def main(base_path):
event_times = np.array(event_times)[time_sorter] event_times = np.array(event_times)[time_sorter]
event_labels = np.array(event_labels)[time_sorter] event_labels = np.array(event_labels)[time_sorter]
### create marcov_matrix 1: which beh 2 is triggered by beh. 1 ? ### create marcov_matrix for one trial !!!
marcov_matrix = np.zeros((len(loop_labels)+1, len(loop_labels)+1)) marcov_matrix = np.zeros((len(loop_labels)+1, len(loop_labels)+1))
### create marcov_matrix 2: beh 2 is triggered by which beh. 1 ?
for enu_ori, label_ori in enumerate(loop_labels): for enu_ori, label_ori in enumerate(loop_labels):
for enu_tar, label_tar in enumerate(loop_labels): for enu_tar, label_tar in enumerate(loop_labels):

View File

@ -83,30 +83,26 @@ def iei_analysis(event_times, win_sex, lose_sex, kernal_w, title=''):
plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'event_meta', f'{title}_iei.png'), dpi=300) plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'event_meta', f'{title}_iei.png'), dpi=300)
plt.close() plt.close()
embed()
quit()
# all_r = []
all_r = [] # all_p = []
all_p = [] # for lag in np.arange(1, 6):
for lag in np.arange(1, 6): # fig = plt.figure(figsize=(20 / 2.54, 12 / 2.54))
fig = plt.figure(figsize=(20 / 2.54, 12 / 2.54)) # gs = gridspec.GridSpec(1, 1, left=.1, bottom=.1, right=0.95, top=0.95)
gs = gridspec.GridSpec(1, 1, left=.1, bottom=.1, right=0.95, top=0.95) # ax = fig.add_subplot(gs[0, 0])
ax = fig.add_subplot(gs[0, 0]) # plot_x = []
plot_x = [] # plot_y = []
plot_y = [] # for trial_iei in iei:
for trial_iei in iei: # plot_x.extend(trial_iei[:-lag])
plot_x.extend(trial_iei[:-lag]) # plot_y.extend(trial_iei[lag:])
plot_y.extend(trial_iei[lag:]) # ax.plot(plot_x, plot_y, '.', color='k')
ax.plot(plot_x, plot_y, '.', color='k') # r, p = scp.pearsonr(plot_x, plot_y)
r, p = scp.pearsonr(plot_x, plot_y) # all_r.append(r)
all_r.append(r) # all_p.append(p)
all_p.append(p) #
# ax.set_xlim(-1, 120)
ax.set_xlim(-1, 120) # ax.set_ylim(-1, 120)
ax.set_ylim(-1, 120) # plt.show()
plt.show()
# plt.show() # plt.show()
return iei return iei