76 lines
2.6 KiB
Python
76 lines
2.6 KiB
Python
from read_chirp_data import *
|
|
#import nix_helpers as nh
|
|
import matplotlib.pyplot as plt
|
|
import numpy as np
|
|
from IPython import embed
|
|
|
|
|
|
|
|
data_dir = "../data"
|
|
dataset = "2018-11-09-ad-invivo-1"
|
|
data = ("2018-11-09-ad-invivo-1", "2018-11-09-ae-invivo-1", "2018-11-09-ag-invivo-1", "2018-11-13-aa-invivo-1", "2018-11-13-ac-invivo-1", "2018-11-13-ad-invivo-1", "2018-11-13-ah-invivo-1", "2018-11-13-ai-invivo-1", "2018-11-13-aj-invivo-1", "2018-11-13-ak-invivo-1", "2018-11-13-al-invivo-1", "2018-11-14-aa-invivo-1", "2018-11-14-ac-invivo-1", "2018-11-14-ad-invivo-1", "2018-11-14-af-invivo-1", "2018-11-14-ag-invivo-1", "2018-11-14-ah-invivo-1", "2018-11-14-ai-invivo-1", "2018-11-14-ak-invivo-1", "2018-11-14-al-invivo-1", "2018-11-14-am-invivo-1", "2018-11-14-an-invivo-1")
|
|
|
|
|
|
|
|
#for dataset in data:
|
|
eod = read_chirp_eod(os.path.join(data_dir, dataset))
|
|
times = read_chirp_times(os.path.join(data_dir, dataset))
|
|
|
|
|
|
|
|
df_map = {} #Keys werden nach df sortiert ausgegeben
|
|
for k in eod.keys():
|
|
df = k[1]
|
|
ch = k[3]
|
|
if df in df_map.keys():
|
|
df_map[df].append(k)
|
|
else:
|
|
df_map[df] = [k]
|
|
|
|
print(ch) #die Chirphöhe wird ausgegeben, um zu bestimmen, ob Chirps oder Chirps large benutzt wurde
|
|
|
|
|
|
|
|
#die äußere Schleife geht für alle Keys durch und somit durch alle dfs
|
|
#die innnere Schleife bildet die 16 Wiederholungen einer Frequenz in 4 Subplots ab
|
|
for idx in df_map.keys():
|
|
freq = list(df_map[idx])
|
|
fig,axs = plt.subplots(2, 2, sharex = True, sharey = True)
|
|
|
|
for idx, k in enumerate(freq):
|
|
ct = times[k]
|
|
e1 = eod[k]
|
|
zeit = e1[0]
|
|
eods = e1[1]
|
|
|
|
if idx <= 3:
|
|
axs[0, 0].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
|
axs[0, 0].scatter(np.asarray(ct), np.ones(len(ct))*3, color = 'green', s= 22)
|
|
elif 4<= idx <= 7:
|
|
axs[0, 1].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
|
axs[0, 1].scatter(np.asarray(ct), np.ones(len(ct))*3, color = 'green', s= 22)
|
|
elif 8<= idx <= 11:
|
|
axs[1, 0].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
|
axs[1, 0].scatter(np.asarray(ct), np.ones(len(ct))*3, color = 'green', s= 22)
|
|
else:
|
|
axs[1, 1].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
|
axs[1, 1].scatter(np.asarray(ct), np.ones(len(ct))*3, color = 'green', s= 22)
|
|
|
|
|
|
fig.suptitle('EOD for chirps', fontsize = 16)
|
|
plt.show()
|
|
|
|
|
|
|
|
#Problem: axs hat keine label-Funktion, also müsste axes nochmal definiert werden. Momentan erscheint Schrift nur auf einem der Subplots
|
|
|
|
#ax = plt.gca()
|
|
#ax.set_ylabel('Time [ms]')
|
|
#ax.set_xlabel('Amplitude [mV]')
|
|
#ax.label_outer()
|
|
|
|
|
|
|
|
|
|
#next Step: relative Amplitudenmodulation berechnen, Max und Min der Amplitude bestimmen, EOD und Chirps zuordnen, Unterschied berechnen
|