diff --git a/code/__pycache__/event_time_correlations.cpython-310.pyc b/code/__pycache__/event_time_correlations.cpython-310.pyc index 739529b..cef2b92 100644 Binary files a/code/__pycache__/event_time_correlations.cpython-310.pyc and b/code/__pycache__/event_time_correlations.cpython-310.pyc differ diff --git a/code/ethogram.py b/code/ethogram.py index a437a88..1810353 100644 --- a/code/ethogram.py +++ b/code/ethogram.py @@ -15,6 +15,7 @@ from thunderfish.powerspectrum import decibel from IPython import embed from event_time_correlations import load_and_converete_boris_events glob_colors = ['#BA2D22', '#53379B', '#F47F17', '#3673A4', '#AAB71B', '#DC143C', '#1E90FF', 'k'] +glob_colors_new = ['tab:green', 'tab:olive', 'tab:red', 'tab:orange', 'tab:blue', 'k'] def plot_transition_matrix(matrix, labels): @@ -42,7 +43,7 @@ def plot_transition_matrix(matrix, labels): def plot_transition_diagram(matrix, labels, node_size, ax, threshold=5, - color_by_origin=False, color_by_target=False, title=''): + color_by_origin=False, color_by_target=False, title='', color_palet=glob_colors): @@ -61,16 +62,19 @@ def plot_transition_diagram(matrix, labels, node_size, ax, threshold=5, positions2[p][1] *= 1.2 # ToDo: nodes - nx.draw_networkx_nodes(Graph, pos=positions, node_size=node_size, ax=ax, alpha=0.5, node_color=np.array(glob_colors)[:len(node_size)]) + # nx.draw_networkx_nodes(Graph, pos=positions, node_size=node_size, ax=ax, alpha=0.5, node_color=np.array(glob_colors)[:len(node_size)]) + nx.draw_networkx_nodes(Graph, pos=positions, node_size=node_size, ax=ax, alpha=0.5, node_color=np.array(color_palet)[:len(node_size)]) nx.draw_networkx_labels(Graph, pos=positions2, labels=node_labels, ax=ax) # google networkx drawing to get better graphs with networkx # nx.draw(Graph, pos=positions, node_size=node_size, label=labels, with_labels=True, ax=ax) # # ToDo: edges edge_width = np.array([x / 5 for x in [*edge_labels.values()]]) if color_by_origin: - edge_colors = np.array(glob_colors)[np.array([*edge_labels.keys()], dtype=int)[:, 0]] + # edge_colors = np.array(glob_colors)[np.array([*edge_labels.keys()], dtype=int)[:, 0]] + edge_colors = np.array(color_palet)[np.array([*edge_labels.keys()], dtype=int)[:, 0]] elif color_by_target: - edge_colors = np.array(glob_colors)[np.array([*edge_labels.keys()], dtype=int)[:, 1]] + # edge_colors = np.array(glob_colors)[np.array([*edge_labels.keys()], dtype=int)[:, 1]] + edge_colors = np.array(color_palet)[np.array([*edge_labels.keys()], dtype=int)[:, 1]] else: edge_colors = 'k' @@ -79,7 +83,7 @@ def plot_transition_diagram(matrix, labels, node_size, ax, threshold=5, nx.draw_networkx_edges(Graph, pos=positions, node_size=node_size, width=edge_width, arrows=True, arrowsize=20, - min_target_margin=25, min_source_margin=25, connectionstyle="arc3, rad=0.025", + min_target_margin=25, min_source_margin=25, connectionstyle="arc3, rad=0.05", # rad=0.025" ax=ax, edge_color=edge_colors) nx.draw_networkx_edge_labels(Graph, positions, label_pos=0.2, edge_labels=edge_labels, ax=ax, rotate=True) @@ -92,6 +96,157 @@ def plot_transition_diagram(matrix, labels, node_size, ax, threshold=5, ax.set_ylim(-1.3, 1.3) ax.set_title(title, fontsize=12) +def plot_mixed_transition_diagram(og_matrix_origin, og_matrix_target, labels, node_size, + threshold=10, color_by_origin=False, color_by_target=False, + title='', color_palet=glob_colors): + + old_mask = np.zeros_like(og_matrix_origin, dtype=bool) + for scenario in np.arange(1, 9): + fig, ax = plt.subplots(figsize=(21 / 2.54, 19 / 2.54)) + fig.subplots_adjust(left=0.0, bottom=0.0, right=1, top=1) + + matrix_origin = np.copy(og_matrix_origin) + matrix_target = np.copy(og_matrix_target) + + matrix_origin[matrix_origin <= threshold] = 0 + matrix_target[matrix_target <= threshold] = 0 + helper_maks = matrix_origin >= matrix_target + matrix_origin[~helper_maks] = 0 + matrix_target[helper_maks] = 0 + matrix_origin_prev = np.copy(matrix_origin) + matrix_target_prev = np.copy(matrix_target) + + mask = np.zeros_like(og_matrix_origin, dtype=bool) + if scenario == 1: + mask[-1, :] = 1 + elif scenario == 2: + mask[1, :] = 1 + elif scenario == 3: + mask[2, :] = 1 + elif scenario == 4: + mask[0, :] = 1 + mask[3, :] = 1 + mask[0, 0] = 0 + elif scenario == 5: + mask[4, :] = 1 + elif scenario == 6: + mask = np.ones_like(matrix_origin, dtype=bool) + mask[0, 0] = 0 + elif scenario == 7: + mask = np.zeros_like(matrix_origin, dtype=bool) + mask[5, 1] = 1 + mask[1, 2] = 1 + mask[2, 0] = 1 + mask[0, 3] = 1 + mask[3, 0] = 1 + elif scenario == 8: + old_mask = np.ones_like(matrix_origin, dtype=bool) + old_mask[0, 0] = 0 + mask = np.zeros_like(matrix_origin, dtype=bool) + mask[5, 1] = 1 + mask[1, 2] = 1 + mask[2, 0] = 1 + mask[0, 3] = 1 + mask[3, 0] = 1 + mask[2, 3] = 1 + mask[5, 2] = 1 + old_mask[mask] = 0 + matrix_origin[~mask] = 0 + matrix_target[~mask] = 0 + matrix_origin_prev[~old_mask] = 0 + matrix_target_prev[~old_mask] = 0 + + matrix_origin = np.around(matrix_origin, decimals=1) + matrix_target = np.around(matrix_target, decimals=1) + matrix_origin_prev = np.around(matrix_origin_prev, decimals=1) + matrix_target_prev = np.around(matrix_target_prev, decimals=1) + + Graph = nx.from_numpy_array(matrix_origin, create_using=nx.DiGraph) + Graph2 = nx.from_numpy_array(matrix_target, create_using=nx.DiGraph) + Graph_prev = nx.from_numpy_array(matrix_origin_prev, create_using=nx.DiGraph) + Graph2_prev = nx.from_numpy_array(matrix_target_prev, create_using=nx.DiGraph) + + node_labels = dict(zip(Graph, labels)) + + + edge_labels = nx.get_edge_attributes(Graph, 'weight') + edge_labels2 = nx.get_edge_attributes(Graph2, 'weight') + edge_labels_prev = nx.get_edge_attributes(Graph_prev, 'weight') + edge_labels2_prev = nx.get_edge_attributes(Graph2_prev, 'weight') + + positions = nx.circular_layout(Graph) + positions2 = nx.circular_layout(Graph) + for p in positions: + positions2[p][0] *= 1.2 + positions2[p][1] *= 1.2 + + nx.draw_networkx_nodes(Graph, pos=positions, node_size=node_size, ax=ax, alpha=0.5, node_color=np.array(color_palet)[:len(node_size)]) + nx.draw_networkx_labels(Graph, pos=positions2, labels=node_labels, ax=ax) + + edge_width = np.array([x / 5 for x in [*edge_labels.values()]]) + edge_width2 = np.array([x / 5 for x in [*edge_labels2.values()]]) + edge_width_prev = np.array([x / 5 for x in [*edge_labels_prev.values()]]) + edge_width2_prev = np.array([x / 5 for x in [*edge_labels2_prev.values()]]) + + edge_width[edge_width >= 6] = 6 + edge_width2[edge_width2 >= 6] = 6 + edge_width_prev[edge_width_prev >= 6] = 6 + edge_width2_prev[edge_width2_prev >= 6] = 6 + + if len(edge_labels2) >= 1: + if color_by_origin: + edge_colors = np.array(color_palet)[np.array([*edge_labels2.keys()], dtype=int)[:, 0]] + elif color_by_target: + edge_colors = np.array(color_palet)[np.array([*edge_labels2.keys()], dtype=int)[:, 1]] + else: + edge_colors = 'k' + + nx.draw_networkx_edges(Graph2, pos=positions, node_size=node_size, width=edge_width2, + arrows=True, arrowsize=20, arrowstyle='->', + min_target_margin=25, min_source_margin=25, connectionstyle="arc3, rad=0.05", + # rad=0.025" + ax=ax, edge_color=edge_colors) + + if len(edge_labels2_prev) >= 1: + if color_by_origin: + edge_colors_prev = np.array(color_palet)[np.array([*edge_labels2_prev.keys()], dtype=int)[:, 0]] + elif color_by_target: + edge_colors_prev = np.array(color_palet)[np.array([*edge_labels2_prev.keys()], dtype=int)[:, 1]] + else: + edge_colors_prev = 'k' + + + nx.draw_networkx_edges(Graph2_prev, pos=positions, node_size=node_size, width=edge_width2_prev, + arrows=True, arrowsize=20, arrowstyle='->', + min_target_margin=25, min_source_margin=25, connectionstyle="arc3, rad=0.05", # rad=0.025" + ax=ax, edge_color=edge_colors_prev, alpha=.25) + + nx.draw_networkx_edges(Graph, pos=positions, node_size=node_size, width=edge_width, + arrows=True, arrowsize=20, arrowstyle='->', + min_target_margin=25, min_source_margin=25, connectionstyle="arc3, rad=0.05", + ax=ax, edge_color='k') + + nx.draw_networkx_edges(Graph_prev, pos=positions, node_size=node_size, width=edge_width_prev, + arrows=True, arrowsize=20, arrowstyle='->', + min_target_margin=25, min_source_margin=25, connectionstyle="arc3, rad=0.05", + ax=ax, edge_color='k', alpha=.25) + + ax.spines["top"].set_visible(False) + ax.spines["bottom"].set_visible(False) + ax.spines["right"].set_visible(False) + ax.spines["left"].set_visible(False) + + ax.set_xlim(-1.4, 1.4) + ax.set_ylim(-1.3, 1.3) + ax.set_title(title, fontsize=12) + + old_mask += mask + + plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'markov', f'marcov_buildup_{scenario}' + '.png'), dpi=300) + plt.close() + # plt.show() + + def create_marcov_matrix(individual_event_times, individual_event_labels): event_times = [] event_labels = [] @@ -114,7 +269,7 @@ def create_marcov_matrix(individual_event_times, individual_event_labels): marcov_matrix[-1, enu_tar] = n marcov_matrix[-1, 5] = 0 - individual_event_labels.append('void') + individual_event_labels.append('start') ### get those cases where ag_on does not point to event and no event points to corresponding ag_off ... add thise cases in marcov matrix chase_on_idx = np.where(event_labels == individual_event_labels[4])[0] @@ -400,24 +555,50 @@ def main(base_path): collective_marcov_matrix = np.sum(all_marcov_matrix, axis=0) collective_event_counts = np.sum(all_event_counts, axis=0) + for del_idx in [3, 2]: + collective_marcov_matrix = np.delete(collective_marcov_matrix, del_idx, 0) + collective_marcov_matrix = np.delete(collective_marcov_matrix, del_idx, 1) + collective_event_counts = np.delete(collective_event_counts, del_idx, 0) + individual_event_labels.pop(del_idx) + + + # collective_event_counts = np.ones_like(collective_event_counts) * collective_event_counts.mean() + ball_size = np.ones_like(collective_event_counts) * collective_event_counts.mean() plot_transition_matrix(collective_marcov_matrix, individual_event_labels) + # marcov by origin fig, ax = plt.subplots(figsize=(21 / 2.54, 19 / 2.54)) fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95) plot_transition_diagram( collective_marcov_matrix / collective_event_counts.reshape(len(collective_event_counts), 1) * 100, - individual_event_labels, collective_event_counts, ax, threshold=5, color_by_origin=True, title='origin triggers target [%]') - plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'markov', 'markov_destination' + '.png'), dpi=300) - plt.close() + individual_event_labels, ball_size, ax, threshold=5, color_by_origin=True, title='origin triggers target [%]', color_palet=glob_colors_new) + # plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'markov', 'markov_destination' + '.png'), dpi=300) + # plt.close() + # marcov by target fig, ax = plt.subplots(figsize=(21 / 2.54, 19 / 2.54)) fig.subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95) plot_transition_diagram(collective_marcov_matrix / collective_event_counts * 100, - individual_event_labels, collective_event_counts, ax, threshold=5, color_by_target=True, - title='target triggered by origin [%]') - plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'markov', 'markov_origin' + '.png'), dpi=300) - plt.close() + individual_event_labels, ball_size, ax, threshold=5, color_by_target=True, + title='target triggered by origin [%]', color_palet=glob_colors_new) + # plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'markov', 'markov_origin' + '.png'), dpi=300) + # plt.close() + + mm_origin = collective_marcov_matrix / collective_event_counts.reshape(len(collective_event_counts), 1) * 100 + mm_target = collective_marcov_matrix / collective_event_counts * 100 + max_collective_marcov = np.array([mm_origin, mm_target]).max(0) + + fig, ax = plt.subplots(figsize=(21 / 2.54, 19 / 2.54)) + fig.subplots_adjust(left=0.0, bottom=0.0, right=1, top=1) + plot_transition_diagram(max_collective_marcov, + individual_event_labels, ball_size, ax, threshold=10, color_by_origin=True, + title='best of both worlds', color_palet=glob_colors_new) + + plt.show() + + plot_mixed_transition_diagram(mm_origin, mm_target, individual_event_labels, ball_size, + color_by_target=True, color_palet=glob_colors_new) for i, (marcov_matrix, event_counts) in enumerate(zip(all_marcov_matrix, all_event_counts)): fig, ax = plt.subplots(figsize=(21 / 2.54, 19 / 2.54)) diff --git a/code/event_time_analysis.py b/code/event_time_analysis.py index 07e57e0..04134ae 100644 --- a/code/event_time_analysis.py +++ b/code/event_time_analysis.py @@ -420,12 +420,34 @@ def event_category_signal(all_event_t, all_contact_t, all_ag_on_t, all_ag_off_t, time_context_values.append(len(all_pre_chase_time) * 3 * 60 * 60 - np.sum(time_context_values)) time_context_values /= np.sum(time_context_values) - # fig, ax = plt.subplots(figsize=(12/2.54,12/2.54)) + event_context_values2 = [] + time_context_values2 = [] + for event_value, time_value in zip(event_context_values[:-1], time_context_values[:-1]): + event_context_values2.append(event_value) + time_context_values2.append(time_value) + if event_value >= time_value: + time_context_values2.append(event_value - time_value) + event_context_values2.append(0) + else: + event_context_values2.append(time_value - event_value) + time_context_values2.append(0) + + event_context_values2.append(1-np.sum(event_context_values2)) + time_context_values2.append(1-np.sum(time_context_values2)) + # fig, ax_pie = plt.subplots(figsize=(12/2.54,12/2.54)) size = 0.3 - outer_colors = ['tab:red', 'tab:orange', 'yellow', 'tab:green', 'k', 'tab:brown', 'tab:grey'] - ax_pie.pie(event_context_values, radius=1, colors=outer_colors, + # embed() + # quit() + + outer_colors = ['tab:red', 'tab:grey', + 'tab:orange', 'tab:grey', + 'yellow', 'tab:grey', + 'tab:green', 'tab:grey', + 'k', 'tab:grey', 'tab:brown', + 'tab:grey', 'tab:grey'] + ax_pie.pie(event_context_values2, radius=1, colors=outer_colors, wedgeprops=dict(width=size, edgecolor='w'), startangle=90, center=(0, 1)) - ax_pie.pie(time_context_values, radius=1 - size, colors=outer_colors, + ax_pie.pie(time_context_values2, radius=1 - size, colors=outer_colors, wedgeprops=dict(width=size, edgecolor='w', alpha=.6), startangle=90, center=(0, 1)) ax_pie.set_title(r'event context') @@ -451,7 +473,7 @@ def event_category_signal(all_event_t, all_contact_t, all_ag_on_t, all_ag_off_t, Patch(facecolor='tab:brown', alpha=0.6, edgecolor='w', label='%.1f' % (time_context_values[5] * 100) + '%')] - ax_pie.legend(handles=legend_elements, loc='lower right', ncol=2, bbox_to_anchor=(1.15, -0.25), frameon=False, + ax_pie.legend(handles=legend_elements, loc='lower right', ncol=2, bbox_to_anchor=(1.15, -0.3), frameon=False, fontsize=9) plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'event_time_corr', f'{event_name}_categories.png'), diff --git a/code/event_time_correlations.py b/code/event_time_correlations.py index fea7fcf..a1f9d2e 100644 --- a/code/event_time_correlations.py +++ b/code/event_time_correlations.py @@ -1,6 +1,7 @@ import os import sys import argparse +import pathlib import time import itertools @@ -91,7 +92,7 @@ def kde(event_dt, conv_t, kernal_w = 1, kernal_h = 0.2): return conv_array -def permutation_kde(event_dt, conv_t, repetitions = 2000, max_mem_use_GB = 4, kernal_w = 1, kernal_h = 0.2): +def permutation_kde(event_dt, conv_t, repetitions = 2000, max_mem_use_GB = 2, kernal_w = 1, kernal_h = 0.2): def chunk_permutation(select_event_dt, conv_tt, n_chuck, max_jitter, kernal_w, kernal_h): # array.shape = (120, 100, 15486) = (len(conv_t), repetitions, len(event_dt)) # event_dt_perm = cp.tile(event_dt, (len(conv_t), repetitions, 1)) @@ -385,37 +386,7 @@ def main(base_path): conv_t = cp.arange(-max_dt, max_dt+conv_t_dt, conv_t_dt) conv_t_numpy = cp.asnumpy(conv_t) - # embed() - # quit() - - # for centered_times, event_counts, title in \ - # [[lose_chrips_centered_on_ag_off_t, lose_chirp_count, r'chirp$_{lose}$ on chase$_{off}$'], - # [lose_chrips_centered_on_ag_on_t, lose_chirp_count, r'chirp$_{lose}$ on chase$_{on}$'], - # [lose_chrips_centered_on_contact_t, lose_chirp_count, r'chirp$_{lose}$ on contact'], - # [lose_chrips_centered_on_win_rises, lose_chirp_count, r'chirp$_{lose}$ on rise$_{win}$'], - # [lose_chrips_centered_on_win_chirp, lose_chirp_count, r'chirp$_{lose}$ on chirp$_{win}$'], - # [lose_chirps_centered_on_lose_rises, lose_chirp_count, r'chirp$_{lose}$ on rises$_{lose}$'], - # - # [win_chrips_centered_on_ag_off_t, win_chirp_count, r'chirp$_{win}$ on chase$_{off}$'], - # [win_chrips_centered_on_ag_on_t, win_chirp_count, r'chirp$_{win}$ on chase$_{on}$'], - # [win_chrips_centered_on_contact_t, win_chirp_count, r'chirp$_{win}$ on contact'], - # [win_chrips_centered_on_lose_rises, win_chirp_count, r'chirp$_{win}$ on rise$_{lose}$'], - # [win_chrips_centered_on_lose_chirp, win_chirp_count, r'chirp$_{win}$ on chirp$_{lose}$'], - # [win_chirps_centered_on_win_rises, win_chirp_count, r'chirp$_{win}$ on rises$_{win}$'], - # - # [lose_rises_centered_on_ag_off_t, lose_rises_count, r'rise$_{lose}$ on chase$_{off}$'], - # [lose_rises_centered_on_ag_on_t, lose_rises_count, r'rise$_{lose}$ on chase$_{on}$'], - # [lose_rises_centered_on_contact_t, lose_rises_count, r'rise$_{lose}$ on contact'], - # [lose_rises_centered_on_win_chirps, lose_rises_count, r'rise$_{lose}$ on chirp$_{win}$'], - # - # [win_rises_centered_on_ag_off_t, win_rises_count, r'rise$_{win}$ on chase$_{off}$'], - # [win_rises_centered_on_ag_on_t, win_rises_count, r'rise$_{win}$ on chase$_{on}$'], - # [win_rises_centered_on_contact_t, win_rises_count, r'rise$_{win}$ on contact'], - # [win_rises_centered_on_lose_chirps, win_rises_count, r'rise$_{win}$ on chirp$_{lose}$'], - # - # [ag_off_centered_on_ag_on, chase_count, r'chase$_{off}$ on chase$_{on}$']]: - - for centered_times, event_counts, title in \ + for category_enu, (centered_times, event_counts, title) in enumerate( [[lose_chrips_centered_on_ag_off_t, chase_count, r'chirp$_{lose}$ on chase$_{off}$'], [lose_chrips_centered_on_ag_on_t, chase_count, r'chirp$_{lose}$ on chase$_{on}$'], [lose_chrips_centered_on_contact_t, contact_count, r'chirp$_{lose}$ on contact'], @@ -440,77 +411,79 @@ def main(base_path): [win_rises_centered_on_contact_t, contact_count, r'rise$_{win}$ on contact'], [win_rises_centered_on_lose_chirps, lose_chirp_count, r'rise$_{win}$ on chirp$_{lose}$'], - [ag_off_centered_on_ag_on, chase_count, r'chase$_{off}$ on chase$_{on}$']]: + [ag_off_centered_on_ag_on, chase_count, r'chase$_{off}$ on chase$_{on}$']]): + save_str = title.replace('$', '').replace('{', '').replace('}', '').replace(' ', '_') ########################################################################################################### ### by pairing ### - centered_times_pairing = [] - for sex_w, sex_l in itertools.product(['m', 'f'], repeat=2): - centered_times_pairing.append([]) - for i in range(len(centered_times)): - if sex_w == sex_win[i] and sex_l == sex_lose[i]: - centered_times_pairing[-1].append(centered_times[i]) - - event_counts_pairings = [np.nansum(np.array(event_counts)[(sex_win == 'm') & (sex_lose == 'm')]), - np.nansum(np.array(event_counts)[(sex_win == 'm') & (sex_lose == 'f')]), - np.nansum(np.array(event_counts)[(sex_win == 'f') & (sex_lose == 'm')]), - np.nansum(np.array(event_counts)[(sex_win == 'f') & (sex_lose == 'f')])] - color = [male_color, female_color, male_color, female_color] - linestyle = ['-', '--', '--', '-'] - - perm_p_pairings = [] - jk_p_pairings = [] - fig = plt.figure(figsize=(20/2.54, 12/2.54)) - gs = gridspec.GridSpec(2, 2, left=0.1, bottom=0.1, right=0.95, top=0.9) - ax = [] - ax.append(fig.add_subplot(gs[0, 0])) - ax.append(fig.add_subplot(gs[0, 1], sharey=ax[0])) - ax.append(fig.add_subplot(gs[1, 0], sharex=ax[0])) - ax.append(fig.add_subplot(gs[1, 1], sharey=ax[2], sharex=ax[1])) - - for enu, (centered_times_p, event_count_p) in enumerate(zip(centered_times_pairing, event_counts_pairings)): - boot_kde = permutation_kde(np.hstack(centered_times_p), conv_t, kernal_w=1, kernal_h=1) - jk_kde = jackknife_kde(np.hstack(centered_times_p), conv_t, jack_pct=jack_pct, kernal_w=1, kernal_h=1) - - perm_p1, perm_p50, perm_p99 = np.percentile(boot_kde, (1, 50, 99), axis=0) - perm_p_pairings.append([perm_p1, perm_p50, perm_p99]) - - jk_p1, jk_p50, jk_p99 = np.percentile(jk_kde, (1, 50, 99), axis=0) - jk_p_pairings.append([jk_p1, jk_p50, jk_p99]) - - ax[enu].fill_between(conv_t_numpy, perm_p1 / event_count_p, perm_p99 / event_count_p, color='cornflowerblue', alpha=.8) - ax[enu].plot(conv_t_numpy, perm_p50 / event_count_p, color='dodgerblue', alpha=1, lw=3) - - ax[enu].fill_between(conv_t_numpy, jk_p1 / event_count_p / jack_pct, jk_p99 / event_count_p / jack_pct, color=color[enu], alpha=.8) - ax[enu].plot(conv_t_numpy, jk_p50 / event_count_p / jack_pct, color=color[enu], alpha=1, lw=3, linestyle=linestyle[enu]) - - ax_m = ax[enu].twinx() - counter = 0 - for enu2, centered_events in enumerate(centered_times_p): - Cevents = centered_events[np.abs(centered_events) <= max_dt] - if len(Cevents) != 0: - ax_m.plot(Cevents, np.ones(len(Cevents)) * counter, '|', markersize=8, color='k', alpha=.1) - counter += 1 - - ax_m.set_yticks([]) - ax[enu].set_xlim(-max_dt, max_dt) - ax[enu].tick_params(labelsize=10) - - plt.setp(ax[1].get_yticklabels(), visible=False) - plt.setp(ax[3].get_yticklabels(), visible=False) - - plt.setp(ax[0].get_xticklabels(), visible=False) - plt.setp(ax[1].get_xticklabels(), visible=False) - - ax[2].set_xlabel('time [s]', fontsize=12) - ax[3].set_xlabel('time [s]', fontsize=12) - ax[0].set_ylabel('event rate [Hz]', fontsize=12) - ax[2].set_ylabel('event rate [Hz]', fontsize=12) - fig.suptitle(title) - - plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'event_time_corr', f'{save_str}_by_sexes.png'), dpi=300) - plt.close() + if True: + centered_times_pairing = [] + for sex_w, sex_l in itertools.product(['m', 'f'], repeat=2): + centered_times_pairing.append([]) + for i in range(len(centered_times)): + if sex_w == sex_win[i] and sex_l == sex_lose[i]: + centered_times_pairing[-1].append(centered_times[i]) + + event_counts_pairings = [np.nansum(np.array(event_counts)[(sex_win == 'm') & (sex_lose == 'm')]), + np.nansum(np.array(event_counts)[(sex_win == 'm') & (sex_lose == 'f')]), + np.nansum(np.array(event_counts)[(sex_win == 'f') & (sex_lose == 'm')]), + np.nansum(np.array(event_counts)[(sex_win == 'f') & (sex_lose == 'f')])] + color = [male_color, female_color, male_color, female_color] + linestyle = ['-', '--', '--', '-'] + + perm_p_pairings = [] + jk_p_pairings = [] + fig = plt.figure(figsize=(20/2.54, 12/2.54)) + gs = gridspec.GridSpec(2, 2, left=0.1, bottom=0.1, right=0.95, top=0.9) + ax = [] + ax.append(fig.add_subplot(gs[0, 0])) + ax.append(fig.add_subplot(gs[0, 1], sharey=ax[0])) + ax.append(fig.add_subplot(gs[1, 0], sharex=ax[0])) + ax.append(fig.add_subplot(gs[1, 1], sharey=ax[2], sharex=ax[1])) + + for enu, (centered_times_p, event_count_p) in enumerate(zip(centered_times_pairing, event_counts_pairings)): + boot_kde = permutation_kde(np.hstack(centered_times_p), conv_t, kernal_w=1, kernal_h=1) + jk_kde = jackknife_kde(np.hstack(centered_times_p), conv_t, jack_pct=jack_pct, kernal_w=1, kernal_h=1) + + perm_p1, perm_p50, perm_p99 = np.percentile(boot_kde, (1, 50, 99), axis=0) + perm_p_pairings.append([perm_p1, perm_p50, perm_p99]) + + jk_p1, jk_p50, jk_p99 = np.percentile(jk_kde, (1, 50, 99), axis=0) + jk_p_pairings.append([jk_p1, jk_p50, jk_p99]) + + ax[enu].fill_between(conv_t_numpy, perm_p1 / event_count_p, perm_p99 / event_count_p, color='cornflowerblue', alpha=.8) + ax[enu].plot(conv_t_numpy, perm_p50 / event_count_p, color='dodgerblue', alpha=1, lw=3) + + ax[enu].fill_between(conv_t_numpy, jk_p1 / event_count_p / jack_pct, jk_p99 / event_count_p / jack_pct, color=color[enu], alpha=.8) + ax[enu].plot(conv_t_numpy, jk_p50 / event_count_p / jack_pct, color=color[enu], alpha=1, lw=3, linestyle=linestyle[enu]) + + ax_m = ax[enu].twinx() + counter = 0 + for enu2, centered_events in enumerate(centered_times_p): + Cevents = centered_events[np.abs(centered_events) <= max_dt] + if len(Cevents) != 0: + ax_m.plot(Cevents, np.ones(len(Cevents)) * counter, '|', markersize=8, color='k', alpha=.1) + counter += 1 + + ax_m.set_yticks([]) + ax[enu].set_xlim(-max_dt, max_dt) + ax[enu].tick_params(labelsize=10) + + plt.setp(ax[1].get_yticklabels(), visible=False) + plt.setp(ax[3].get_yticklabels(), visible=False) + + plt.setp(ax[0].get_xticklabels(), visible=False) + plt.setp(ax[1].get_xticklabels(), visible=False) + + ax[2].set_xlabel('time [s]', fontsize=12) + ax[3].set_xlabel('time [s]', fontsize=12) + ax[0].set_ylabel('event rate [Hz]', fontsize=12) + ax[2].set_ylabel('event rate [Hz]', fontsize=12) + fig.suptitle(title) + + plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'event_time_corr', f'{save_str}_by_sexes.png'), dpi=300) + plt.close() ########################################################################################################### ### all pairings ### @@ -520,24 +493,38 @@ def main(base_path): perm_p1, perm_p50, perm_p99 = np.percentile(boot_kde, (1, 50, 99), axis=0) jk_p1, jk_p50, jk_p99 = np.percentile(jk_kde, (1, 50, 99), axis=0) + if category_enu == 0: + # chirp on chase off + chirp_on_chase_off = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + elif category_enu == 1: + # chirp on chase on + chirp_on_chase_on = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + elif category_enu == 20: + # chase off on chase on + chase_off_on_chase_on = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + + elif category_enu == 12: + rise_on_chase_off = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + elif category_enu == 13: + rise_on_chase_on = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + + elif category_enu == 2: + chirp_on_contact = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + elif category_enu == 14: + rise_on_contact = [perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts] + fig = plt.figure(figsize=(20/2.54, 12/2.54)) gs = gridspec.GridSpec(1, 1, left=0.1, bottom=0.1, right=0.95, top=0.95) ax = fig.add_subplot(gs[0, 0]) - # ax.fill_between(conv_t_numpy, perm_p1/len(np.hstack(centered_times)), perm_p99/len(np.hstack(centered_times)), color='cornflowerblue', alpha=.8) - # ax.plot(conv_t_numpy, perm_p50/len(np.hstack(centered_times)), color='dodgerblue', alpha=1, lw=3) - # - # ax.fill_between(conv_t_numpy, jk_p1/len(np.hstack(centered_times))/jack_pct, jk_p99/len(np.hstack(centered_times))/jack_pct, color='tab:red', alpha=.8) - # ax.plot(conv_t_numpy, jk_p50/len(np.hstack(centered_times))/jack_pct, color='firebrick', alpha=1, lw=3) - ax.fill_between(conv_t_numpy, perm_p1/np.nansum(event_counts), perm_p99/np.nansum(event_counts), color='cornflowerblue', alpha=.8) ax.plot(conv_t_numpy, perm_p50/np.nansum(event_counts), color='dodgerblue', alpha=1, lw=3) ax.fill_between(conv_t_numpy, jk_p1/np.nansum(event_counts)/jack_pct, jk_p99/np.nansum(event_counts)/jack_pct, color='tab:red', alpha=.8) ax.plot(conv_t_numpy, jk_p50/np.nansum(event_counts)/jack_pct, color='firebrick', alpha=1, lw=3) - ax_m = ax.twinx() + counter = 0 for enu, centered_events in enumerate(centered_times): Cevents = centered_events[np.abs(centered_events) <= max_dt] if len(Cevents) != 0: @@ -555,6 +542,104 @@ def main(base_path): plt.savefig(os.path.join(os.path.split(__file__)[0], 'figures', 'event_time_corr', f'{save_str}.png'), dpi=300) plt.close() + embed() + quit() + event_time_plot_with_agonistic_dur(conv_t_numpy, chirp_on_chase_off, chase_off_on_chase_on, + lose_chrips_centered_on_ag_off_t, jack_pct, max_dt, + title=r'chirp$_{lose}$ on chase$_{off}$', chase_on_centered=False) + + event_time_plot_with_agonistic_dur(conv_t_numpy, chirp_on_chase_on, chase_off_on_chase_on, + lose_chrips_centered_on_ag_on_t, jack_pct, max_dt, + title=r'chirp$_{lose}$ on chase$_{on}$', chase_on_centered=True) + + + event_time_plot_with_agonistic_dur(conv_t_numpy, rise_on_chase_off, chase_off_on_chase_on, + lose_rises_centered_on_ag_off_t, jack_pct, max_dt, + title=r'rise$_{lose}$ on chase$_{off}$', chase_on_centered=False) + + event_time_plot_with_agonistic_dur(conv_t_numpy, rise_on_chase_on, chase_off_on_chase_on, + lose_rises_centered_on_ag_on_t, jack_pct, max_dt, + title=r'rise$_{lose}$ on chase$_{on}$', chase_on_centered=True) + + + event_time_plot_with_agonistic_dur(conv_t_numpy, rise_on_contact, None, + lose_rises_centered_on_contact_t, jack_pct, max_dt, + title=r'rise$_{lose}$ on contact') + + event_time_plot_with_agonistic_dur(conv_t_numpy, chirp_on_contact, None, + lose_chrips_centered_on_contact_t, jack_pct, max_dt, + title=r'chirp$_{lose}$ on contact') + + + + + +def event_time_plot_with_agonistic_dur(conv_t_numpy, centered_communication, chase_dur_dist, + centered_raster_times, jack_pct, max_dt, title='', chase_on_centered=True): + fig = plt.figure(figsize=(20 / 2.54, 12 / 2.54)) + gs = gridspec.GridSpec(1, 1, left=0.1, bottom=0.125 , right=0.9, top=0.95) + ax = fig.add_subplot(gs[0, 0]) + perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts = centered_communication + + ax.fill_between(conv_t_numpy, perm_p1 / np.nansum(event_counts), perm_p99 / np.nansum(event_counts), + color='tab:gray', alpha=.8) + ax.plot(conv_t_numpy, perm_p50 / np.nansum(event_counts), color='tab:gray', alpha=1, lw=3) + + ax.fill_between(conv_t_numpy, jk_p1 / np.nansum(event_counts) / jack_pct, + jk_p99 / np.nansum(event_counts) / jack_pct, color='tab:red', alpha=.8) + ax.plot(conv_t_numpy, jk_p50 / np.nansum(event_counts) / jack_pct, color='firebrick', alpha=1, lw=3) + + ax.set_xlabel('time [s]', fontsize=14) + ax.set_ylabel('event rate [Hz]', fontsize=14) + ax.set_title(title, fontsize=14) + ax.set_xlim(-max_dt, max_dt) + ax.tick_params(labelsize=12) + + ### chasing dist + if hasattr(chase_dur_dist, '__len__'): + ax_m = ax.twinx() + perm_p1, perm_p50, perm_p99, jk_p1, jk_p50, jk_p99, event_counts = chase_dur_dist + if chase_on_centered == False: + y1label = r'p(chase$_{start}$)' + jk_p1 = jk_p1[::-1] + jk_p50 = jk_p50[::-1] + jk_p99 = jk_p99[::-1] + mask = conv_t_numpy <= 0 + else: + y1label = r'p(chase$_{end}$)' + mask = conv_t_numpy >= 0 + + ax_m.fill_between(conv_t_numpy[mask], jk_p1[mask] / np.nansum(event_counts) / jack_pct, + jk_p99[mask] / np.nansum(event_counts) / jack_pct, color='tab:blue', alpha=.6) + ax_m.plot(conv_t_numpy[mask], jk_p50[mask] / np.nansum(event_counts) / jack_pct, color='tab:blue', alpha=.75, lw=3) + + + ax_m.set_ylabel(y1label, fontsize=14) + ax_m.yaxis.label.set_color('tab:blue') + ax_m.spines["right"].set_edgecolor('tab:blue') + ax_m.tick_params(axis='y', colors='tab:blue', labelsize=12) + + counter = 0 + ax_m2 = ax.twinx() + for enu, centered_events in enumerate(centered_raster_times): + Cevents = centered_events[np.abs(centered_events) <= max_dt] + if len(Cevents) != 0: + ax_m2.plot(Cevents, np.ones(len(Cevents)) * counter, '|', markersize=8, color='k', alpha=.1) + counter += 1 + + ax_m2.plot([0, 0], [-1, counter], '--', color='k', lw=2) + ax_m2.set_ylim(-1, counter) + + ax_m2.yaxis.set_visible(False) + # embed() + # quit() + save_path = pathlib.Path(__file__).parent / 'figures' / 'event_time_corr_new' + save_str = title.replace(' ', '_').replace('{', '').replace('}', '').replace('$', '') + if not save_path.exists(): + save_path.mkdir(parents=True, exist_ok=True) + plt.savefig(save_path / f'{save_str}.png', dpi=300) + plt.close() + if __name__ == '__main__': main(sys.argv[1]) diff --git a/code/event_videos.py b/code/event_videos.py index e59ede1..d89815e 100644 --- a/code/event_videos.py +++ b/code/event_videos.py @@ -15,6 +15,9 @@ def main(folder, dt): create_video_path = os.path.join(folder, 'rise_video') if not os.path.exists(create_video_path): os.mkdir(create_video_path) + + # embed() + # quit() video = cv2.VideoCapture(video_path) # was 'cap' # fish_freqs = np.load(os.path.join(folder, 'analysis', 'fish_freq_interp.npy')) @@ -29,6 +32,8 @@ def main(folder, dt): fill_spec = np.memmap(os.path.join(folder, 'fill_spec.npy'), dtype='float', mode='r', shape=(fill_spec_shape[0], fill_spec_shape[1]), order='F') ####################################### + # embed() + # quit() for fish_nr in np.arange(2)[::-1]: for idx_oi in tqdm(np.array(rise_idx[fish_nr][~np.isnan(rise_idx[fish_nr])], dtype=int)): @@ -98,7 +103,7 @@ def main(folder, dt): # plt.ion() for i in tqdm(np.arange(len(frames_oi))): - break + # break video.set(cv2.CAP_PROP_POS_FRAMES, int(frames_oi[i])) ret, frame = video.read() diff --git a/code/figures/event_time_corr/chirp_lose_on_chase_off.png b/code/figures/event_time_corr/chirp_lose_on_chase_off.png index c562279..108ebf0 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_chase_off.png and b/code/figures/event_time_corr/chirp_lose_on_chase_off.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_chase_off_by_sexes.png b/code/figures/event_time_corr/chirp_lose_on_chase_off_by_sexes.png index 8513240..bb8dd0e 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_chase_off_by_sexes.png and b/code/figures/event_time_corr/chirp_lose_on_chase_off_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_chase_on.png b/code/figures/event_time_corr/chirp_lose_on_chase_on.png index a6a9277..c29d7fb 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_chase_on.png and b/code/figures/event_time_corr/chirp_lose_on_chase_on.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_chase_on_by_sexes.png b/code/figures/event_time_corr/chirp_lose_on_chase_on_by_sexes.png index 435e481..96eb303 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_chase_on_by_sexes.png and b/code/figures/event_time_corr/chirp_lose_on_chase_on_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_contact.png b/code/figures/event_time_corr/chirp_lose_on_contact.png index dfb76f8..384f072 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_contact.png and b/code/figures/event_time_corr/chirp_lose_on_contact.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_contact_by_sexes.png b/code/figures/event_time_corr/chirp_lose_on_contact_by_sexes.png index 6bd964e..44653fa 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_contact_by_sexes.png and b/code/figures/event_time_corr/chirp_lose_on_contact_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_rise_win.png b/code/figures/event_time_corr/chirp_lose_on_rise_win.png index aa55f64..b3746aa 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_rise_win.png and b/code/figures/event_time_corr/chirp_lose_on_rise_win.png differ diff --git a/code/figures/event_time_corr/chirp_lose_on_rise_win_by_sexes.png b/code/figures/event_time_corr/chirp_lose_on_rise_win_by_sexes.png index 8a24cf4..15ab601 100644 Binary files a/code/figures/event_time_corr/chirp_lose_on_rise_win_by_sexes.png and b/code/figures/event_time_corr/chirp_lose_on_rise_win_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_chase_off.png b/code/figures/event_time_corr/chirp_win_on_chase_off.png index 4b0de7f..1ffb10d 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_chase_off.png and b/code/figures/event_time_corr/chirp_win_on_chase_off.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_chase_off_by_sexes.png b/code/figures/event_time_corr/chirp_win_on_chase_off_by_sexes.png index 2ed1aa3..ec7d841 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_chase_off_by_sexes.png and b/code/figures/event_time_corr/chirp_win_on_chase_off_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_chase_on.png b/code/figures/event_time_corr/chirp_win_on_chase_on.png index e08b3a1..eeed55a 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_chase_on.png and b/code/figures/event_time_corr/chirp_win_on_chase_on.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_chase_on_by_sexes.png b/code/figures/event_time_corr/chirp_win_on_chase_on_by_sexes.png index 4733d29..ed143c7 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_chase_on_by_sexes.png and b/code/figures/event_time_corr/chirp_win_on_chase_on_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_contact.png b/code/figures/event_time_corr/chirp_win_on_contact.png index 8f333f1..e54efa0 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_contact.png and b/code/figures/event_time_corr/chirp_win_on_contact.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_contact_by_sexes.png b/code/figures/event_time_corr/chirp_win_on_contact_by_sexes.png index 9c11b8e..26c6608 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_contact_by_sexes.png and b/code/figures/event_time_corr/chirp_win_on_contact_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_rise_lose.png b/code/figures/event_time_corr/chirp_win_on_rise_lose.png index bb31199..c527f45 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_rise_lose.png and b/code/figures/event_time_corr/chirp_win_on_rise_lose.png differ diff --git a/code/figures/event_time_corr/chirp_win_on_rise_lose_by_sexes.png b/code/figures/event_time_corr/chirp_win_on_rise_lose_by_sexes.png index 8a0b7ba..f3d0777 100644 Binary files a/code/figures/event_time_corr/chirp_win_on_rise_lose_by_sexes.png and b/code/figures/event_time_corr/chirp_win_on_rise_lose_by_sexes.png differ diff --git a/code/figures/event_time_corr/chirps$_{lose}$_categories.png b/code/figures/event_time_corr/chirps$_{lose}$_categories.png index 5179ccb..555d7f7 100644 Binary files a/code/figures/event_time_corr/chirps$_{lose}$_categories.png and b/code/figures/event_time_corr/chirps$_{lose}$_categories.png differ diff --git a/code/figures/event_time_corr/chirps$_{win}$_categories.png b/code/figures/event_time_corr/chirps$_{win}$_categories.png index 23394c8..48800bb 100644 Binary files a/code/figures/event_time_corr/chirps$_{win}$_categories.png and b/code/figures/event_time_corr/chirps$_{win}$_categories.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_chase_off.png b/code/figures/event_time_corr/rise_lose_on_chase_off.png index 8f359af..f38d0c7 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_chase_off.png and b/code/figures/event_time_corr/rise_lose_on_chase_off.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_chase_off_by_sexes.png b/code/figures/event_time_corr/rise_lose_on_chase_off_by_sexes.png index c0494e3..dc7eccc 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_chase_off_by_sexes.png and b/code/figures/event_time_corr/rise_lose_on_chase_off_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_chase_on.png b/code/figures/event_time_corr/rise_lose_on_chase_on.png index d76edc1..426d793 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_chase_on.png and b/code/figures/event_time_corr/rise_lose_on_chase_on.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_chase_on_by_sexes.png b/code/figures/event_time_corr/rise_lose_on_chase_on_by_sexes.png index d07005a..be1ae8e 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_chase_on_by_sexes.png and b/code/figures/event_time_corr/rise_lose_on_chase_on_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_chirp_win.png b/code/figures/event_time_corr/rise_lose_on_chirp_win.png index bc3a1dc..0aa29d1 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_chirp_win.png and b/code/figures/event_time_corr/rise_lose_on_chirp_win.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_chirp_win_by_sexes.png b/code/figures/event_time_corr/rise_lose_on_chirp_win_by_sexes.png index 4d16d8d..142b635 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_chirp_win_by_sexes.png and b/code/figures/event_time_corr/rise_lose_on_chirp_win_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_contact.png b/code/figures/event_time_corr/rise_lose_on_contact.png index 4defa56..ccaafde 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_contact.png and b/code/figures/event_time_corr/rise_lose_on_contact.png differ diff --git a/code/figures/event_time_corr/rise_lose_on_contact_by_sexes.png b/code/figures/event_time_corr/rise_lose_on_contact_by_sexes.png index 5b47a16..2b8a4a4 100644 Binary files a/code/figures/event_time_corr/rise_lose_on_contact_by_sexes.png and b/code/figures/event_time_corr/rise_lose_on_contact_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_win_on_chase_off.png b/code/figures/event_time_corr/rise_win_on_chase_off.png index 68ef097..06dbdca 100644 Binary files a/code/figures/event_time_corr/rise_win_on_chase_off.png and b/code/figures/event_time_corr/rise_win_on_chase_off.png differ diff --git a/code/figures/event_time_corr/rise_win_on_chase_off_by_sexes.png b/code/figures/event_time_corr/rise_win_on_chase_off_by_sexes.png index 201cc39..af83279 100644 Binary files a/code/figures/event_time_corr/rise_win_on_chase_off_by_sexes.png and b/code/figures/event_time_corr/rise_win_on_chase_off_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_win_on_chase_on.png b/code/figures/event_time_corr/rise_win_on_chase_on.png index 5fe7ba6..437f428 100644 Binary files a/code/figures/event_time_corr/rise_win_on_chase_on.png and b/code/figures/event_time_corr/rise_win_on_chase_on.png differ diff --git a/code/figures/event_time_corr/rise_win_on_chase_on_by_sexes.png b/code/figures/event_time_corr/rise_win_on_chase_on_by_sexes.png index ba282ac..75e8b09 100644 Binary files a/code/figures/event_time_corr/rise_win_on_chase_on_by_sexes.png and b/code/figures/event_time_corr/rise_win_on_chase_on_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_win_on_chirp_lose.png b/code/figures/event_time_corr/rise_win_on_chirp_lose.png index 1752a65..1a1ce94 100644 Binary files a/code/figures/event_time_corr/rise_win_on_chirp_lose.png and b/code/figures/event_time_corr/rise_win_on_chirp_lose.png differ diff --git a/code/figures/event_time_corr/rise_win_on_chirp_lose_by_sexes.png b/code/figures/event_time_corr/rise_win_on_chirp_lose_by_sexes.png index 9143364..fb76fb0 100644 Binary files a/code/figures/event_time_corr/rise_win_on_chirp_lose_by_sexes.png and b/code/figures/event_time_corr/rise_win_on_chirp_lose_by_sexes.png differ diff --git a/code/figures/event_time_corr/rise_win_on_contact.png b/code/figures/event_time_corr/rise_win_on_contact.png index 6478ab4..4aafc6e 100644 Binary files a/code/figures/event_time_corr/rise_win_on_contact.png and b/code/figures/event_time_corr/rise_win_on_contact.png differ diff --git a/code/figures/event_time_corr/rise_win_on_contact_by_sexes.png b/code/figures/event_time_corr/rise_win_on_contact_by_sexes.png index 54bfca1..c8486dd 100644 Binary files a/code/figures/event_time_corr/rise_win_on_contact_by_sexes.png and b/code/figures/event_time_corr/rise_win_on_contact_by_sexes.png differ diff --git a/code/figures/event_time_corr/rises$_{lose}$_categories.png b/code/figures/event_time_corr/rises$_{lose}$_categories.png index 8f8e991..fd3666d 100644 Binary files a/code/figures/event_time_corr/rises$_{lose}$_categories.png and b/code/figures/event_time_corr/rises$_{lose}$_categories.png differ diff --git a/code/figures/event_time_corr/rises$_{win}$_categories.png b/code/figures/event_time_corr/rises$_{win}$_categories.png index 751ebea..0896206 100644 Binary files a/code/figures/event_time_corr/rises$_{win}$_categories.png and b/code/figures/event_time_corr/rises$_{win}$_categories.png differ diff --git a/code/figures/markov/event_counts.png b/code/figures/markov/event_counts.png index f7b134c..f11f177 100644 Binary files a/code/figures/markov/event_counts.png and b/code/figures/markov/event_counts.png differ diff --git a/code/figures/markov/markov_0_destination.png b/code/figures/markov/markov_0_destination.png index 688d00e..8ff66e0 100644 Binary files a/code/figures/markov/markov_0_destination.png and b/code/figures/markov/markov_0_destination.png differ diff --git a/code/figures/markov/markov_0_origin.png b/code/figures/markov/markov_0_origin.png index 0edf54c..e726529 100644 Binary files a/code/figures/markov/markov_0_origin.png and b/code/figures/markov/markov_0_origin.png differ diff --git a/code/figures/markov/markov_1_destination.png b/code/figures/markov/markov_1_destination.png index 6f52e28..08a3358 100644 Binary files a/code/figures/markov/markov_1_destination.png and b/code/figures/markov/markov_1_destination.png differ diff --git a/code/figures/markov/markov_1_origin.png b/code/figures/markov/markov_1_origin.png index 967b2de..dd6af4e 100644 Binary files a/code/figures/markov/markov_1_origin.png and b/code/figures/markov/markov_1_origin.png differ diff --git a/code/figures/markov/markov_2_destination.png b/code/figures/markov/markov_2_destination.png index 326481d..3eb1059 100644 Binary files a/code/figures/markov/markov_2_destination.png and b/code/figures/markov/markov_2_destination.png differ diff --git a/code/figures/markov/markov_2_origin.png b/code/figures/markov/markov_2_origin.png index a484322..c623800 100644 Binary files a/code/figures/markov/markov_2_origin.png and b/code/figures/markov/markov_2_origin.png differ diff --git a/code/figures/markov/markov_3_destination.png b/code/figures/markov/markov_3_destination.png index cf8b234..43af0b2 100644 Binary files a/code/figures/markov/markov_3_destination.png and b/code/figures/markov/markov_3_destination.png differ diff --git a/code/figures/markov/markov_3_origin.png b/code/figures/markov/markov_3_origin.png index e3fad91..a2d86f7 100644 Binary files a/code/figures/markov/markov_3_origin.png and b/code/figures/markov/markov_3_origin.png differ diff --git a/code/figures/markov/markov_4_destination.png b/code/figures/markov/markov_4_destination.png index 1ce3447..d015c18 100644 Binary files a/code/figures/markov/markov_4_destination.png and b/code/figures/markov/markov_4_destination.png differ diff --git a/code/figures/markov/markov_4_origin.png b/code/figures/markov/markov_4_origin.png index ec1e42c..5af1920 100644 Binary files a/code/figures/markov/markov_4_origin.png and b/code/figures/markov/markov_4_origin.png differ diff --git a/code/figures/markov/markov_5_destination.png b/code/figures/markov/markov_5_destination.png index 2ab9f27..9e3453f 100644 Binary files a/code/figures/markov/markov_5_destination.png and b/code/figures/markov/markov_5_destination.png differ diff --git a/code/figures/markov/markov_5_origin.png b/code/figures/markov/markov_5_origin.png index 6b4e8ad..7890691 100644 Binary files a/code/figures/markov/markov_5_origin.png and b/code/figures/markov/markov_5_origin.png differ diff --git a/code/figures/markov/markov_6_destination.png b/code/figures/markov/markov_6_destination.png index daee147..ef27759 100644 Binary files a/code/figures/markov/markov_6_destination.png and b/code/figures/markov/markov_6_destination.png differ diff --git a/code/figures/markov/markov_6_origin.png b/code/figures/markov/markov_6_origin.png index 5301526..39fed81 100644 Binary files a/code/figures/markov/markov_6_origin.png and b/code/figures/markov/markov_6_origin.png differ diff --git a/code/figures/markov/markov_7_destination.png b/code/figures/markov/markov_7_destination.png index 79f09de..8647731 100644 Binary files a/code/figures/markov/markov_7_destination.png and b/code/figures/markov/markov_7_destination.png differ diff --git a/code/figures/markov/markov_7_origin.png b/code/figures/markov/markov_7_origin.png index c98eb21..6543103 100644 Binary files a/code/figures/markov/markov_7_origin.png and b/code/figures/markov/markov_7_origin.png differ diff --git a/code/figures/markov/markov_8_destination.png b/code/figures/markov/markov_8_destination.png index cb371c6..e5e9d06 100644 Binary files a/code/figures/markov/markov_8_destination.png and b/code/figures/markov/markov_8_destination.png differ diff --git a/code/figures/markov/markov_8_origin.png b/code/figures/markov/markov_8_origin.png index 46537bd..dc93137 100644 Binary files a/code/figures/markov/markov_8_origin.png and b/code/figures/markov/markov_8_origin.png differ diff --git a/code/figures/markov/markov_destination.png b/code/figures/markov/markov_destination.png index 1deba8f..3f8055c 100644 Binary files a/code/figures/markov/markov_destination.png and b/code/figures/markov/markov_destination.png differ diff --git a/code/figures/markov/markov_origin.png b/code/figures/markov/markov_origin.png index 9954d91..584673d 100644 Binary files a/code/figures/markov/markov_origin.png and b/code/figures/markov/markov_origin.png differ