From dca11a7860ab3230cc0542902338e2838e69557d Mon Sep 17 00:00:00 2001 From: Till Raab Date: Mon, 7 Aug 2023 14:12:19 +0200 Subject: [PATCH] get to know my code again XD --- ethogram.py | 3 +-- event_time_analysis.py | 42 +++++++++++++++++++----------------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/ethogram.py b/ethogram.py index b6b0ee1..339abaa 100644 --- a/ethogram.py +++ b/ethogram.py @@ -146,9 +146,8 @@ def main(base_path): event_times = np.array(event_times)[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)) - ### create marcov_matrix 2: beh 2 is triggered by which beh. 1 ? for enu_ori, label_ori in enumerate(loop_labels): for enu_tar, label_tar in enumerate(loop_labels): diff --git a/event_time_analysis.py b/event_time_analysis.py index 79f28ab..07e57e0 100644 --- a/event_time_analysis.py +++ b/event_time_analysis.py @@ -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.close() - embed() - quit() - - - all_r = [] - all_p = [] - for lag in np.arange(1, 6): - 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) - ax = fig.add_subplot(gs[0, 0]) - plot_x = [] - plot_y = [] - for trial_iei in iei: - plot_x.extend(trial_iei[:-lag]) - plot_y.extend(trial_iei[lag:]) - ax.plot(plot_x, plot_y, '.', color='k') - r, p = scp.pearsonr(plot_x, plot_y) - all_r.append(r) - all_p.append(p) - - ax.set_xlim(-1, 120) - ax.set_ylim(-1, 120) - plt.show() + # all_r = [] + # all_p = [] + # for lag in np.arange(1, 6): + # 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) + # ax = fig.add_subplot(gs[0, 0]) + # plot_x = [] + # plot_y = [] + # for trial_iei in iei: + # plot_x.extend(trial_iei[:-lag]) + # plot_y.extend(trial_iei[lag:]) + # ax.plot(plot_x, plot_y, '.', color='k') + # r, p = scp.pearsonr(plot_x, plot_y) + # all_r.append(r) + # all_p.append(p) + # + # ax.set_xlim(-1, 120) + # ax.set_ylim(-1, 120) + # plt.show() # plt.show() return iei