This commit is contained in:
efish 2018-11-29 16:40:52 +01:00
parent 5875657ca9
commit 13ac3e1a6e
2 changed files with 12 additions and 7 deletions

View File

@ -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')

View File

@ -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')