From 3bcc6b72ad6b7de6127e1bbe9c0725705daafc7a Mon Sep 17 00:00:00 2001 From: Carolin Sachgau Date: Tue, 20 Nov 2018 17:21:48 +0100 Subject: [PATCH] changed for multiple repros --- open_nixio_new.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/open_nixio_new.py b/open_nixio_new.py index 36acc73..cd20805 100644 --- a/open_nixio_new.py +++ b/open_nixio_new.py @@ -18,23 +18,25 @@ for feat in mt.features: feature_dict.update({feat.data.name[16:]: mt.features[feat.data.name].data[:]}) tags = b.tags +intervals_dict = defaultdict(list) + for tag in tags: if tag.name.startswith('Baseline'): continue + curr_comb = tag.metadata["RePro-Info"]["settings"]["object"] repro_pos, = tag.position repro_ext, = tag.extent - - tag_idx = np.where(np.logical_and(repro_pos < comb_pos, comb_pos < (repro_pos+repro_ext))) - embed() - quit() - tag_idx_pos = comb_pos[np.logical_and(repro_pos < comb_pos, comb_pos < (repro_pos + repro_ext))] - - -intervals_dict = defaultdict(list) -for idx, position in enumerate(comb_pos): - if idx == (len(comb_pos)-1): - break - curr_speed = feature_dict['speed'][idx] - curr_pos = comb_pos[idx] - curr_dir = feature_dict['direction'][idx] - curr_spikes = spikes[(spikes < comb_pos[idx + 1]) & (spikes > comb_pos[idx])] + idx_qry = np.logical_and(repro_pos < comb_pos, comb_pos < (repro_pos + repro_ext)) + tag_idx = np.flatnonzero(idx_qry) + tag_pos = comb_pos[idx_qry] + + for idx, position in zip(tag_idx, tag_pos): + if idx == (len(comb_pos)-1): + break + curr_speed = feature_dict['speed'][idx] + curr_pos = comb_pos[idx] + curr_dir = feature_dict['direction'][idx] + curr_spikes = spikes[(spikes < comb_pos[idx + 1]) & (spikes > comb_pos[idx])] + intervals_dict.update({(tag.name, curr_speed, curr_dir, curr_pos, curr_comb): curr_spikes}) +embed() +quit() \ No newline at end of file