adding plots to poster
This commit is contained in:
parent
c070192996
commit
4b5aec2e65
@ -20,87 +20,90 @@ logger = makeLogger(__name__)
|
|||||||
def main(datapath: str):
|
def main(datapath: str):
|
||||||
|
|
||||||
foldernames = [datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)]
|
foldernames = [datapath + x + '/' for x in os.listdir(datapath) if os.path.isdir(datapath+x)]
|
||||||
for foldername in foldernames:
|
#for foldername in foldernames:
|
||||||
if foldername == '../data/mount_data/2020-05-12-10_00/':
|
foldername = foldernames[0]
|
||||||
continue
|
# if foldername == '../data/mount_data/2020-05-12-10_00/':
|
||||||
# behabvior is pandas dataframe with all the data
|
# continue
|
||||||
bh = Behavior(foldername)
|
# behabvior is pandas dataframe with all the data
|
||||||
|
bh = Behavior(foldername)
|
||||||
category = bh.behavior
|
|
||||||
timestamps = bh.start_s
|
category = bh.behavior
|
||||||
# Correct for doubles in chasing on- and offsets to get the right on-/offset pairs
|
timestamps = bh.start_s
|
||||||
# Get rid of tracking faults (two onsets or two offsets after another)
|
# Correct for doubles in chasing on- and offsets to get the right on-/offset pairs
|
||||||
category, timestamps = correct_chasing_events(category, timestamps)
|
# 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
|
# split categories
|
||||||
chasing_offset = (timestamps[category == 1]/ 60) /60
|
chasing_onset = (timestamps[category == 0]/ 60) /60
|
||||||
physical_contact = (timestamps[category == 2] / 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]
|
all_fish_ids = np.unique(bh.chirps_ids)
|
||||||
fish2_id = all_fish_ids[1]
|
fish1_id = all_fish_ids[0]
|
||||||
# Associate chirps to inidividual fish
|
fish2_id = all_fish_ids[1]
|
||||||
fish1 = (bh.chirps[bh.chirps_ids == fish1_id] / 60) /60
|
# Associate chirps to inidividual fish
|
||||||
fish2 = (bh.chirps[bh.chirps_ids == fish2_id] / 60) /60
|
fish1 = (bh.chirps[bh.chirps_ids == fish1_id] / 60) /60
|
||||||
fish1_color = ps.red
|
fish2 = (bh.chirps[bh.chirps_ids == fish2_id] / 60) /60
|
||||||
fish2_color = ps.orange
|
fish1_color = ps.red
|
||||||
|
fish2_color = ps.orange
|
||||||
fig, ax = plt.subplots(4, 1, figsize=(10, 5), height_ratios=[0.5, 0.5, 0.5, 6], sharex=True)
|
|
||||||
# marker size
|
fig, ax = plt.subplots(4, 1, figsize=(28*ps.cm, 13*ps.cm), height_ratios=[0.5, 0.5, 0.5, 6], sharex=True)
|
||||||
s = 200
|
# marker size
|
||||||
ax[0].scatter(physical_contact, np.ones(len(physical_contact)), color='firebrick', marker='|', s=s)
|
s = 200
|
||||||
ax[1].scatter(chasing_onset, np.ones(len(chasing_onset)), color='green', marker='|', s=s )
|
ax[0].scatter(physical_contact, np.ones(len(physical_contact)), color='firebrick', marker='|', s=s)
|
||||||
ax[2].scatter(fish1, np.ones(len(fish1))-0.25, color=fish1_color, marker='|', s=s)
|
ax[1].scatter(chasing_onset, np.ones(len(chasing_onset)), color='green', marker='|', s=s )
|
||||||
ax[2].scatter(fish2, np.zeros(len(fish2))+0.25, color=fish2_color, 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]]
|
freq_temp = bh.freq[bh.ident==fish1_id]
|
||||||
ax[3].plot((time_temp/ 60) /60, freq_temp, color=fish1_color)
|
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]]
|
freq_temp = bh.freq[bh.ident==fish2_id]
|
||||||
ax[3].plot((time_temp/ 60) /60, freq_temp, color=fish2_color)
|
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')
|
|
||||||
|
#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)
|
# Hide grid lines
|
||||||
ax[0].set_frame_on(False)
|
ax[0].grid(False)
|
||||||
ax[0].set_xticks([])
|
ax[0].set_frame_on(False)
|
||||||
ax[0].set_yticks([])
|
ax[0].set_xticks([])
|
||||||
ps.hide_ax(ax[0])
|
ax[0].set_yticks([])
|
||||||
|
ps.hide_ax(ax[0])
|
||||||
|
|
||||||
ax[1].grid(False)
|
|
||||||
ax[1].set_frame_on(False)
|
ax[1].grid(False)
|
||||||
ax[1].set_xticks([])
|
ax[1].set_frame_on(False)
|
||||||
ax[1].set_yticks([])
|
ax[1].set_xticks([])
|
||||||
ps.hide_ax(ax[1])
|
ax[1].set_yticks([])
|
||||||
|
ps.hide_ax(ax[1])
|
||||||
ax[2].grid(False)
|
|
||||||
ax[2].set_frame_on(False)
|
ax[2].grid(False)
|
||||||
ax[2].set_yticks([])
|
ax[2].set_frame_on(False)
|
||||||
ax[2].set_xticks([])
|
ax[2].set_yticks([])
|
||||||
ps.hide_ax(ax[2])
|
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))
|
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)
|
labelpad = 40
|
||||||
ax[1].set_ylabel('Chasing events', rotation=0, labelpad=labelpad)
|
ax[0].set_ylabel('Physical contact', rotation=0, labelpad=labelpad)
|
||||||
ax[2].set_ylabel('Chirps', rotation=0, labelpad=labelpad)
|
ax[1].set_ylabel('Chasing events', rotation=0, labelpad=labelpad)
|
||||||
ax[3].set_ylabel('EODf')
|
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()
|
||||||
|
|
||||||
ax[3].set_xlabel('Time [h]')
|
|
||||||
ax[0].set_title(foldername.split('/')[-2])
|
|
||||||
# 2020-03-31-9_59
|
|
||||||
plt.show()
|
|
||||||
embed()
|
|
||||||
|
|
||||||
# plot chirps
|
# plot chirps
|
||||||
|
|
||||||
|
BIN
poster/figs/timeline.pdf
Normal file
BIN
poster/figs/timeline.pdf
Normal file
Binary file not shown.
BIN
poster/main.pdf
BIN
poster/main.pdf
Binary file not shown.
@ -38,7 +38,12 @@ blockverticalspace=2mm, colspace=20mm, subcolspace=0mm]{tikzposter} %Default val
|
|||||||
\myblock[TranspBlock]{Chirps during competition}{
|
\myblock[TranspBlock]{Chirps during competition}{
|
||||||
\begin{tikzfigure}[]
|
\begin{tikzfigure}[]
|
||||||
\label{fig:example_b}
|
\label{fig:example_b}
|
||||||
\includegraphics[width=0.5\linewidth]{example-image-b}
|
\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}
|
\end{tikzfigure}
|
||||||
\noindent
|
\noindent
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user