This commit is contained in:
efish 2018-11-29 09:49:10 +01:00
commit d83383a4f7
2 changed files with 13 additions and 5 deletions

View File

@ -7,14 +7,18 @@ from IPython import embed
# plot and data values
inch_factor = 2.54
sampling_rate = 40000
data_dir = '../data'
#dataset = '2018-11-09-ad-invivo-1'
dataset = '2018-11-13-aa-invivo-1'
dataset = '2018-11-09-ad-invivo-1'
#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
=======
>>>>>>> d77d377849b65effc29e550f25a9107463c2120b
eod_norm = eod - np.mean(eod)
# calculate eod times and indices by zero crossings
@ -22,18 +26,22 @@ threshold = 0
shift_eod = np.roll(eod_norm, 1)
eod_times = time[(eod_norm >= threshold) & (shift_eod < threshold)]*40000
eod_duration = eod_times[2]- eod_times[1] #time in s
<<<<<<< HEAD
eod_duration = eod_times[2]- eod_times[1]
=======
>>>>>>> d77d377849b65effc29e550f25a9107463c2120b
# read spikes during baseline activity
spikes = read_baseline_spikes(os.path.join(data_dir, dataset))
spikes = read_baseline_spikes(os.path.join(data_dir, dataset)) #spikes in s
# calculate interpike intervals and plot them
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.hist(interspikeintervals, bins=np.arange(0, np.max(interspikeintervals), 0.1), color='royalblue')
plt.xlabel("eod cycles", fontsize = 22)
plt.xticks(fontsize = 18)
plt.ylabel("number of \n interspikeintervals", fontsize = 22)

View File

@ -35,7 +35,7 @@ for k, t in enumerate(time):
p += f * stepsize
signal[k] = a * np.sin(6.28318530717959 * p)
fig = plt.figure(figsize = (20/inch_factor, 15/inch_factor))
fig = plt.figure(figsize = (20/inch_factor, 12/inch_factor))
ax1 = fig.add_subplot(211)
plt.yticks(fontsize=18)
ax2 = fig.add_subplot(212, sharex=ax1)