continued meta analysis
This commit is contained in:
parent
42640c17d9
commit
5af9a25dfd
@ -168,8 +168,10 @@ def main(data_folder=None):
|
||||
if not os.path.exists(os.path.join(os.path.split(__file__)[0], 'figures')):
|
||||
os.makedirs(os.path.join(os.path.split(__file__)[0], 'figures'))
|
||||
|
||||
trials_meta = pd.read_csv('order_meta.csv')
|
||||
fish_meta = pd.read_csv('id_meta.csv')
|
||||
# trials_meta = pd.read_csv('order_meta.csv')
|
||||
trials_meta = pd.read_csv(os.path.join(data_folder, 'order_meta.csv'))
|
||||
# fish_meta = pd.read_csv('id_meta.csv')
|
||||
fish_meta = pd.read_csv(os.path.join(data_folder, 'id_meta.csv'))
|
||||
fish_meta['mean_w'] = np.nanmean(fish_meta.loc[:, ['w1', 'w2', 'w3']], axis=1)
|
||||
fish_meta['mean_l'] = np.nanmean(fish_meta.loc[:, ['l1', 'l2', 'l3']], axis=1)
|
||||
|
||||
@ -354,29 +356,29 @@ def main(data_folder=None):
|
||||
plt.savefig(os.path.join(os.path.join(os.path.split(__file__)[0], 'figures', f'{recording}.png')), dpi=300)
|
||||
plt.close()
|
||||
|
||||
fig = plt.figure(figsize=(20/2.54, 20/2.54))
|
||||
gs = gridspec.GridSpec(2, 2, left=0.1, bottom=0.1, right=0.95, top=0.95, height_ratios=[1, 3], width_ratios=[3, 1])
|
||||
ax = fig.add_subplot(gs[1, 0])
|
||||
|
||||
ax.plot(trial_summary['rises_win'], trial_summary['chirps_win'], 'o', color=Wc, label='winner')
|
||||
ax.plot(trial_summary['rise_lose'], trial_summary['chirps_lose'], 'o', color=Lc, label='loster')
|
||||
ax.set_xlabel('rises [n]', fontsize=12)
|
||||
ax.set_ylabel('chirps [n]', fontsize=12)
|
||||
ax.tick_params(labelsize=10)
|
||||
|
||||
ax_chirps = fig.add_subplot(gs[1, 1], sharey=ax)
|
||||
ax_chirps.boxplot([trial_summary['chirps_win'], trial_summary['chirps_lose']], widths = .5, positions = [1, 2])
|
||||
ax_chirps.set_xticks([1, 2])
|
||||
ax_chirps.set_xticklabels(['Win', 'Lose'])
|
||||
plt.setp(ax_chirps.get_yticklabels(), visible=False)
|
||||
|
||||
ax_rises = fig.add_subplot(gs[0, 0], sharex=ax)
|
||||
ax_rises.boxplot([trial_summary['rises_win'], trial_summary['rise_lose']], widths = .5, positions = [1, 2], vert=False)
|
||||
ax_rises.set_yticks([1, 2])
|
||||
ax_rises.set_yticklabels(['Win', 'Lose'])
|
||||
plt.setp(ax_rises.get_xticklabels(), visible=False)
|
||||
|
||||
plt.show()
|
||||
# fig = plt.figure(figsize=(20/2.54, 20/2.54))
|
||||
# gs = gridspec.GridSpec(2, 2, left=0.1, bottom=0.1, right=0.95, top=0.95, height_ratios=[1, 3], width_ratios=[3, 1])
|
||||
# ax = fig.add_subplot(gs[1, 0])
|
||||
#
|
||||
# ax.plot(trial_summary['rises_win'], trial_summary['chirps_win'], 'o', color=Wc, label='winner')
|
||||
# ax.plot(trial_summary['rise_lose'], trial_summary['chirps_lose'], 'o', color=Lc, label='loster')
|
||||
# ax.set_xlabel('rises [n]', fontsize=12)
|
||||
# ax.set_ylabel('chirps [n]', fontsize=12)
|
||||
# ax.tick_params(labelsize=10)
|
||||
#
|
||||
# ax_chirps = fig.add_subplot(gs[1, 1], sharey=ax)
|
||||
# ax_chirps.boxplot([trial_summary['chirps_win'], trial_summary['chirps_lose']], widths = .5, positions = [1, 2])
|
||||
# ax_chirps.set_xticks([1, 2])
|
||||
# ax_chirps.set_xticklabels(['Win', 'Lose'])
|
||||
# plt.setp(ax_chirps.get_yticklabels(), visible=False)
|
||||
#
|
||||
# ax_rises = fig.add_subplot(gs[0, 0], sharex=ax)
|
||||
# ax_rises.boxplot([trial_summary['rises_win'], trial_summary['rise_lose']], widths = .5, positions = [1, 2], vert=False)
|
||||
# ax_rises.set_yticks([1, 2])
|
||||
# ax_rises.set_yticklabels(['Win', 'Lose'])
|
||||
# plt.setp(ax_rises.get_xticklabels(), visible=False)
|
||||
#
|
||||
# plt.show()
|
||||
|
||||
|
||||
for g in pd.unique(trial_summary['group']):
|
||||
@ -385,7 +387,7 @@ def main(data_folder=None):
|
||||
for f in fish_no:
|
||||
fish_EODf25 = np.concatenate((trial_summary['EODf_lose'][(trial_summary['group'] == g) & (trial_summary['lose_fish'] == f)],
|
||||
trial_summary['EODf_win'][(trial_summary['group'] == g) & (trial_summary['win_fish'] == f)]))
|
||||
if np.median(fish_EODf25) < 740:
|
||||
if np.nanmedian(fish_EODf25) < 740:
|
||||
sex = 'f'
|
||||
else:
|
||||
sex = 'm'
|
||||
|
@ -10,6 +10,30 @@ female_color, male_color = '#e74c3c', '#3498db'
|
||||
Wc, Lc = 'darkgreen', '#3673A4'
|
||||
|
||||
|
||||
def plot_rise_vs_chirp_count(trial_summary):
|
||||
fig = plt.figure(figsize=(20/2.54, 20/2.54))
|
||||
gs = gridspec.GridSpec(2, 2, left=0.1, bottom=0.1, right=0.95, top=0.95, height_ratios=[1, 3], width_ratios=[3, 1])
|
||||
ax = fig.add_subplot(gs[1, 0])
|
||||
|
||||
ax.plot(trial_summary['rises_win'], trial_summary['chirps_win'], 'o', color=Wc, label='winner')
|
||||
ax.plot(trial_summary['rise_lose'], trial_summary['chirps_lose'], 'o', color=Lc, label='loster')
|
||||
ax.set_xlabel('rises [n]', fontsize=12)
|
||||
ax.set_ylabel('chirps [n]', fontsize=12)
|
||||
ax.tick_params(labelsize=10)
|
||||
|
||||
ax_chirps = fig.add_subplot(gs[1, 1], sharey=ax)
|
||||
ax_chirps.boxplot([trial_summary['chirps_win'], trial_summary['chirps_lose']], widths = .5, positions = [1, 2])
|
||||
ax_chirps.set_xticks([1, 2])
|
||||
ax_chirps.set_xticklabels(['Win', 'Lose'])
|
||||
plt.setp(ax_chirps.get_yticklabels(), visible=False)
|
||||
|
||||
ax_rises = fig.add_subplot(gs[0, 0], sharex=ax)
|
||||
ax_rises.boxplot([trial_summary['rises_win'], trial_summary['rise_lose']], widths = .5, positions = [1, 2], vert=False)
|
||||
ax_rises.set_yticks([1, 2])
|
||||
ax_rises.set_yticklabels(['Win', 'Lose'])
|
||||
plt.setp(ax_rises.get_xticklabels(), visible=False)
|
||||
|
||||
|
||||
def plot_chirp_rise_count_per_pairing(trial_summary):
|
||||
win_chirps = []
|
||||
lose_chirps = []
|
||||
@ -39,8 +63,8 @@ def plot_chirp_rise_count_per_pairing(trial_summary):
|
||||
ax.boxplot(lose_chirps, positions=np.arange(len(lose_chirps))+0.15, widths= .2, sym='')
|
||||
|
||||
ax.set_xticks(np.arange(len(win_chirps)))
|
||||
# ax.set_xticklabels([u'\u2642\u2642', u'\u2642\u2640', u'\u2640\u2642', u'\u2640\u2640'])
|
||||
ax.set_xticklabels(['mm', 'mf', 'fm', 'ff'])
|
||||
ax.set_xticklabels([u'\u2642\u2642', u'\u2642\u2640', u'\u2640\u2642', u'\u2640\u2640'])
|
||||
# ax.set_xticklabels(['mm', 'mf', 'fm', 'ff'])
|
||||
y0, y1 = ax.get_ylim()
|
||||
for i in range(len(win_chirps)):
|
||||
ax.text(i, y1, f'n={len(win_chirps[i]):.0f}', fontsize=10, ha='center', va='bottom')
|
||||
@ -55,17 +79,18 @@ def plot_chirp_rise_count_per_pairing(trial_summary):
|
||||
ax.boxplot(lose_rises, positions=np.arange(len(lose_rises))+0.15, widths= .2, sym='')
|
||||
|
||||
ax.set_xticks(np.arange(len(win_rises)))
|
||||
# ax.set_xticklabels([u'\u2642\u2642', u'\u2642\u2640', u'\u2640\u2642', u'\u2640\u2640'])
|
||||
ax.set_xticklabels(['mm', 'mf', 'fm', 'ff'])
|
||||
ax.set_xticklabels([u'\u2642\u2642', u'\u2642\u2640', u'\u2640\u2642', u'\u2640\u2640'])
|
||||
# ax.set_xticklabels(['mm', 'mf', 'fm', 'ff'])
|
||||
y0, y1 = ax.get_ylim()
|
||||
for i in range(len(win_rises)):
|
||||
ax.text(i, y1, f'n={len(win_rises[i]):.0f}', fontsize=10, ha='center', va='bottom')
|
||||
ax.set_ylim(top = y1*1.1)
|
||||
ax.set_ylabel('rises [n]', fontsize=12)
|
||||
plt.tick_params(labelsize=10)
|
||||
plt.show()
|
||||
# plt.show()
|
||||
|
||||
def plot_chirp_rise_count_per_vs_size_diff(trial_summary):
|
||||
|
||||
def plot_chirp_rise_count_vs_size_diff(trial_summary):
|
||||
win_chirps = []
|
||||
lose_chirps = []
|
||||
|
||||
@ -73,6 +98,7 @@ def plot_chirp_rise_count_per_vs_size_diff(trial_summary):
|
||||
lose_rises = []
|
||||
|
||||
d_size = []
|
||||
d_EODf = []
|
||||
|
||||
for win_sex, lose_sex in itertools.product(['m', 'f'], repeat=2):
|
||||
win_chirps.append(trial_summary['chirps_win'][(trial_summary["sex_win"] == win_sex) &
|
||||
@ -95,32 +121,107 @@ def plot_chirp_rise_count_per_vs_size_diff(trial_summary):
|
||||
(trial_summary["sex_lose"] == lose_sex) &
|
||||
(trial_summary["draw"] == 0)].to_numpy()
|
||||
|
||||
w_EODf = trial_summary['EODf_win'][(trial_summary["sex_win"] == win_sex) &
|
||||
(trial_summary["sex_lose"] == lose_sex) &
|
||||
(trial_summary["draw"] == 0)].to_numpy()
|
||||
l_EODf = trial_summary['EODf_lose'][(trial_summary["sex_win"] == win_sex) &
|
||||
(trial_summary["sex_lose"] == lose_sex) &
|
||||
(trial_summary["draw"] == 0)].to_numpy()
|
||||
|
||||
d_size.append(w_size-l_size)
|
||||
embed()
|
||||
quit()
|
||||
d_EODf.append(w_EODf-l_EODf)
|
||||
|
||||
|
||||
mek = ['k', 'None', 'None', 'k']
|
||||
markersize = 12
|
||||
win_colors = [male_color, male_color, female_color, female_color]
|
||||
lose_colors = [male_color, female_color, male_color, female_color]
|
||||
|
||||
### SIZE
|
||||
##################################################################################################################
|
||||
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)
|
||||
gs = gridspec.GridSpec(1, 1, left=0.1, bottom=0.15, right=0.95, top=0.95)
|
||||
ax = fig.add_subplot(gs[0, 0])
|
||||
mek = ['k', 'None', 'None', 'k']
|
||||
|
||||
c = [male_color, male_color, female_color, female_color]
|
||||
for i in range(len(lose_rises)):
|
||||
ax.plot(d_size[i]*-1, lose_rises[i], 'p', color=c[i], markeredgecolor=mek[i], markersize=8)
|
||||
ax.plot(d_size[i], lose_rises[i], 'p', color=win_colors[i], markeredgecolor=mek[i], markersize=markersize)
|
||||
# ax.plot(d_size[i]*-1, lose_rises[i], 'o', color=lose_colors[i], markeredgecolor=mek[i], markersize=markersize)
|
||||
|
||||
ax.set_ylabel('rises [n]', fontsize=12)
|
||||
ax.set_ylabel('lose rises [n]', fontsize=12)
|
||||
ax.set_xlabel(u'$\Delta$size [cm]', fontsize=12)
|
||||
plt.tick_params(labelsize=10)
|
||||
|
||||
##################################################################################################################
|
||||
fig = plt.figure(figsize=(20/2.54, 20/2.54))
|
||||
gs = gridspec.GridSpec(2, 2, left=0.1, bottom=0.1, right=0.95, top=0.95, hspace=0.1, wspace=0.1)
|
||||
ax = []
|
||||
ax.append(fig.add_subplot(gs[0, 0]))
|
||||
ax.append(fig.add_subplot(gs[1, 0], sharex=ax[0]))
|
||||
ax.append(fig.add_subplot(gs[0, 1], sharey=ax[0]))
|
||||
ax.append(fig.add_subplot(gs[1, 1], sharex=ax[2], sharey=ax[1]))
|
||||
|
||||
for i in range(len(lose_chirps)):
|
||||
ax[0].plot(d_size[i], win_chirps[i], 'p', color=win_colors[i], markeredgecolor=mek[i], markersize=markersize, markeredgewidth=2)
|
||||
ax[1].plot(d_size[i], lose_chirps[i], 'p', color=win_colors[i], markeredgecolor=mek[i], markersize=markersize, markeredgewidth=2)
|
||||
|
||||
ax[2].plot(d_size[i], win_chirps[i], 'o', color=lose_colors[i], markeredgecolor=mek[i], markersize=markersize, markeredgewidth=2)
|
||||
ax[3].plot(d_size[i], lose_chirps[i], 'o', color=lose_colors[i], markeredgecolor=mek[i], markersize=markersize, markeredgewidth=2 )
|
||||
|
||||
ax[0].set_ylabel('win chirps [n]', fontsize=12)
|
||||
ax[1].set_ylabel('lose chirps [n]', fontsize=12)
|
||||
ax[1].set_xlabel(u'$\Delta$size [cm]', fontsize=12)
|
||||
ax[3].set_xlabel(u'$\Delta$size [cm]', fontsize=12)
|
||||
|
||||
plt.setp(ax[0].get_xticklabels(), visible=False)
|
||||
plt.setp(ax[2].get_xticklabels(), visible=False)
|
||||
|
||||
plt.setp(ax[2].get_yticklabels(), visible=False)
|
||||
plt.setp(ax[3].get_yticklabels(), visible=False)
|
||||
plt.tick_params(labelsize=10)
|
||||
|
||||
### EODf
|
||||
##################################################################################################################
|
||||
|
||||
fig = plt.figure(figsize=(20/2.54, 12/2.54))
|
||||
gs = gridspec.GridSpec(1, 1, left=0.1, bottom=0.15, right=0.95, top=0.95)
|
||||
ax = fig.add_subplot(gs[0, 0])
|
||||
|
||||
for i in range(len(lose_rises)):
|
||||
ax.plot(d_EODf[i], lose_rises[i], 'p', color=win_colors[i], markeredgecolor=mek[i], markersize=markersize)
|
||||
# ax.plot(d_EODf[i]*-1, lose_rises[i], 'o', color=lose_colors[i], markeredgecolor=mek[i], markersize=markersize)
|
||||
|
||||
ax.set_ylabel('lose rises [n]', fontsize=12)
|
||||
ax.set_xlabel(u'$\Delta$EODf [Hz]', fontsize=12)
|
||||
plt.tick_params(labelsize=10)
|
||||
|
||||
##################################################################################################################
|
||||
fig = plt.figure(figsize=(20/2.54, 12/2.54))
|
||||
gs = gridspec.GridSpec(1, 1, left=0.1, bottom=0.15, right=0.95, top=0.95)
|
||||
ax = fig.add_subplot(gs[0, 0])
|
||||
|
||||
for i in range(len(lose_chirps)):
|
||||
ax.plot(d_EODf[i], lose_chirps[i], 'p', color=win_colors[i], markeredgecolor=mek[i], markersize=markersize)
|
||||
# ax.plot(d_EODf[i]*-1, lose_chirps[i], 'o', color=lose_colors[i], markeredgecolor=mek[i], markersize=markersize)
|
||||
|
||||
ax.set_ylabel('lose chirps [n]', fontsize=12)
|
||||
ax.set_xlabel(u'$\Delta$EODf [Hz]', fontsize=12)
|
||||
plt.tick_params(labelsize=10)
|
||||
def main():
|
||||
trial_summary = pd.read_csv('trial_summary.csv', index_col=0)
|
||||
chirp_notes = pd.read_csv('chirp_notes.csv', index_col=0)
|
||||
trial_summary = trial_summary[chirp_notes['good'] == 1]
|
||||
|
||||
plot_rise_vs_chirp_count(trial_summary)
|
||||
|
||||
plot_chirp_rise_count_per_pairing(trial_summary)
|
||||
|
||||
plot_chirp_rise_count_per_vs_size_diff(trial_summary)
|
||||
plot_chirp_rise_count_vs_size_diff(trial_summary)
|
||||
|
||||
|
||||
plt.show()
|
||||
|
||||
pass
|
||||
embed()
|
||||
quit()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user