Merge branch 'master' of https://whale.am28.uni-tuebingen.de/git/jgrewe/gp_neurobio
This commit is contained in:
commit
9f80891616
@ -14,14 +14,29 @@ dataset = '2018-11-13-aa-invivo-1'
|
||||
# read eod and time of baseline
|
||||
time, eod = read_baseline_eod(os.path.join(data_dir, dataset))
|
||||
|
||||
<<<<<<< HEAD
|
||||
eod_norm = eod - np.mean(eod)
|
||||
|
||||
# calculate eod times and indices by zero crossings
|
||||
threshold = 0
|
||||
shift_eod = np.roll(eod_norm, 1)
|
||||
eod_times = time[(eod_norm >= threshold) & (shift_eod < threshold)]
|
||||
|
||||
|
||||
|
||||
eod_duration = eod_times[2]- eod_times[1]
|
||||
|
||||
|
||||
=======
|
||||
>>>>>>> 5cd62554fa5af12a6a50661f0a60cd2b0457e702
|
||||
# read spikes during baseline activity
|
||||
spikes = read_baseline_spikes(os.path.join(data_dir, dataset))
|
||||
# calculate interpike intervals and plot them
|
||||
interspikeintervals = np.diff(spikes)
|
||||
interspikeintervals = np.diff(spikes)/eod_duration
|
||||
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
plt.hist(interspikeintervals, bins=np.arange(0, np.max(interspikeintervals), 0.0001), color='royalblue')
|
||||
plt.xlabel("time [ms]", fontsize = 22)
|
||||
plt.xlabel("eod cycles", fontsize = 22)
|
||||
plt.xticks(fontsize = 18)
|
||||
plt.ylabel("number of \n interspikeintervals", fontsize = 22)
|
||||
plt.yticks(fontsize = 18)
|
||||
|
@ -54,16 +54,17 @@ for deltaf in df_map.keys():
|
||||
# get spikes between 60 ms before and after the chirp
|
||||
spikes_to_cut = np.asarray(spikes[rep][phase])
|
||||
spikes_cut = spikes_to_cut[(spikes_to_cut > -cut_window) & (spikes_to_cut < cut_window)]
|
||||
spikes_raster = spikes_to_cut[(spikes_to_cut > -cut_window+5) & (spikes_to_cut < cut_window-5)]
|
||||
spikes_idx = np.round(spikes_cut*sampling_rate)
|
||||
# also save as binary, 0 no spike, 1 spike
|
||||
binary_spikes = np.isin(cut_range, spikes_idx)*1
|
||||
|
||||
# add the spikes to the dictionaries with the correct df and phase
|
||||
if idx in df_phase_time[deltaf].keys():
|
||||
df_phase_time[deltaf][idx].append(spikes_cut)
|
||||
df_phase_time[deltaf][idx].append(spikes_raster)
|
||||
df_phase_binary[deltaf][idx] = np.vstack((df_phase_binary[deltaf][idx], binary_spikes))
|
||||
else:
|
||||
df_phase_time[deltaf][idx] = [spikes_cut]
|
||||
df_phase_time[deltaf][idx] = [spikes_raster]
|
||||
df_phase_binary[deltaf][idx] = binary_spikes
|
||||
|
||||
|
||||
@ -80,15 +81,13 @@ for df in df_phase_time.keys():
|
||||
|
||||
smoothed_spikes = smooth(plot_trials_binary, window, 1./sampling_rate)
|
||||
|
||||
fig, ax = plt.subplots(2, 1, sharex=True, figsize=(20/inch_factor, 15/inch_factor))
|
||||
fig, ax = plt.subplots(2, 1, sharex=True, figsize=(18/inch_factor, 13/inch_factor))
|
||||
for i, trial in enumerate(plot_trials):
|
||||
ax[0].scatter(trial, np.ones(len(trial))+i, marker='|', color='k')
|
||||
|
||||
ax[1].plot(time_axis, smoothed_spikes*1000, color='royalblue', lw = 2)
|
||||
ax[1].plot(time_axis[0+5*sampling_rate:-5*sampling_rate], smoothed_spikes[0+5*sampling_rate:-5*sampling_rate]*1000, color='royalblue', lw = 2)
|
||||
|
||||
|
||||
|
||||
ax[0].set_title('df = %s Hz' %(df))
|
||||
ax[0].set_title('df = %s Hz' %(df), fontsize = 18)
|
||||
ax[0].set_ylabel('repetition', fontsize=22)
|
||||
ax[0].yaxis.set_label_coords(-0.1, 0.5)
|
||||
ax[0].set_yticks(np.arange(1, len(plot_trials)+1,2))
|
||||
|
Loading…
Reference in New Issue
Block a user