changed for multiple repros
This commit is contained in:
parent
01320b8458
commit
1ab2daa258
@ -22,7 +22,6 @@ def open_nixio(nix_file, avg_opt):
|
|||||||
feature_dict = {}
|
feature_dict = {}
|
||||||
for feat in mt.features:
|
for feat in mt.features:
|
||||||
feature_dict.update({feat.data.name[16:]: mt.features[feat.data.name].data[:]})
|
feature_dict.update({feat.data.name[16:]: mt.features[feat.data.name].data[:]})
|
||||||
|
|
||||||
# Spike data in intervals of comb position + speed
|
# Spike data in intervals of comb position + speed
|
||||||
intervals_dict = defaultdict(list)
|
intervals_dict = defaultdict(list)
|
||||||
for idx, position in enumerate(comb_pos):
|
for idx, position in enumerate(comb_pos):
|
||||||
@ -40,5 +39,6 @@ def open_nixio(nix_file, avg_opt):
|
|||||||
|
|
||||||
# Spike data at baseline
|
# Spike data at baseline
|
||||||
# comb_baseline = spikes[(spikes < comb_pos[0])]
|
# comb_baseline = spikes[(spikes < comb_pos[0])]
|
||||||
|
embed()
|
||||||
|
quit()
|
||||||
return curr_comb, intervals_dict
|
return curr_comb, intervals_dict
|
||||||
|
40
open_nixio_new.py
Normal file
40
open_nixio_new.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import nixio as nix
|
||||||
|
from IPython import embed
|
||||||
|
from collections import defaultdict
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
nix_file = '/home/sachgau/Documents/combproject/comb_data/2018-11-16-ag/2018-11-16-ag.nix'
|
||||||
|
|
||||||
|
|
||||||
|
f = nix.File.open(nix_file, nix.FileMode.ReadOnly)
|
||||||
|
b = f.blocks[0] # first block
|
||||||
|
mt = b.multi_tags['moving object-1']
|
||||||
|
comb_pos = mt.positions[:]
|
||||||
|
comb_ext = np.array(mt.extents[:])
|
||||||
|
spikes = b.data_arrays["Spikes-1"][:]
|
||||||
|
|
||||||
|
feature_dict = {}
|
||||||
|
for feat in mt.features:
|
||||||
|
feature_dict.update({feat.data.name[16:]: mt.features[feat.data.name].data[:]})
|
||||||
|
|
||||||
|
tags = b.tags
|
||||||
|
for tag in tags:
|
||||||
|
if tag.name.startswith('Baseline'):
|
||||||
|
continue
|
||||||
|
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])]
|
@ -31,10 +31,10 @@ cell_name = sys.argv[1].split('/')[-2]
|
|||||||
|
|
||||||
curr_comb, intervals_dict = open_nixio(sys.argv[1], sys.argv[2])
|
curr_comb, intervals_dict = open_nixio(sys.argv[1], sys.argv[2])
|
||||||
|
|
||||||
spike_repeats = []
|
|
||||||
for (speed, direct, comb) in intervals_dict:
|
for (speed, direct, comb) in intervals_dict:
|
||||||
s_trials = intervals_dict[(speed, direct, comb)]
|
s_trials = intervals_dict[(speed, direct, comb)]
|
||||||
|
spike_repeats = []
|
||||||
for trial in intervals_dict[(speed, direct, comb)]:
|
for trial in intervals_dict[(speed, direct, comb)]:
|
||||||
spike_train = trial[1]
|
spike_train = trial[1]
|
||||||
spike_train = spike_train - spike_train[0] # changing spike train to start at 0 (subtracting baseline)
|
spike_train = spike_train - spike_train[0] # changing spike train to start at 0 (subtracting baseline)
|
||||||
@ -46,3 +46,4 @@ for (speed, direct, comb) in intervals_dict:
|
|||||||
ax.set_xlabel('Time (s)')
|
ax.set_xlabel('Time (s)')
|
||||||
ax.set_ylabel('Trials')
|
ax.set_ylabel('Trials')
|
||||||
plt.show()
|
plt.show()
|
||||||
|
plt.close
|
Loading…
Reference in New Issue
Block a user