This commit is contained in:
efish 2018-11-21 10:01:05 +01:00
parent 1daf5c244e
commit 9d971b44e5
2 changed files with 72 additions and 16 deletions

View File

@ -1,5 +1,5 @@
from read_chirp_data import *
#import nix_helpers as nh
import nix_helpers as nh
import matplotlib.pyplot as plt
import numpy as np
from IPython import embed
@ -27,14 +27,14 @@ for k in eod.keys():
else:
df_map[df] = [k]
print(ch) #die Chirphöhe wird ausgegeben, um zu bestimmen, ob Chirps oder Chirps large benutzt wurde
#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])
for i in df_map.keys():
freq = list(df_map[i])
fig,axs = plt.subplots(2, 2, sharex = True, sharey = True)
for idx, k in enumerate(freq):
@ -58,18 +58,44 @@ for idx in df_map.keys():
fig.suptitle('EOD for chirps', fontsize = 16)
plt.show()
axs[0,0].set_ylabel('Amplitude [mV]')
axs[0,1].set_xlabel('Amplitude [mV]')
axs[1,0].set_xlabel('Time [ms]')
axs[1,1].set_xlabel('Time [ms]')
#axs kann nur einzelne Label erzeugen, nicht generell möglich wie beim Titel
#Problem: axs hat keine label-Funktion, also müsste axes nochmal definiert werden. Momentan erscheint Schrift nur auf einem der Subplots
for i in df_map.keys():
freq = list(df_map[i])
#ax = plt.gca()
#ax.set_ylabel('Time [ms]')
#ax.set_xlabel('Amplitude [mV]')
#ax.label_outer()
ct = times[freq[1]]
ct1 = ct[1]
e1 = eod[k]
zeit = np.asarray(e1[0])
ampl = np.asarray(e1[1])
time_cut = zeit[(zeit > ct1-25) & (zeit < ct1+25)]
eod_cut = ampl[(zeit > ct1-25) & (zeit < ct1+25)]
change = ampl[int(ct1)]
plt.figure(12)
plt.plot(time_cut, eod_cut)
plt.scatter(ct1, 3, color = 'green', s= 30)
plt.title('Chirp reaction Ampl.')
plt.xlabel('Time [ms]')
plt.ylabel('Amplitude[mV]')
#plt.show()
#4. Chirps einer Phase zuordnen - zusammen plotten?
#next Step: EOD-Amplitudenmodulation für beat aber OHNE Chirps plotten
#allerdings: in der Aufnahme sind nur kurze Zeitfenster ohne Chirps zu finden!
#next Step: relative Amplitudenmodulation berechnen, Max und Min der Amplitude bestimmen, EOD und Chirps zuordnen, Unterschied berechnen

View File

@ -1,16 +1,18 @@
from read_baseline_data import *
#import nix_helpers as nh
from read_chirp_data import *
import nix_helpers as nh
import matplotlib.pyplot as plt
import numpy as np
from IPython import embed #Funktionen importieren
data_dir = "../data"
dataset = "2018-11-09-aa-invivo-1"
dataset = "2018-11-09-ad-invivo-1"
#data = ("2018-11-09-aa-invivo-1", "2018-11-09-ab-invivo-1", "2018-11-09-ac-invivo-1", "2018-11-09-ad-invivo-1", "2018-11-13-aa-invivo-1", "2018-11-13-ab-invivo-1", "2018-11-13-ad-invivo-1", "2018-11-09-af-invivo-1", "2018-11-09-ag-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-ab-invivo-1", "2018-11-14-ac-invivo-1", "2018-11-14-ad-invivo-1", "2018-11-14-ae-invivo-1", "2018-11-14-af-invivo-1", "2018-11-14-ag-invivo-1", "2018-11-14-aa-invivo-1", "2018-11-14-aj-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")
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
#spike_frequency = len(spike_times) / spike_times[-1]
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
#inst_frequency = 1. / np.diff(spike_times)
spike_rate = np.diff(spike_times)
@ -21,7 +23,6 @@ plt.hist(spike_rate,x)
mu = np.mean(spike_rate)
sigma = np.std(spike_rate)
cv = sigma/mu
print(cv)
plt.title('A.lepto ISI Histogramm', fontsize = 14)
plt.xlabel('duration ISI[ms]', fontsize = 12)
@ -32,3 +33,32 @@ plt.yticks(fontsize = 12)
plt.show()
#Nyquist-Theorem Plot:
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
df_map = {}
#Keys werden nach df sortiert ausgegeben
for k in chirp_spikes.keys():
df = k[1]
ch = k[3]
if df in df_map.keys():
df_map[df].append(k)
else:
df_map[df] = [k]
for i in df_map.keys():
freq = list(df_map[i])
for k in freq:
spikes = chirp_spikes[k]
trial = spikes[1]
print(trial)
#
# plt.plot(spikes, rate)
# plt.show()