Merge branch 'master' of https://whale.am28.uni-tuebingen.de/git/jgrewe/gp_neurobio
This commit is contained in:
commit
12748df4f0
@ -42,33 +42,28 @@ for deltaf in df_map.keys():
|
||||
binary_spikes = np.isin(cut_range, spikes_idx)*1
|
||||
|
||||
if phase_vec[idx] in df_phase_time[deltaf].keys():
|
||||
df_phase_time[deltaf][phase_vec[idx]].append(spikes[rep][phase])
|
||||
df_phase_time[deltaf][phase_vec[idx]].append(spikes_cut)
|
||||
df_phase_binary[deltaf][phase_vec[idx]] = np.vstack((df_phase_binary[deltaf][phase_vec[idx]], binary_spikes))
|
||||
else:
|
||||
df_phase_time[deltaf][phase_vec[idx]] = [spikes[rep][phase]]
|
||||
df_phase_time[deltaf][phase_vec[idx]] = [spikes_cut]
|
||||
df_phase_binary[deltaf][phase_vec[idx]] = binary_spikes
|
||||
|
||||
|
||||
plot_trials = df_phase_binary['-50Hz'][0.0]
|
||||
#hist_data = plt.hist(plot_trials)
|
||||
#ax.plot(hist_data[1][:-1], hist_data[0])
|
||||
|
||||
plot_trials = df_phase_time['-50Hz'][0.0]
|
||||
plot_trials_binary = np.mean(df_phase_binary['-50Hz'][0.0], axis=0)
|
||||
|
||||
window = 100
|
||||
smoothed_spikes = smooth(plot_trials_binary, window)
|
||||
time_axis = np.arange(-50, 50, 1/sampling_rate)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
for i, trial in enumerate(plot_trials):
|
||||
embed()
|
||||
exit()
|
||||
trial[trial == 0] = np.nan
|
||||
ax.scatter(np.ones(len(trial)), trial, marker='|', color='k', size=12)
|
||||
ax.scatter(trial, np.ones(len(trial))+i, marker='|', color='k')
|
||||
ax.plot(time_axis, smoothed_spikes)
|
||||
plt.show()
|
||||
|
||||
|
||||
#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)
|
||||
|
||||
|
@ -23,6 +23,16 @@ def gaussian(x, mu, sig):
|
||||
y = np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.)))
|
||||
return y
|
||||
|
||||
|
||||
def smooth(data, window):
|
||||
mu = 1
|
||||
sigma = window
|
||||
time_gauss = np.arange(-4 * sigma, 4 * sigma, 1)
|
||||
gauss = gaussian(time_gauss, mu, sigma)
|
||||
smoothed_data = np.convolve(data, gauss, 'same')
|
||||
return smoothed_data
|
||||
|
||||
|
||||
def map_keys(input):
|
||||
df_map = {}
|
||||
for k in input.keys():
|
||||
|
Loading…
Reference in New Issue
Block a user