From d77d377849b65effc29e550f25a9107463c2120b Mon Sep 17 00:00:00 2001 From: Ramona Date: Thu, 29 Nov 2018 09:48:12 +0100 Subject: [PATCH] histogram --- code/plot_eodform_spikehist.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/code/plot_eodform_spikehist.py b/code/plot_eodform_spikehist.py index ac4462f..8452399 100644 --- a/code/plot_eodform_spikehist.py +++ b/code/plot_eodform_spikehist.py @@ -7,14 +7,13 @@ 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 eod_norm = eod - np.mean(eod) # calculate eod times and indices by zero crossings @@ -22,20 +21,15 @@ 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] #time in s - -eod_duration = eod_times[2]- eod_times[1] - - -======= ->>>>>>> 5cd62554fa5af12a6a50661f0a60cd2b0457e702 # 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)