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 = df_phase_time['-50Hz'][0.0]
|
||||||
plot_trials_binary = np.mean(df_phase_binary['-50Hz'][0.0], axis=0)
|
plot_trials_binary = np.mean(df_phase_binary['-50Hz'][0.0], axis=0)
|
||||||
|
|
||||||
mu = 1
|
window = 100
|
||||||
sigma = 100
|
smoothed_spikes = smooth(plot_trials_binary, window)
|
||||||
time_gauss = np.arange(-4*sigma, 4*sigma, 1)
|
|
||||||
gauss = gaussian(time_gauss, mu, sigma)
|
|
||||||
smoothed_spikes = np.convolve(plot_trials_binary, gauss, 'same')
|
|
||||||
time_axis = np.arange(-50, 50, 1/sampling_rate)
|
time_axis = np.arange(-50, 50, 1/sampling_rate)
|
||||||
|
|
||||||
fig, ax = plt.subplots()
|
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.)))
|
y = np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.)))
|
||||||
return y
|
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):
|
def map_keys(input):
|
||||||
df_map = {}
|
df_map = {}
|
||||||
for k in input.keys():
|
for k in input.keys():
|
||||||
|
Loading…
Reference in New Issue
Block a user