adding chirp differences

This commit is contained in:
wendtalexander 2023-01-24 16:09:17 +01:00
parent 01f74a471e
commit ccc60a8354
2 changed files with 21 additions and 7 deletions

View File

@ -31,7 +31,9 @@ def main(datapath: str):
chirps_winner = [] chirps_winner = []
size_diff = [] size_diff = []
chirps_diff = []
chirps_loser = [] chirps_loser = []
freq_diff = []
for foldername in foldernames: for foldername in foldernames:
@ -93,23 +95,30 @@ def main(datapath: str):
mean_size_loser = np.nanmean(size_losers) mean_size_loser = np.nanmean(size_losers)
size_diff.append(mean_size_winner - mean_size_loser) size_diff.append(mean_size_winner - mean_size_loser)
else: else:
continue continue
print(foldername) print(foldername)
all_fish_ids = np.unique(bh.chirps_ids) all_fish_ids = np.unique(bh.chirps_ids)
chirp_loser = len(bh.chirps[bh.chirps_ids == loser_fish_id])
chirp_winner = len(bh.chirps[bh.chirps_ids == winner_fish_id]) chirp_winner = len(bh.chirps[bh.chirps_ids == winner_fish_id])
chirp_loser = len(bh.chirps[bh.chirps_ids == loser_fish_id])
freq_winner = np.nanmedian(bh.freq[bh.ident==winner_fish_id])
freq_loser = np.nanmedian(bh.freq[bh.ident==loser_fish_id])
chirps_winner.append(chirp_winner) chirps_winner.append(chirp_winner)
chirps_loser.append(chirp_loser) chirps_loser.append(chirp_loser)
chirps_diff.append(chirp_winner - chirp_loser)
freq_diff.append(freq_winner - freq_loser)
fish1_id = all_fish_ids[0] fish1_id = all_fish_ids[0]
fish2_id = all_fish_ids[1] fish2_id = all_fish_ids[1]
print(winner_fish_id) print(winner_fish_id)
print(all_fish_ids) print(all_fish_ids)
fig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,5)) fig, (ax1, ax2, ax3) = plt.subplots(1,3, figsize=(10,5))
scatterwinner = 1.15 scatterwinner = 1.15
scatterloser = 1.85 scatterloser = 1.85
bplot1 = ax1.boxplot(chirps_winner, positions=[ bplot1 = ax1.boxplot(chirps_winner, positions=[
@ -130,9 +139,14 @@ def main(datapath: str):
ps.set_boxplot_color(bplot2, colors1) ps.set_boxplot_color(bplot2, colors1)
ax1.set_ylabel('Chirpscounts [n]') ax1.set_ylabel('Chirpscounts [n]')
ax2.scatter(size_w, chirps_winner, color='r') ax2.scatter(size_diff, chirps_diff, color='r')
ax2.scatter(size_l, chirps_loser, color='green') ax2.set_xlabel('Size difference [mm]')
ax2.set_ylabel('Chirps difference [n]')
ax3.scatter(freq_diff, chirps_diff, color='r')
ax3.set_xlabel('Frequency difference [Hz]')
ax3.set_yticklabels([])
ax3.set
plt.savefig('../poster/figs/chirps_winner_loser.pdf') plt.savefig('../poster/figs/chirps_winner_loser.pdf')
plt.show() plt.show()

Binary file not shown.