From 7c9aa5eb9270d2d41cb861252cf0fae525e4fd73 Mon Sep 17 00:00:00 2001 From: Ramona Date: Fri, 16 Nov 2018 17:17:34 +0100 Subject: [PATCH] still fix smoothing --- code/spikes_analysis.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/code/spikes_analysis.py b/code/spikes_analysis.py index d0b1867..5ae3da4 100644 --- a/code/spikes_analysis.py +++ b/code/spikes_analysis.py @@ -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]) \ No newline at end of file