From 13ac3e1a6e9136bb70890e317503d654233cd374 Mon Sep 17 00:00:00 2001 From: efish Date: Thu, 29 Nov 2018 16:40:52 +0100 Subject: [PATCH] buh --- code/eod_freq_beat.py | 15 ++++++++++----- code/stimulus_chirp.py | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/code/eod_freq_beat.py b/code/eod_freq_beat.py index 31f6be1..04ed6e7 100644 --- a/code/eod_freq_beat.py +++ b/code/eod_freq_beat.py @@ -2,6 +2,7 @@ from read_baseline_data import * from IPython import embed import matplotlib.pyplot as plt import numpy as np +import thunderfish.peakdetection as pd from IPython import embed ## beat @@ -12,17 +13,21 @@ inch_factor = 2.54 time, eod = read_baseline_eod(os.path.join(data_dir, dataset)) eod_norm = eod - np.mean(eod) -eod_norm = eod_norm[1000:2000] +eod_norm = eod_norm[10000:20000] x = np.arange(0., len(eod_norm)) -y = np.sin(x*2*np.pi*550) + +y = np.sin(time[10000:20000]*2*np.pi*600)*0.5 ampl = eod_norm + y +p, t = pd.detect_peaks(ampl, 0.1) time_axis = np.arange(len(ampl)) fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor)) -plt.plot(time_axis, ampl) +plt.plot(time[10000:20000], ampl) +plt.plot(time[10000:20000][p], ampl[p], lw=2, color='k') +plt.plot(time[10000:20000][t], ampl[t], lw=2, color='k') ax.set_xlabel("time [ms]", fontsize = 22) plt.xticks(fontsize = 18) ax.set_ylabel("eod amplitude [mV]", fontsize = 22) @@ -31,8 +36,8 @@ ax.spines["top"].set_visible(False) ax.spines["right"].set_visible(False) fig.tight_layout() -#plt.show() -plt.savefig('beat.png') +plt.show() +#plt.savefig('beat.png') diff --git a/code/stimulus_chirp.py b/code/stimulus_chirp.py index cf56727..0e01894 100644 --- a/code/stimulus_chirp.py +++ b/code/stimulus_chirp.py @@ -53,5 +53,5 @@ ax2.yaxis.set_label_coords(-0.1, 0.5) plt.xticks(fontsize=18) plt.yticks(fontsize=18) fig.tight_layout() -#plt.show() -plt.savefig('stimulus_chirp.png') +plt.show() +#plt.savefig('stimulus_chirp.png')