event time ananlysis started. tried to implement bootstrap with cupy ... memory issues ... resolve on monday

This commit is contained in:
Till Raab 2023-05-25 15:39:04 +02:00
parent d9d9982635
commit 4f64aa6668
4 changed files with 250 additions and 90 deletions

View File

@ -24,47 +24,47 @@ def load_frame_times(trial_path):
return np.array(frame_t)
def load_and_converete_boris_events(trial_path, recording, sr, video_stated_FPS=25):
def converte_video_frames_to_grid_idx(event_frames, led_frames, led_idx):
event_idx_grid = (event_frames - led_frames[0]) / (led_frames[-1] - led_frames[0]) * (led_idx[-1] - led_idx[0]) + led_idx[0]
return event_idx_grid
# idx in grid-recording
led_idx = pd.read_csv(os.path.join(trial_path, 'led_idxs.csv'), header=None).iloc[:, 0].to_numpy()
# frames where LED gets switched on
led_frames = np.load(os.path.join(trial_path, 'LED_frames.npy'))
times, behavior, t_ag_on_off, t_contact, video_FPS = load_boris(trial_path, recording)
contact_frame = np.array(np.round(t_contact * video_FPS), dtype=int)
ag_on_off_frame = np.array(np.round(t_ag_on_off * video_FPS), dtype=int)
# led_t_GRID = led_idx / sr
contact_t_GRID = converte_video_frames_to_grid_idx(contact_frame, led_frames, led_idx) / sr
ag_on_off_t_GRID = converte_video_frames_to_grid_idx(ag_on_off_frame, led_frames, led_idx) / sr
return contact_t_GRID, ag_on_off_t_GRID, led_idx, led_frames
def load_boris(trial_path, recording):
boris_file = '-'.join(recording.split('-')[:3]) + '.csv'
data = pd.read_csv(os.path.join(trial_path, boris_file))
times = data['Start (s)']
behavior = data['Behavior']
t_ag_on = times[behavior == 0]
t_ag_off = times[behavior == 1]
t_ag_on_off = []
for t in t_ag_on:
t1 = np.array(t_ag_off)[t_ag_off > t]
if len(t1) >= 1:
t_ag_on_off.append(np.array([t, t1[0]]))
t_contact = times[behavior == 2]
return times, behavior, np.array(t_ag_on_off), t_contact.to_numpy(), data['FPS'][0]
# def load_and_converete_boris_events(trial_path, recording, sr, video_stated_FPS=25):
# def converte_video_frames_to_grid_idx(event_frames, led_frames, led_idx):
# event_idx_grid = (event_frames - led_frames[0]) / (led_frames[-1] - led_frames[0]) * (led_idx[-1] - led_idx[0]) + led_idx[0]
# return event_idx_grid
#
# # idx in grid-recording
# led_idx = pd.read_csv(os.path.join(trial_path, 'led_idxs.csv'), header=None).iloc[:, 0].to_numpy()
# # frames where LED gets switched on
# led_frames = np.load(os.path.join(trial_path, 'LED_frames.npy'))
#
# times, behavior, t_ag_on_off, t_contact, video_FPS = load_boris(trial_path, recording)
#
# contact_frame = np.array(np.round(t_contact * video_FPS), dtype=int)
# ag_on_off_frame = np.array(np.round(t_ag_on_off * video_FPS), dtype=int)
#
# # led_t_GRID = led_idx / sr
# contact_t_GRID = converte_video_frames_to_grid_idx(contact_frame, led_frames, led_idx) / sr
# ag_on_off_t_GRID = converte_video_frames_to_grid_idx(ag_on_off_frame, led_frames, led_idx) / sr
#
# return contact_t_GRID, ag_on_off_t_GRID, led_idx, led_frames
# def load_boris(trial_path, recording):
# boris_file = '-'.join(recording.split('-')[:3]) + '.csv'
#
# data = pd.read_csv(os.path.join(trial_path, boris_file))
# times = data['Start (s)']
# behavior = data['Behavior']
#
# t_ag_on = times[behavior == 0]
# t_ag_off = times[behavior == 1]
#
# t_ag_on_off = []
# for t in t_ag_on:
# t1 = np.array(t_ag_off)[t_ag_off > t]
# if len(t1) >= 1:
# t_ag_on_off.append(np.array([t, t1[0]]))
#
# t_contact = times[behavior == 2]
#
# return times, behavior, np.array(t_ag_on_off), t_contact.to_numpy(), data['FPS'][0]
def get_baseline_freq(fund_v, idx_v, times, ident_v, idents = None, binwidth = 300):
if not hasattr(idents, '__len__'):
@ -179,9 +179,10 @@ def main(data_folder=None):
sr = 20_000
light_start_sec = 3*60*60
trial_summary = pd.DataFrame(columns=['recording', 'group', 'win_fish', 'lose_fish', 'sex_win', 'sex_lose',
'size_win', 'size_lose', 'EODf_win', 'EODf_lose', 'exp_win', 'exp_lose',
'chirps_win', 'chirps_lose', 'rises_win', 'rises_lose', 'draw'])
trial_summary = pd.DataFrame(columns=['recording', 'group', 'win_fish', 'lose_fish', 'win_ID', 'lose_ID',
'sex_win', 'sex_lose', 'size_win', 'size_lose', 'EODf_win', 'EODf_lose',
'exp_win', 'exp_lose', 'chirps_win', 'chirps_lose', 'rises_win', 'rises_lose',
'draw'])
trial_summary_row = {f'{s}':None for s in trial_summary.keys()}
for trial_idx in tqdm(np.arange(len(trials_meta)), desc='Trials'):
@ -266,9 +267,9 @@ def main(data_folder=None):
if os.path.exists(os.path.join(trial_path, 'chirp_times_cnn.npy')):
chirp_t = np.load(os.path.join(trial_path, 'chirp_times_cnn.npy'))
chirp_ids = np.load(os.path.join(trial_path, 'chirp_ids_cnn.npy'))
chirp_times = [chirp_t[chirp_ids == win_id], chirp_t[chirp_ids == lose_id]]
got_chirps = True
chirp_times = [chirp_t[chirp_ids == win_id], chirp_t[chirp_ids == lose_id]]
rise_idx = np.load(os.path.join(trial_path, 'analysis', 'rise_idx.npy'))[::sorter]
rise_idx_int = [np.array(rise_idx[i][~np.isnan(rise_idx[i])], dtype=int) for i in range(len(rise_idx))]
@ -288,6 +289,8 @@ def main(data_folder=None):
'group': trials_meta['group'][trial_idx],
'win_fish': win_fish_no,
'lose_fish': lose_fish_no,
'win_ID': win_id,
'lose_ID': lose_id,
'sex_win': 'n',
'sex_lose': 'n',
'size_win': win_l,

155
event_time_analysis.py Normal file
View File

@ -0,0 +1,155 @@
import os
import sys
import argparse
import numpy as np
import cupy as cp
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import pandas as pd
from IPython import embed
def load_and_converete_boris_events(trial_path, recording, sr):
def converte_video_frames_to_grid_idx(event_frames, led_frames, led_idx):
event_idx_grid = (event_frames - led_frames[0]) / (led_frames[-1] - led_frames[0]) * (led_idx[-1] - led_idx[0]) + led_idx[0]
return event_idx_grid
# idx in grid-recording
led_idx = pd.read_csv(os.path.join(trial_path, 'led_idxs.csv'), header=None).iloc[:, 0].to_numpy()
# frames where LED gets switched on
led_frames = np.load(os.path.join(trial_path, 'LED_frames.npy'))
times, behavior, t_ag_on_off, t_contact, video_FPS = load_boris(trial_path, recording)
contact_frame = np.array(np.round(t_contact * video_FPS), dtype=int)
ag_on_off_frame = np.array(np.round(t_ag_on_off * video_FPS), dtype=int)
# led_t_GRID = led_idx / sr
contact_t_GRID = converte_video_frames_to_grid_idx(contact_frame, led_frames, led_idx) / sr
ag_on_off_t_GRID = converte_video_frames_to_grid_idx(ag_on_off_frame, led_frames, led_idx) / sr
return contact_t_GRID, ag_on_off_t_GRID, led_idx, led_frames
def load_boris(trial_path, recording):
boris_file = '-'.join(recording.split('-')[:3]) + '.csv'
data = pd.read_csv(os.path.join(trial_path, boris_file))
times = data['Start (s)']
behavior = data['Behavior']
t_ag_on = times[behavior == 0]
t_ag_off = times[behavior == 1]
t_ag_on_off = []
for t in t_ag_on:
t1 = np.array(t_ag_off)[t_ag_off > t]
if len(t1) >= 1:
t_ag_on_off.append(np.array([t, t1[0]]))
t_contact = times[behavior == 2]
return times, behavior, np.array(t_ag_on_off), t_contact.to_numpy(), data['FPS'][0]
def gauss(t, shift, sigma, size, norm = False):
if not hasattr(shift, '__len__'):
g = np.exp(-((t - shift) / sigma) ** 2 / 2) * size
if norm:
g /= np.sum(g)
return g
else:
t = np.array([t, ] * len(shift))
res = np.exp(-((t.transpose() - shift).transpose() / sigma) ** 2 / 2) * size
return res
def event_centered_times(centered_event_times, surrounding_event_times, max_dt = 60):
event_dt = []
for Cevent_t in centered_event_times:
Cdt = np.array(surrounding_event_times - Cevent_t)
event_dt.extend(Cdt[np.abs(Cdt) <= max_dt])
return np.array(event_dt)
def kde(event_dt, max_dt = 60):
kernal_w = 1
kernal_h = 0.2
conv_t = np.arange(-max_dt, max_dt, 1)
conv_array = np.zeros(len(conv_t))
for e in event_dt:
conv_array += gauss(conv_t, e, kernal_w, kernal_h, norm=True)
plt.plot(conv_t, conv_array)
def permulation_kde(event_dt, repetitions = 100, max_dt = 60):
embed()
quit()
kernal_w = 1
kernal_h = 0.2
conv_t = cp.arange(-max_dt, max_dt, 1)
conv_tt = cp.reshape(conv_t, (len(conv_t), 1, 1))
# array.shape = (120, 100, 15486) = (len(conv_t), repetitions, len(event_dt))
event_dt_perm = cp.tile(event_dt, (len(conv_t), repetitions, 1))
# conv_t_perm = cp.tile(conv_tt, (1, repetitions, len(event_dt)))
gauss_3d = cp.exp(-((conv_tt - event_dt_perm) / kernal_w) ** 2 / 2) * kernal_h
kde_3d = cp.sum(gauss_3d, axis = 2).transpose()
kde_3d_numpy = cp.asnumpy(kde_3d)
def main(base_path):
trial_summary = pd.read_csv('trial_summary.csv', index_col=0)
lose_chrips_centered_on_ag_off_t = []
for index, trial in trial_summary.iterrows():
trial_path = os.path.join(base_path, trial['recording'])
if trial['group'] < 5:
continue
if not os.path.exists(os.path.join(trial_path, 'led_idxs.csv')):
continue
if not os.path.exists(os.path.join(trial_path, 'LED_frames.npy')):
continue
ids = np.load(os.path.join(trial_path, 'analysis', 'ids.npy'))
times = np.load(os.path.join(trial_path, 'times.npy'))
sorter = -1 if trial['win_ID'] != ids[0] else 1
### event times --> BORIS behavior
contact_t_GRID, ag_on_off_t_GRID, led_idx, led_frames = \
load_and_converete_boris_events(trial_path, trial['recording'], sr=20_000)
### communication
got_chirps = False
if os.path.exists(os.path.join(trial_path, 'chirp_times_cnn.npy')):
chirp_t = np.load(os.path.join(trial_path, 'chirp_times_cnn.npy'))
chirp_ids = np.load(os.path.join(trial_path, 'chirp_ids_cnn.npy'))
chirp_times = [chirp_t[chirp_ids == trial['win_ID']], chirp_t[chirp_ids == trial['lose_ID']]]
got_chirps = True
rise_idx = np.load(os.path.join(trial_path, 'analysis', 'rise_idx.npy'))[::sorter]
rise_idx_int = [np.array(rise_idx[i][~np.isnan(rise_idx[i])], dtype=int) for i in range(len(rise_idx))]
rise_times = [times[rise_idx_int[0]], times[rise_idx_int[1]]]
lose_chrips_centered_on_ag_off_t.append(event_centered_times(ag_on_off_t_GRID[:, 1], chirp_times[1]))
kde(np.hstack(lose_chrips_centered_on_ag_off_t))
permulation_kde(np.hstack(lose_chrips_centered_on_ag_off_t))
embed()
quit()
pass
if __name__ == '__main__':
main(sys.argv[1])

View File

@ -1,44 +1,44 @@
,recording,group,win_fish,lose_fish,sex_win,sex_lose,size_win,size_lose,EODf_win,EODf_lose,exp_win,exp_lose,chirps_win,chirps_lose,rises_win,rises_lose,draw
0,2019-11-25-09_59,3,1,2,f,m,13.2,12.0,713.0544113886845,762.0273047058653,1,1,36,2657,22,165,0
1,2019-11-26-10_00,3,4,3,m,m,15.5,17.5,883.141322780704,918.0584506431281,1,1,472,1322,17,481,0
2,2019-11-27-10_00,3,5,6,f,f,14.4,12.65,728.1663791991439,650.6079943890219,1,1,16,2041,14,311,0
3,2019-11-28-09_58,3,1,3,f,m,13.2,17.5,720.9491781126661,888.9029901347602,2,2,370,30,26,37,0
4,2019-11-29-09_59,3,4,2,m,m,15.5,12.0,927.3677808126133,757.8912786740188,2,2,119,1232,56,161,0
5,2019-12-02-10_00,3,3,5,m,f,17.5,14.4,866.5433040990971,719.3596160671729,3,2,2,759,28,165,0
6,2019-12-03-10_01,3,1,6,f,f,13.2,12.65,709.888382193265,645.345316200243,3,2,61,3191,23,230,0
7,2019-12-04-10_00,3,3,2,m,m,17.5,12.0,867.515070390076,732.5567785654214,4,3,2,1005,31,73,0
8,2019-12-06-10_00,3,4,6,m,f,15.5,12.65,912.2881743174412,652.9837532796978,3,3,34,306,58,188,0
9,2019-12-09-10_00,3,5,2,f,m,14.4,12.0,715.5845509704202,726.7506510306094,4,4,446,2345,10,180,0
10,2019-12-10-10_00,3,3,6,m,f,17.5,12.65,853.973867720756,640.9374451096469,5,4,1,205,31,165,0
11,2019-12-11-10_00,3,4,1,m,f,15.5,13.2,909.5564241038855,704.759181051688,4,5,44,260,48,165,0
12,2019-12-12-10_00,3,2,6,m,f,12.0,12.65,708.2029632781753,649.3215729301896,5,5,55,1489,26,152,0
13,2019-12-16-10_00,3,4,5,m,f,15.5,14.4,911.4475182245616,734.3463774893517,5,5,52,963,39,123,0
14,2020-03-13-10_00,4,5,4,f,f,12.5,12.266666666666666,726.3470010966499,705.1654694195288,2,2,54,941,70,177,0
15,2020-03-16-10_00,4,3,1,m,f,11.933333333333332,11.299999999999999,852.2318545355058,642.0347177867645,3,3,1304,724,57,154,0
16,2020-03-18-10_34,4,5,3,f,m,12.5,11.933333333333332,725.8257351336636,863.6524533012707,3,4,16557,2089,339,43,1
17,2020-03-19-10_00,4,1,4,f,f,11.299999999999999,12.266666666666666,659.5490944255365,697.5034008357667,4,4,52,1583,36,197,0
18,2020-03-20-10_00,4,5,2,f,f,12.5,12.266666666666666,,,4,4,45,665,75,76,0
19,2020-03-23-09_58,4,2,1,f,f,12.266666666666666,11.299999999999999,699.4914052830558,654.7533296886725,5,5,84,1158,17,67,1
20,2020-03-24-10_00,4,4,3,f,m,12.266666666666666,11.933333333333332,684.578069899078,854.0458114588357,5,5,883,2,184,86,1
21,2020-03-25-10_00,4,5,1,f,f,12.5,11.299999999999999,733.5001619575638,647.9874053272127,5,6,819,1831,48,70,1
22,2020-03-31-09_59,4,3,2,m,f,11.933333333333332,12.266666666666666,860.5459022492297,692.2978867242133,6,6,10,225,26,50,1
23,2020-05-11-10_00,5,1,2,m,f,12.333333333333334,13.166666666666666,834.369973908149,667.9762847453638,1,1,4,631,25,230,0
24,2020-05-12-10_00,5,5,3,f,m,19.0,10.666666666666666,697.6088902440882,818.2108387976053,1,1,1,117,8,429,0
25,2020-05-13-10_00,5,4,2,m,f,17.5,13.166666666666666,885.2957289220773,681.372424868242,1,2,34,614,22,98,0
26,2020-05-14-10_00,5,5,1,f,m,19.0,12.333333333333334,703.5828000211009,840.457519990521,2,2,83,316,10,232,0
27,2020-05-15-10_00,5,4,3,m,m,17.5,10.666666666666666,875.2647282681933,824.4852744512042,2,2,98,745,27,255,0
28,2020-05-18-10_00,5,2,3,f,m,13.166666666666666,10.666666666666666,677.7516154017525,837.794665426305,3,3,338,530,28,270,0
29,2020-05-19-10_00,5,5,4,f,m,19.0,17.5,699.3246023368515,881.0368775083901,3,3,628,1457,2,256,0
30,2020-05-21-10_00,5,5,2,f,f,19.0,13.166666666666666,702.20947265625,684.967041015625,4,4,86,671,43,257,0
31,2020-05-25-10_00,5,4,1,m,m,17.5,12.333333333333334,880.891870115058,842.1688052017244,4,4,125,165,37,122,0
32,2020-05-27-10_00,6,3,1,f,m,13.5,9.0,686.4001347696975,815.713300982056,1,1,17,92,8,330,0
33,2020-05-28-10_00,6,2,4,m,f,11.0,11.0,774.6150067187118,728.8412253286924,1,1,69,684,84,342,0
34,2020-05-29-10_00,6,5,3,m,f,17.5,13.5,805.4542233630881,681.7640419584177,1,2,373,478,18,58,0
35,2020-06-02-10_00,6,1,4,m,f,9.0,11.0,820.4496652837709,723.7667250846596,2,2,485,1253,69,309,0
36,2020-06-03-10_10,6,5,2,m,m,17.5,11.0,810.7042669363011,783.6640529162586,2,2,54,182,16,74,0
37,2020-06-04-10_00,6,3,4,f,f,13.5,11.0,695.5929553333448,714.6541711375795,3,3,44,994,34,291,0
38,2020-06-05-10_00,6,2,1,m,m,11.0,9.0,804.8998142492978,827.5225072258723,3,3,117,425,41,143,0
39,2020-06-08-10_00,6,5,3,m,f,17.5,13.5,816.1812754102803,691.6736840654672,3,4,1087,170,8,14,1
40,2020-06-09-10_00,6,3,2,f,m,13.5,11.0,691.8529359583595,798.4298849024372,5,4,18,632,21,391,0
41,2020-06-10-10_00,6,5,1,m,m,17.5,9.0,815.498890219021,828.5259822280207,4,4,66,269,1,14,0
42,2020-06-11-10_00,6,5,4,m,f,17.5,11.0,817.6355361855158,730.7609124893474,5,4,144,1100,2,54,0
,recording,group,win_fish,lose_fish,win_ID,lose_ID,sex_win,sex_lose,size_win,size_lose,EODf_win,EODf_lose,exp_win,exp_lose,chirps_win,chirps_lose,rises_win,rises_lose,draw
0,2019-11-25-09_59,3,1,2,10.0,6.0,f,m,13.2,12.0,713.0544113886845,762.0273047058653,1,1,36,2657,22,165,0
1,2019-11-26-10_00,3,4,3,3.0,4.0,m,m,15.5,17.5,883.141322780704,918.0584506431281,1,1,472,1322,17,481,0
2,2019-11-27-10_00,3,5,6,1.0,6.0,f,f,14.4,12.65,728.1663791991439,650.6079943890219,1,1,16,2041,14,311,0
3,2019-11-28-09_58,3,1,3,3.0,1.0,f,m,13.2,17.5,720.9491781126661,888.9029901347602,2,2,370,30,26,37,0
4,2019-11-29-09_59,3,4,2,11.0,0.0,m,m,15.5,12.0,927.3677808126133,757.8912786740188,2,2,119,1232,56,161,0
5,2019-12-02-10_00,3,3,5,3.0,0.0,m,f,17.5,14.4,866.5433040990971,719.3596160671729,3,2,2,759,28,165,0
6,2019-12-03-10_01,3,1,6,3.0,4.0,f,f,13.2,12.65,709.888382193265,645.345316200243,3,2,61,3191,23,230,0
7,2019-12-04-10_00,3,3,2,11.0,8.0,m,m,17.5,12.0,867.515070390076,732.5567785654214,4,3,2,1005,31,73,0
8,2019-12-06-10_00,3,4,6,1.0,2.0,m,f,15.5,12.65,912.2881743174412,652.9837532796978,3,3,34,306,58,188,0
9,2019-12-09-10_00,3,5,2,5.0,9.0,f,m,14.4,12.0,715.5845509704202,726.7506510306094,4,4,446,2345,10,180,0
10,2019-12-10-10_00,3,3,6,3.0,2.0,m,f,17.5,12.65,853.973867720756,640.9374451096469,5,4,1,205,31,165,0
11,2019-12-11-10_00,3,4,1,13.0,1.0,m,f,15.5,13.2,909.5564241038855,704.759181051688,4,5,44,260,48,165,0
12,2019-12-12-10_00,3,2,6,3.0,5.0,m,f,12.0,12.65,708.2029632781753,649.3215729301896,5,5,55,1489,26,152,0
13,2019-12-16-10_00,3,4,5,7.0,1.0,m,f,15.5,14.4,911.4475182245616,734.3463774893517,5,5,52,963,39,123,0
14,2020-03-13-10_00,4,5,4,0.0,1.0,f,f,12.5,12.266666666666666,726.3470010966499,705.1654694195288,2,2,54,941,70,177,0
15,2020-03-16-10_00,4,3,1,3.0,2.0,m,f,11.933333333333332,11.299999999999999,852.2318545355058,642.0347177867645,3,3,1304,724,57,154,0
16,2020-03-18-10_34,4,5,3,0.0,4.0,f,m,12.5,11.933333333333332,725.8257351336636,863.6524533012707,3,4,16557,2089,339,43,1
17,2020-03-19-10_00,4,1,4,0.0,1.0,f,f,11.299999999999999,12.266666666666666,659.5490944255365,697.5034008357667,4,4,52,1583,36,197,0
18,2020-03-20-10_00,4,5,2,0.0,1.0,f,f,12.5,12.266666666666666,,,4,4,45,665,75,76,0
19,2020-03-23-09_58,4,2,1,0.0,2.0,f,f,12.266666666666666,11.299999999999999,699.4914052830558,654.7533296886725,5,5,84,1158,17,67,1
20,2020-03-24-10_00,4,4,3,2.0,1.0,f,m,12.266666666666666,11.933333333333332,684.578069899078,854.0458114588357,5,5,883,2,184,86,1
21,2020-03-25-10_00,4,5,1,1.0,0.0,f,f,12.5,11.299999999999999,733.5001619575638,647.9874053272127,5,6,819,1831,48,70,1
22,2020-03-31-09_59,4,3,2,0.0,3.0,m,f,11.933333333333332,12.266666666666666,860.5459022492297,692.2978867242133,6,6,10,225,26,50,1
23,2020-05-11-10_00,5,1,2,3.0,4.0,m,f,12.333333333333334,13.166666666666666,834.369973908149,667.9762847453638,1,1,4,631,25,230,0
24,2020-05-12-10_00,5,5,3,7.0,6.0,f,m,19.0,10.666666666666666,697.6088902440882,818.2108387976053,1,1,1,117,8,429,0
25,2020-05-13-10_00,5,4,2,4.0,7.0,m,f,17.5,13.166666666666666,885.2957289220773,681.372424868242,1,2,34,614,22,98,0
26,2020-05-14-10_00,5,5,1,4.0,5.0,f,m,19.0,12.333333333333334,703.5828000211009,840.457519990521,2,2,83,316,10,232,0
27,2020-05-15-10_00,5,4,3,18.0,19.0,m,m,17.5,10.666666666666666,875.2647282681933,824.4852744512042,2,2,98,745,27,255,0
28,2020-05-18-10_00,5,2,3,3.0,6.0,f,m,13.166666666666666,10.666666666666666,677.7516154017525,837.794665426305,3,3,338,530,28,270,0
29,2020-05-19-10_00,5,5,4,6.0,7.0,f,m,19.0,17.5,699.3246023368515,881.0368775083901,3,3,628,1457,2,256,0
30,2020-05-21-10_00,5,5,2,1434.0,1420.0,f,f,19.0,13.166666666666666,702.20947265625,684.967041015625,4,4,86,671,43,257,0
31,2020-05-25-10_00,5,4,1,30.0,19.0,m,m,17.5,12.333333333333334,880.891870115058,842.1688052017244,4,4,125,165,37,122,0
32,2020-05-27-10_00,6,3,1,10.0,17.0,f,m,13.5,9.0,686.4001347696975,815.713300982056,1,1,17,92,8,330,0
33,2020-05-28-10_00,6,2,4,7.0,12.0,m,f,11.0,11.0,774.6150067187118,728.8412253286924,1,1,69,684,84,342,0
34,2020-05-29-10_00,6,5,3,10.0,12.0,m,f,17.5,13.5,805.4542233630881,681.7640419584177,1,2,373,478,18,58,0
35,2020-06-02-10_00,6,1,4,7.0,8.0,m,f,9.0,11.0,820.4496652837709,723.7667250846596,2,2,485,1253,69,309,0
36,2020-06-03-10_10,6,5,2,14.0,5.0,m,m,17.5,11.0,810.7042669363011,783.6640529162586,2,2,54,182,16,74,0
37,2020-06-04-10_00,6,3,4,6.0,7.0,f,f,13.5,11.0,695.5929553333448,714.6541711375795,3,3,44,994,34,291,0
38,2020-06-05-10_00,6,2,1,10.0,14.0,m,m,11.0,9.0,804.8998142492978,827.5225072258723,3,3,117,425,41,143,0
39,2020-06-08-10_00,6,5,3,4.0,0.0,m,f,17.5,13.5,816.1812754102803,691.6736840654672,3,4,1087,170,8,14,1
40,2020-06-09-10_00,6,3,2,10.0,12.0,f,m,13.5,11.0,691.8529359583595,798.4298849024372,5,4,18,632,21,391,0
41,2020-06-10-10_00,6,5,1,5.0,8.0,m,m,17.5,9.0,815.498890219021,828.5259822280207,4,4,66,269,1,14,0
42,2020-06-11-10_00,6,5,4,10.0,13.0,m,f,17.5,11.0,817.6355361855158,730.7609124893474,5,4,144,1100,2,54,0

1 recording group win_fish lose_fish win_ID lose_ID sex_win sex_lose size_win size_lose EODf_win EODf_lose exp_win exp_lose chirps_win chirps_lose rises_win rises_lose draw
2 0 2019-11-25-09_59 3 1 2 10.0 6.0 f m 13.2 12.0 713.0544113886845 762.0273047058653 1 1 36 2657 22 165 0
3 1 2019-11-26-10_00 3 4 3 3.0 4.0 m m 15.5 17.5 883.141322780704 918.0584506431281 1 1 472 1322 17 481 0
4 2 2019-11-27-10_00 3 5 6 1.0 6.0 f f 14.4 12.65 728.1663791991439 650.6079943890219 1 1 16 2041 14 311 0
5 3 2019-11-28-09_58 3 1 3 3.0 1.0 f m 13.2 17.5 720.9491781126661 888.9029901347602 2 2 370 30 26 37 0
6 4 2019-11-29-09_59 3 4 2 11.0 0.0 m m 15.5 12.0 927.3677808126133 757.8912786740188 2 2 119 1232 56 161 0
7 5 2019-12-02-10_00 3 3 5 3.0 0.0 m f 17.5 14.4 866.5433040990971 719.3596160671729 3 2 2 759 28 165 0
8 6 2019-12-03-10_01 3 1 6 3.0 4.0 f f 13.2 12.65 709.888382193265 645.345316200243 3 2 61 3191 23 230 0
9 7 2019-12-04-10_00 3 3 2 11.0 8.0 m m 17.5 12.0 867.515070390076 732.5567785654214 4 3 2 1005 31 73 0
10 8 2019-12-06-10_00 3 4 6 1.0 2.0 m f 15.5 12.65 912.2881743174412 652.9837532796978 3 3 34 306 58 188 0
11 9 2019-12-09-10_00 3 5 2 5.0 9.0 f m 14.4 12.0 715.5845509704202 726.7506510306094 4 4 446 2345 10 180 0
12 10 2019-12-10-10_00 3 3 6 3.0 2.0 m f 17.5 12.65 853.973867720756 640.9374451096469 5 4 1 205 31 165 0
13 11 2019-12-11-10_00 3 4 1 13.0 1.0 m f 15.5 13.2 909.5564241038855 704.759181051688 4 5 44 260 48 165 0
14 12 2019-12-12-10_00 3 2 6 3.0 5.0 m f 12.0 12.65 708.2029632781753 649.3215729301896 5 5 55 1489 26 152 0
15 13 2019-12-16-10_00 3 4 5 7.0 1.0 m f 15.5 14.4 911.4475182245616 734.3463774893517 5 5 52 963 39 123 0
16 14 2020-03-13-10_00 4 5 4 0.0 1.0 f f 12.5 12.266666666666666 726.3470010966499 705.1654694195288 2 2 54 941 70 177 0
17 15 2020-03-16-10_00 4 3 1 3.0 2.0 m f 11.933333333333332 11.299999999999999 852.2318545355058 642.0347177867645 3 3 1304 724 57 154 0
18 16 2020-03-18-10_34 4 5 3 0.0 4.0 f m 12.5 11.933333333333332 725.8257351336636 863.6524533012707 3 4 16557 2089 339 43 1
19 17 2020-03-19-10_00 4 1 4 0.0 1.0 f f 11.299999999999999 12.266666666666666 659.5490944255365 697.5034008357667 4 4 52 1583 36 197 0
20 18 2020-03-20-10_00 4 5 2 0.0 1.0 f f 12.5 12.266666666666666 4 4 45 665 75 76 0
21 19 2020-03-23-09_58 4 2 1 0.0 2.0 f f 12.266666666666666 11.299999999999999 699.4914052830558 654.7533296886725 5 5 84 1158 17 67 1
22 20 2020-03-24-10_00 4 4 3 2.0 1.0 f m 12.266666666666666 11.933333333333332 684.578069899078 854.0458114588357 5 5 883 2 184 86 1
23 21 2020-03-25-10_00 4 5 1 1.0 0.0 f f 12.5 11.299999999999999 733.5001619575638 647.9874053272127 5 6 819 1831 48 70 1
24 22 2020-03-31-09_59 4 3 2 0.0 3.0 m f 11.933333333333332 12.266666666666666 860.5459022492297 692.2978867242133 6 6 10 225 26 50 1
25 23 2020-05-11-10_00 5 1 2 3.0 4.0 m f 12.333333333333334 13.166666666666666 834.369973908149 667.9762847453638 1 1 4 631 25 230 0
26 24 2020-05-12-10_00 5 5 3 7.0 6.0 f m 19.0 10.666666666666666 697.6088902440882 818.2108387976053 1 1 1 117 8 429 0
27 25 2020-05-13-10_00 5 4 2 4.0 7.0 m f 17.5 13.166666666666666 885.2957289220773 681.372424868242 1 2 34 614 22 98 0
28 26 2020-05-14-10_00 5 5 1 4.0 5.0 f m 19.0 12.333333333333334 703.5828000211009 840.457519990521 2 2 83 316 10 232 0
29 27 2020-05-15-10_00 5 4 3 18.0 19.0 m m 17.5 10.666666666666666 875.2647282681933 824.4852744512042 2 2 98 745 27 255 0
30 28 2020-05-18-10_00 5 2 3 3.0 6.0 f m 13.166666666666666 10.666666666666666 677.7516154017525 837.794665426305 3 3 338 530 28 270 0
31 29 2020-05-19-10_00 5 5 4 6.0 7.0 f m 19.0 17.5 699.3246023368515 881.0368775083901 3 3 628 1457 2 256 0
32 30 2020-05-21-10_00 5 5 2 1434.0 1420.0 f f 19.0 13.166666666666666 702.20947265625 684.967041015625 4 4 86 671 43 257 0
33 31 2020-05-25-10_00 5 4 1 30.0 19.0 m m 17.5 12.333333333333334 880.891870115058 842.1688052017244 4 4 125 165 37 122 0
34 32 2020-05-27-10_00 6 3 1 10.0 17.0 f m 13.5 9.0 686.4001347696975 815.713300982056 1 1 17 92 8 330 0
35 33 2020-05-28-10_00 6 2 4 7.0 12.0 m f 11.0 11.0 774.6150067187118 728.8412253286924 1 1 69 684 84 342 0
36 34 2020-05-29-10_00 6 5 3 10.0 12.0 m f 17.5 13.5 805.4542233630881 681.7640419584177 1 2 373 478 18 58 0
37 35 2020-06-02-10_00 6 1 4 7.0 8.0 m f 9.0 11.0 820.4496652837709 723.7667250846596 2 2 485 1253 69 309 0
38 36 2020-06-03-10_10 6 5 2 14.0 5.0 m m 17.5 11.0 810.7042669363011 783.6640529162586 2 2 54 182 16 74 0
39 37 2020-06-04-10_00 6 3 4 6.0 7.0 f f 13.5 11.0 695.5929553333448 714.6541711375795 3 3 44 994 34 291 0
40 38 2020-06-05-10_00 6 2 1 10.0 14.0 m m 11.0 9.0 804.8998142492978 827.5225072258723 3 3 117 425 41 143 0
41 39 2020-06-08-10_00 6 5 3 4.0 0.0 m f 17.5 13.5 816.1812754102803 691.6736840654672 3 4 1087 170 8 14 1
42 40 2020-06-09-10_00 6 3 2 10.0 12.0 f m 13.5 11.0 691.8529359583595 798.4298849024372 5 4 18 632 21 391 0
43 41 2020-06-10-10_00 6 5 1 5.0 8.0 m m 17.5 9.0 815.498890219021 828.5259822280207 4 4 66 269 1 14 0
44 42 2020-06-11-10_00 6 5 4 10.0 13.0 m f 17.5 11.0 817.6355361855158 730.7609124893474 5 4 144 1100 2 54 0

View File

@ -181,8 +181,10 @@ def plot_beh_conut_vs_experience(trial_summary, beh_key_win='chirps_win', beh_ke
ax.set_xlabel('experience [trials]', fontsize=12)
ax.set_ylabel(ylabel, fontsize=12)
ax.tick_params(labelsize=10)
def main():
beh_per_exp = []
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]