vector_phase.py

This commit is contained in:
efish 2018-11-15 10:14:32 +01:00
parent c3c95e8c98
commit 74b523eba1
3 changed files with 15 additions and 1 deletions

View File

@ -52,5 +52,9 @@ for i, idx in enumerate(eod_idx):
#embed()
#exit()
plt.plot(time[int(idx):int(eod_idx[i+1])], eod[int(idx):int(eod_idx[i+1])])
plt.show()

View File

View File

@ -5,4 +5,14 @@ def zero_crossing(eod,time):
threshold = 0;
shift_eod = np.roll(eod, 1)
eod_times = time[(eod >= threshold) & (shift_eod < threshold)]
return eod_times
sampling_rate = 40000.0
eod_idx = eod_times*sampling_rate
return eod_idx
def vector_strength(spike_times, eod_durations)
alphas = spike_times/ eod_durations
cs = (1/len(spike_times))*np.sum(np.cos(alphas))^2
sn = (1/len(spike_times))*np.sum(np.sin(alphas))^2
vs = np.sprt(cs+sn)
return vs