diff --git a/code/plot_chirp_bodylegth.py b/code/plot_chirp_bodylegth.py index 4c1b771..b522c93 100644 --- a/code/plot_chirp_bodylegth.py +++ b/code/plot_chirp_bodylegth.py @@ -173,13 +173,15 @@ def main(datapath: str): size_winners = [] for l in ['l1', 'l2', 'l3']: - size_winner = size_rows[size_rows['fish']== winner_fish1][l].values[0] + size_winner = size_rows[size_rows['fish'] + == winner_fish1][l].values[0] size_winners.append(size_winner) mean_size_winner = np.nanmean(size_winners) size_losers = [] for l in ['l1', 'l2', 'l3']: - size_loser = size_rows[size_rows['fish']== winner_fish2][l].values[0] + size_loser = size_rows[size_rows['fish'] + == winner_fish2][l].values[0] size_losers.append(size_loser) mean_size_loser = np.nanmean(size_losers) @@ -191,13 +193,15 @@ def main(datapath: str): size_winners = [] for l in ['l1', 'l2', 'l3']: - size_winner = size_rows[size_rows['fish']== winner_fish2][l].values[0] + size_winner = size_rows[size_rows['fish'] + == winner_fish2][l].values[0] size_winners.append(size_winner) mean_size_winner = np.nanmean(size_winners) size_losers = [] for l in ['l1', 'l2', 'l3']: - size_loser = size_rows[size_rows['fish']== winner_fish1][l].values[0] + size_loser = size_rows[size_rows['fish'] + == winner_fish1][l].values[0] size_losers.append(size_loser) mean_size_loser = np.nanmean(size_losers) @@ -210,8 +214,8 @@ def main(datapath: str): 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]) + 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_loser.append(chirp_loser) @@ -219,7 +223,8 @@ def main(datapath: str): size_chirps_diffs.append(chirp_winner - chirp_loser) freq_diffs.append(freq_winner - freq_loser) - fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(10, 5)) + fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(22*ps.cm, 12*ps.cm), width_ratios=[1.5, 1,1]) + plt.subplots_adjust(left=0.098, right=0.945, top=0.94, wspace=0.343) scatterwinner = 1.15 scatterloser = 1.85 chirps_winner = np.asarray(chirps_winner)[~np.isnan(chirps_winner)] @@ -234,24 +239,24 @@ def main(datapath: str): ax1.scatter(np.ones(len(chirps_loser)) * scatterloser, chirps_loser, color='r') ax1.set_xticklabels(['winner', 'loser']) - ax1.text(0.9, 0.9, f'n = {len(chirps_winner)}', + ax1.text(0.1, 0.9, f'n = {len(chirps_winner)}', transform=ax1.transAxes, color=ps.white) for w, l in zip(chirps_winner, chirps_loser): ax1.plot([scatterwinner, scatterloser], [w, l], color='r', alpha=0.5, linewidth=0.5) + ax1.set_ylabel('Chirps [n]', color=ps.white) colors1 = ps.red ps.set_boxplot_color(bplot1, colors1) colors1 = ps.orange ps.set_boxplot_color(bplot2, colors1) - ax1.set_ylabel('Chirpscounts [n]') - embed() ax2.scatter(size_diffs, size_chirps_diffs, color='r') ax2.set_xlabel('Size difference [mm]') ax2.set_ylabel('Chirps difference [n]') - ax3.scatter(freq_diffs, freq_chirps_diffs, color='r') + ax3.scatter(freq_diffs, size_chirps_diffs, color='r') + # ax3.scatter(freq_diffs, freq_chirps_diffs, color='r') ax3.set_xlabel('Frequency difference [Hz]') ax3.set_yticklabels([]) ax3.set diff --git a/code/plot_event_timeline.py b/code/plot_event_timeline.py index 2bc8f15..cbf2846 100644 --- a/code/plot_event_timeline.py +++ b/code/plot_event_timeline.py @@ -20,89 +20,90 @@ logger = makeLogger(__name__) def main(datapath: str): foldernames = [datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)] - #for foldername in foldernames: - foldername = foldernames[0] - # if foldername == '../data/mount_data/2020-05-12-10_00/': - # continue - # behabvior is pandas dataframe with all the data - bh = Behavior(foldername) - - category = bh.behavior - timestamps = bh.start_s - # Correct for doubles in chasing on- and offsets to get the right on-/offset pairs - # Get rid of tracking faults (two onsets or two offsets after another) - category, timestamps = correct_chasing_events(category, timestamps) - - # split categories - chasing_onset = (timestamps[category == 0]/ 60) /60 - chasing_offset = (timestamps[category == 1]/ 60) /60 - physical_contact = (timestamps[category == 2] / 60) /60 - - all_fish_ids = np.unique(bh.chirps_ids) - fish1_id = all_fish_ids[0] - fish2_id = all_fish_ids[1] - # Associate chirps to inidividual fish - fish1 = (bh.chirps[bh.chirps_ids == fish1_id] / 60) /60 - fish2 = (bh.chirps[bh.chirps_ids == fish2_id] / 60) /60 - fish1_color = ps.red - fish2_color = ps.orange - - fig, ax = plt.subplots(4, 1, figsize=(28*ps.cm, 13*ps.cm), height_ratios=[0.5, 0.5, 0.5, 6], sharex=True) - # marker size - s = 200 - ax[0].scatter(physical_contact, np.ones(len(physical_contact)), color='firebrick', marker='|', s=s) - ax[1].scatter(chasing_onset, np.ones(len(chasing_onset)), color='green', marker='|', s=s ) - ax[2].scatter(fish1, np.ones(len(fish1))-0.25, color=fish1_color, marker='|', s=s) - ax[2].scatter(fish2, np.zeros(len(fish2))+0.25, color=fish2_color, marker='|', s=s) - - - freq_temp = bh.freq[bh.ident==fish1_id] - time_temp = bh.time[bh.idx[bh.ident==fish1_id]] - ax[3].plot((time_temp/ 60) /60, freq_temp, color=fish1_color) - - freq_temp = bh.freq[bh.ident==fish2_id] - time_temp = bh.time[bh.idx[bh.ident==fish2_id]] - ax[3].plot((time_temp/ 60) /60, freq_temp, color=fish2_color) - - #ax[3].imshow(decibel(bh.spec), extent=[bh.time[0]/60/60, bh.time[-1]/60/60, 0, 2000], aspect='auto', origin='lower') - - # Hide grid lines - ax[0].grid(False) - ax[0].set_frame_on(False) - ax[0].set_xticks([]) - ax[0].set_yticks([]) - ps.hide_ax(ax[0]) - - - ax[1].grid(False) - ax[1].set_frame_on(False) - ax[1].set_xticks([]) - ax[1].set_yticks([]) - ps.hide_ax(ax[1]) - - ax[2].grid(False) - ax[2].set_frame_on(False) - ax[2].set_yticks([]) - ax[2].set_xticks([]) - ps.hide_ax(ax[2]) - - - - ax[3].axvspan(3, 6, 0, 5, facecolor='grey', alpha=0.5) - ax[3].set_xticks(np.arange(0, 6.1, 0.5)) - - labelpad = 40 - ax[0].set_ylabel('Physical contact', rotation=0, labelpad=labelpad) - ax[1].set_ylabel('Chasing events', rotation=0, labelpad=labelpad) - ax[2].set_ylabel('Chirps', rotation=0, labelpad=labelpad) - ax[3].set_ylabel('EODf') - - ax[3].set_xlabel('Time [h]') - #ax[0].set_title(foldername.split('/')[-2]) - # 2020-03-31-9_59 - plt.subplots_adjust(left=0.13, right=0.987, top=0.97) - plt.savefig('../poster/figs/timeline.pdf') - plt.show() + for foldername in foldernames: + #foldername = foldernames[0] + if foldername == '../data/mount_data/2020-05-12-10_00/': + continue + #behabvior is pandas dataframe with all the data + bh = Behavior(foldername) + #2020-06-11-10 + category = bh.behavior + timestamps = bh.start_s + # Correct for doubles in chasing on- and offsets to get the right on-/offset pairs + # Get rid of tracking faults (two onsets or two offsets after another) + category, timestamps = correct_chasing_events(category, timestamps) + + # split categories + chasing_onset = (timestamps[category == 0]/ 60) /60 + chasing_offset = (timestamps[category == 1]/ 60) /60 + physical_contact = (timestamps[category == 2] / 60) /60 + + all_fish_ids = np.unique(bh.chirps_ids) + fish1_id = all_fish_ids[0] + fish2_id = all_fish_ids[1] + # Associate chirps to inidividual fish + fish1 = (bh.chirps[bh.chirps_ids == fish1_id] / 60) /60 + fish2 = (bh.chirps[bh.chirps_ids == fish2_id] / 60) /60 + fish1_color = ps.red + fish2_color = ps.orange + + fig, ax = plt.subplots(4, 1, figsize=(21*ps.cm, 13*ps.cm), height_ratios=[0.5, 0.5, 0.5, 6], sharex=True) + # marker size + s = 200 + ax[0].scatter(physical_contact, np.ones(len(physical_contact)), color='firebrick', marker='|', s=s) + ax[1].scatter(chasing_onset, np.ones(len(chasing_onset)), color='green', marker='|', s=s ) + ax[2].scatter(fish1, np.ones(len(fish1))-0.25, color=fish1_color, marker='|', s=s) + ax[2].scatter(fish2, np.zeros(len(fish2))+0.25, color=fish2_color, marker='|', s=s) + + + freq_temp = bh.freq[bh.ident==fish1_id] + time_temp = bh.time[bh.idx[bh.ident==fish1_id]] + ax[3].plot((time_temp/ 60) /60, freq_temp, color=fish1_color) + + freq_temp = bh.freq[bh.ident==fish2_id] + time_temp = bh.time[bh.idx[bh.ident==fish2_id]] + ax[3].plot((time_temp/ 60) /60, freq_temp, color=fish2_color) + + #ax[3].imshow(decibel(bh.spec), extent=[bh.time[0]/60/60, bh.time[-1]/60/60, 0, 2000], aspect='auto', origin='lower') + + # Hide grid lines + ax[0].grid(False) + ax[0].set_frame_on(False) + ax[0].set_xticks([]) + ax[0].set_yticks([]) + ps.hide_ax(ax[0]) + + + ax[1].grid(False) + ax[1].set_frame_on(False) + ax[1].set_xticks([]) + ax[1].set_yticks([]) + ps.hide_ax(ax[1]) + + ax[2].grid(False) + ax[2].set_frame_on(False) + ax[2].set_yticks([]) + ax[2].set_xticks([]) + ps.hide_ax(ax[2]) + + + + ax[3].axvspan(3, 6, 0, 5, facecolor='grey', alpha=0.5) + ax[3].set_xticks(np.arange(0, 6.1, 0.5)) + + labelpad = 40 + fsize = 12 + ax[0].set_ylabel('Physical contact', rotation=0, labelpad=labelpad, fontsize=fsize) + ax[1].set_ylabel('Chasing events', rotation=0, labelpad=labelpad, fontsize=fsize) + ax[2].set_ylabel('Chirps', rotation=0, labelpad=labelpad, fontsize=fsize) + ax[3].set_ylabel('EODf') + + ax[3].set_xlabel('Time [h]') + ax[0].set_title(foldername.split('/')[-2]) + # 2020-03-31-9_59 + plt.subplots_adjust(left=0.158, right=0.987, top=0.918) + #plt.savefig('../poster/figs/timeline.pdf') + plt.show() # plot chirps diff --git a/poster/figs/chirps_winner_loser.pdf b/poster/figs/chirps_winner_loser.pdf index 7d8d1cd..3416276 100644 Binary files a/poster/figs/chirps_winner_loser.pdf and b/poster/figs/chirps_winner_loser.pdf differ diff --git a/poster/figs/timeline.pdf b/poster/figs/timeline.pdf index 38650a3..b5a6833 100644 Binary files a/poster/figs/timeline.pdf and b/poster/figs/timeline.pdf differ diff --git a/poster/main.pdf b/poster/main.pdf index 8e5c90a..fcef087 100644 Binary files a/poster/main.pdf and b/poster/main.pdf differ diff --git a/poster/main.tex b/poster/main.tex index 03e6fb1..937aad0 100644 --- a/poster/main.tex +++ b/poster/main.tex @@ -21,10 +21,10 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val sender identification of freely interacting individuals impossible. This profoundly limits our current understanding of chirps to experiments with single - or physically separated - individuals. - % \begin{tikzfigure}[] - % \label{griddrawing} - % \includegraphics[width=1\linewidth]{figs/introplot} - % \end{tikzfigure} + \begin{tikzfigure}[] + \label{griddrawing} + \includegraphics[width=0.8\linewidth]{figs/introplot} + \end{tikzfigure} } \myblock[TranspBlock]{Chirp detection}{ \begin{tikzfigure}[] @@ -41,11 +41,26 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val \includegraphics[width=\linewidth]{figs/timeline.pdf} \end{tikzfigure} \noindent - \begin{tikzfigure}[] - \label{fig:example_b} - \includegraphics[width=\linewidth]{figs/chirps_winner_loser.pdf} - \end{tikzfigure} + \begin{itemize} + \setlength\itemsep{0.5em} + \item Two fish compete for one hidding place in one tank, + \item Experiment had a 3 hour long darkphase and a 3 hour long light phase. + \end{itemize} + \noindent + \begin{minipage}[c]{0.7\linewidth} + \begin{tikzfigure}[] + \label{fig:example_b} + \includegraphics[width=\linewidth]{figs/chirps_winner_loser.pdf} + \end{tikzfigure} + \end{minipage} % no space if you would like to put them side by side + \begin{minipage}[c]{0.2\linewidth} + \begin{itemize} + \setlength\itemsep{0.5em} + \item Fish who won the competition chirped more often than the fish who lost. + \item + \end{itemize} + \end{minipage} } \myblock[TranspBlock]{Interactions at modulations}{ @@ -55,19 +70,7 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val \includegraphics[width=0.5\linewidth]{example-image-c} \end{tikzfigure} - \begin{multicols}{2} - \begin{itemize} - \setlength\itemsep{0.5em} - \item $\Delta$EOD$f$ does not appear to decrease during synchronous modulations (). - \item Individuals that rise their EOD$f$ first appear to rise their frequency higher compared to reactors (\textbf{B}). - \vfill - \null - \columnbreak - \item Synchronized fish keep distances below 1 m (\textbf{C}) but distances over 3 m also occur (see \textbf{movie}). - \item Spatial interactions increase \textbf{after} the start of a synchronous modulation (\textbf{D}). - \end{itemize} - \end{multicols} - \vspace{-1cm} + } \myblock[GrayBlock]{Conclusion}{