end
This commit is contained in:
parent
fd142297da
commit
bc64396553
@ -1,6 +1,6 @@
|
||||
from read_chirp_data import *
|
||||
from func_chirp import *
|
||||
from utility import *
|
||||
#import nix_helpers as nh
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from IPython import embed
|
||||
@ -18,45 +18,13 @@ eod = read_chirp_eod(os.path.join(data_dir, dataset))
|
||||
times = read_chirp_times(os.path.join(data_dir, dataset))
|
||||
df_map = map_keys(eod)
|
||||
|
||||
chirp_eod_plot(df_map, eod, times)
|
||||
plt.close()
|
||||
|
||||
|
||||
#die äußere Schleife geht für alle Keys durch und somit durch alle dfs
|
||||
#die innnere Schleife bildet die 16 Wiederholungen einer Frequenz ab
|
||||
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):
|
||||
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)
|
||||
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]')
|
||||
|
||||
|
||||
|
||||
#for i in df_map.keys():
|
||||
|
||||
freq = list(df_map[-50])
|
||||
#ACHTUNG: df für beide Plots anpassen!
|
||||
#momentan per Hand durch alle Frequenzen
|
||||
freq = list(df_map[-100])
|
||||
ls_mod = []
|
||||
ls_beat = []
|
||||
for k in freq:
|
||||
@ -78,11 +46,11 @@ beat_mod = np.std(ls_beat) #Std vom Bereich vor dem Chirp
|
||||
plt.figure()
|
||||
plt.scatter(np.arange(0,len(ls_mod),1), ls_mod)
|
||||
plt.scatter(np.arange(0,len(ls_mod),1), np.ones(len(ls_mod))*beat_mod, color = 'violet')
|
||||
plt.show()
|
||||
plt.close()
|
||||
|
||||
|
||||
|
||||
#Chirps einer Phase zuordnen - zusammen plotten?
|
||||
#Chirps einer Phase zuordnen - zusammen plotten
|
||||
|
||||
dct_phase = {}
|
||||
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
||||
@ -98,8 +66,8 @@ for i in sort_df:
|
||||
for k in freq:
|
||||
for phase in chirp_spikes[k]:
|
||||
dct_phase[i].append(phase[1])
|
||||
#for idx in np.arange(num_bin):
|
||||
#if phase[1] > phase_vec[idx] and phase[1] < phase_vec[idx+1]:
|
||||
|
||||
print(dct_phase)
|
||||
|
||||
plt.figure()
|
||||
plt.scatter(dct_phase[-100], ls_mod)
|
||||
plt.title('Change of std depending on the phase where the chirp occured')
|
||||
plt.show()
|
||||
|
@ -9,20 +9,19 @@ from IPython import embed #Funktionen imposrtieren
|
||||
|
||||
data_dir = "../data"
|
||||
dataset = "2018-11-13-ad-invivo-1"
|
||||
#data = ("2018-11-09-ad-invivo-1", "2018-11-13-aa-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-ah-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", "2018-11-20-aa-invivo-1", "2018-11-20-ab-invivo-1", "2018-11-20-ac-invivo-1", "2018-11-20-ad-invivo-1"," 2018-11-20-ae-invivo-1", "2018-11-20-af-invivo-1", "2018-11-20-ag-invivo-1", "2018-11-20-ah-invivo-1", "2018-11-20-ai-invivo-1")
|
||||
#data = ("2018-11-09-ad-invivo-1", "2018-11-13-aa-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-ah-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", "2018-11-20-aa-invivo-1", "2018-11-20-ab-invivo-1", "2018-11-20-ac-invivo-1", "2018-11-20-ad-invivo-1"," 2018-11-20-ae-invivo-1", "2018-11-20-af-invivo-1", "2018-11-20-ag-invivo-1", "2018-11-20-ah-invivo-1", "2018-11-20-ai-invivo-1") Durchgang für alle Datensets - zwischenspeichern von Daten?
|
||||
|
||||
|
||||
|
||||
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
|
||||
#inst_frequency = 1. / np.diff(spike_times)
|
||||
spike_rate = np.diff(spike_times)
|
||||
spike_iv = np.diff(spike_times)
|
||||
|
||||
|
||||
x = np.arange(0.001, 0.01, 0.0001)
|
||||
plt.hist(spike_rate,x)
|
||||
plt.hist(spike_iv,x)
|
||||
|
||||
mu = np.mean(spike_rate)
|
||||
sigma = np.std(spike_rate)
|
||||
mu = np.mean(iv)
|
||||
sigma = np.std(iv)
|
||||
cv = sigma/mu
|
||||
|
||||
plt.title('A.lepto ISI Histogramm', fontsize = 14)
|
||||
@ -45,20 +44,28 @@ sort_df = sorted(df_map.keys())
|
||||
|
||||
plt.figure()
|
||||
dct_rate = {}
|
||||
overall_r = {}
|
||||
for i in sort_df:
|
||||
freq = list(df_map[i])
|
||||
dct_rate[i] = []
|
||||
overall_r[i] = []
|
||||
for k in freq:
|
||||
for phase in chirp_spikes[k]:
|
||||
spikes = chirp_spikes[k][phase]
|
||||
rate = len(spikes)/ 1.2
|
||||
dct_rate[i].append(rate)
|
||||
#overall_r[i].extend(rate) #kann man nicht erweitern!
|
||||
|
||||
|
||||
for h in sort_df:
|
||||
ls_mean = []
|
||||
for h in sort_df:
|
||||
mean = np.mean(dct_rate[h])
|
||||
ls_mean.append(mean)
|
||||
plt.plot(np.arange(0,len(dct_rate[h]),1),dct_rate[h], label = h)
|
||||
|
||||
#plt.vlines(10, ymin = 190, ymax = 310)
|
||||
#Anfang Spur und Endpunkt bestimmen
|
||||
#relativ zur mittleren Feuerrate
|
||||
#wie hoch ist die Adaption von Zellen
|
||||
plt.legend()
|
||||
plt.title('Firing rate of the cell for all trials, sorted by df')
|
||||
plt.xlabel('# of trials')
|
||||
@ -66,18 +73,23 @@ plt.ylabel('Instant firing rate of the cell')
|
||||
plt.show()
|
||||
|
||||
|
||||
#mittlere Feuerrate einer Frequenz auf Frequenz
|
||||
|
||||
#mittlere Feuerrate einer Frequenz auf Frequenz:
|
||||
|
||||
plt.figure()
|
||||
ls_mean = []
|
||||
for d in sort_df:
|
||||
mean = np.mean(dct_rate[d])
|
||||
ls_mean.append(mean)
|
||||
plt.plot(np.arange(0,len(ls_mean),1),ls_mean)
|
||||
#plt.scatter(np.arange(0,len(ls_mean),1), np.mean(int(overall_r)))
|
||||
plt.title('Mean firing rate of a cell for a range of frequency differences')
|
||||
plt. xticks(np.arange(len(sort_df)), (sort_df))
|
||||
plt. xticks(np.arange(1,len(sort_df),1), (sort_df))
|
||||
plt.xlabel('Range of frequency differences [Hz]')
|
||||
plt.ylabel('Mean firing rate of the cell')
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
#Boxplot
|
||||
#wie viel Prozent macht die Adaption von Zellen aus?
|
||||
|
||||
|
||||
#Reihen-Plot
|
||||
#macht die zeitliche Reihenfolge der Präsentation einen Unterschied in der Zellantwort?
|
||||
|
Loading…
Reference in New Issue
Block a user