still fix smoothing

This commit is contained in:
Ramona 2018-11-16 17:17:34 +01:00
parent 9952a13bf9
commit 7c9aa5eb92

View File

@ -1,6 +1,7 @@
import matplotlib.pyplot as plt
import numpy as np
from read_chirp_data import *
from utility import *
from IPython import embed
data_dir = "../data"
@ -18,6 +19,7 @@ for k in spikes.keys():
else:
df_map[df] = [k]
# make phases together, 12 phases
spikes_mat = {}
for deltaf in df_map.keys():
for rep in df_map[deltaf]:
@ -27,15 +29,23 @@ for deltaf in df_map.keys():
if deltaf == '-50Hz' and phase == (9, 0.54):
spikes_mat[deltaf, rep, phase] = spikes_one_chirp
#embed()
#exit()
plot_spikes = spikes[(0, '-50Hz', '20%', '100Hz')][(0, 0.789)]
#hist_data = plt.hist(plot_spikes, bins=np.arange(-200, 400, 20))
mu = 1
sigma = 1
time_gauss = np.arange(-4, 4, 1)
gauss = gaussian(time_gauss, mu, sigma)
# spikes during time vec (00010000001)?
smoothed_spikes = np.convolve(plot_spikes, gauss, 'same')
window = np.mean(np.diff(plot_spikes))
time_vec = np.arange(plot_spikes[0], plot_spikes[-1]+window, window)
fig, ax = plt.subplots()
ax.scatter(plot_spikes, np.ones(len(plot_spikes))*10, marker='|', color='k')
#ax.plot(hist_data[1][:-1], hist_data[0])
ax.plot(time_vec, smoothed_spikes)
plt.show()
#embed()
#exit()
#hist_data = plt.hist(plot_spikes, bins=np.arange(-200, 400, 20))
#ax.plot(hist_data[1][:-1], hist_data[0])