forked from jgrewe/fishbook
[reproclasses/FICurve] buffer spike times when reading from nix ...
fix spike indices during rate calculation
This commit is contained in:
parent
fe2457d85f
commit
2c4f3afa56
@ -440,9 +440,8 @@ class FIData:
|
||||
end_index_eod = eod_da.dimensions[0].index_of(end_time)
|
||||
|
||||
local_eod = eod_da[start_index_eod:end_index_eod]
|
||||
spikes = spikes_da[start_index_spikes:end_index_spikes] - start_time
|
||||
time = np.asarray(eod_da.dimensions[0].axis(len(local_eod))) - delay
|
||||
|
||||
spikes = self.__all_spikes[(self.__all_spikes >= start_time) & (self.__all_spikes < end_time)] - start_time - delay
|
||||
time = np.asarray(eod_da.dimensions[0].axis(end_index_eod - start_index_eod)) - delay
|
||||
return spikes, local_eod, time, contrast
|
||||
|
||||
def __read_spikes_from_nix(self, repro: RePro):
|
||||
@ -459,6 +458,7 @@ class FIData:
|
||||
return self.__read_spikes_from_directory(repro)
|
||||
f = nix.File.open(data_source, nix.FileMode.ReadOnly)
|
||||
b = f.blocks[0]
|
||||
self.__all_spikes = b.data_arrays["Spikes-1"][:]
|
||||
mt = None
|
||||
for i in tqdm(range(len(stimuli)), desc="Loading data"):
|
||||
s = stimuli[i]
|
||||
@ -594,7 +594,7 @@ class FIData:
|
||||
dt = np.mean(np.diff(t))
|
||||
sp = self.spikes(index)
|
||||
binary = np.zeros(t.shape)
|
||||
spike_indices = (sp / dt).astype(int)
|
||||
spike_indices = ((sp - t[0]) / dt).astype(int)
|
||||
binary[spike_indices[(spike_indices >= 0) & (spike_indices < len(binary))]] = 1
|
||||
g = gaussian_kernel(kernel_width, dt)
|
||||
rate = np.convolve(binary, g, mode='same')
|
||||
|
Loading…
Reference in New Issue
Block a user