Commit 1b5c1266 authored by alessio.quaresima's avatar alessio.quaresima
Browse files

unify frequencies

parent b6fc835a
...@@ -267,5 +267,31 @@ module SpikeTimit ...@@ -267,5 +267,31 @@ module SpikeTimit
return spikes, interval[end] - interval[1] return spikes, interval[end] - interval[1]
end end
"""
Unify frequencies bin
Input: spiketimes array with 620 elements
Return array with sorted spikes in less classes
"""
function resample_spikes(;spike_times, n_feat=7)
FREQUENCIES = 20
old_bins = length(spike_times)÷FREQUENCIES
new_bins = 31÷n_feat+1
new_spikes = map(x->Vector{Float64}(),1:new_bins*FREQUENCIES)
for freq in 1:FREQUENCIES
old_freq = (freq-1)*old_bins
new_freq = (freq-1)*new_bins
for new_bin in 1:new_bins
last_bin = new_bin*n_feat <32 ? new_bin*n_feat : 31
bins = 1+(new_bin-1)*n_feat : last_bin
for old_bin in bins
push!(new_spikes[new_bin+new_freq], spike[old_bin+old_freq]...)
end
end
end
return sort!.(new_spikes)
end
end end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment