smoothing function
This commit is contained in:
parent
c713cbc1ff
commit
15e7fbc51f
@ -53,11 +53,8 @@ for deltaf in df_map.keys():
|
||||
plot_trials = df_phase_time['-50Hz'][0.0]
|
||||
plot_trials_binary = np.mean(df_phase_binary['-50Hz'][0.0], axis=0)
|
||||
|
||||
mu = 1
|
||||
sigma = 100
|
||||
time_gauss = np.arange(-4*sigma, 4*sigma, 1)
|
||||
gauss = gaussian(time_gauss, mu, sigma)
|
||||
smoothed_spikes = np.convolve(plot_trials_binary, gauss, 'same')
|
||||
window = 100
|
||||
smoothed_spikes = smooth(plot_trials_binary, window)
|
||||
time_axis = np.arange(-50, 50, 1/sampling_rate)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
@ -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