neu
This commit is contained in:
parent
fb5627a794
commit
e6fafa2f72
@ -8,66 +8,51 @@ from IPython import embed
|
|||||||
|
|
||||||
|
|
||||||
data_dir = "../data"
|
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", "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-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","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")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#for dataset in data:
|
for dataset in data:
|
||||||
eod = read_chirp_eod(os.path.join(data_dir, dataset))
|
print(dataset)
|
||||||
times = read_chirp_times(os.path.join(data_dir, dataset))
|
eod = read_chirp_eod(os.path.join(data_dir, dataset))
|
||||||
df_map = map_keys(eod)
|
times = read_chirp_times(os.path.join(data_dir, dataset))
|
||||||
|
df_map = map_keys(eod)
|
||||||
|
sort_df = sorted(df_map.keys())
|
||||||
|
|
||||||
chirp_eod_plot(df_map, eod, times)
|
|
||||||
plt.close()
|
|
||||||
|
|
||||||
|
chirp_eod_plot(df_map, eod, times)
|
||||||
|
|
||||||
#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:
|
|
||||||
e1 = eod[k]
|
|
||||||
zeit = np.asarray(e1[0])
|
|
||||||
ampl = np.asarray(e1[1])
|
|
||||||
|
|
||||||
ct = times[k]
|
chirp_mods = []
|
||||||
for chirp in ct:
|
beat_mods = []
|
||||||
time_cut = zeit[(zeit > chirp-10) & (zeit < chirp+10)]
|
for i in sort_df:
|
||||||
eods_cut = ampl[(zeit > chirp-10) & (zeit < chirp+10)]
|
freq = list(df_map[i])
|
||||||
beat_cut = ampl[(zeit > chirp-55) & (zeit < chirp-10)]
|
ls_mod, beat_mod = cut_chirps(freq, eod, times)
|
||||||
|
chirp_mods.append(ls_mod)
|
||||||
|
beat_mods.append(beat_mod)
|
||||||
|
|
||||||
chirp_mod = np.std(eods_cut) #Std vom Bereich um den Chirp
|
|
||||||
ls_mod.append(chirp_mod)
|
|
||||||
ls_beat.extend(beat_cut)
|
|
||||||
|
|
||||||
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.close()
|
|
||||||
|
|
||||||
|
|
||||||
|
#Chirps einer Phase zuordnen - zusammen plotten
|
||||||
|
|
||||||
#Chirps einer Phase zuordnen - zusammen plotten
|
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
||||||
|
df_map = map_keys(chirp_spikes)
|
||||||
|
sort_df = sorted(df_map.keys())
|
||||||
|
|
||||||
dct_phase = {}
|
#plot_std_chirp(sort_df, df_map, chirp_spikes, chirp_mods)
|
||||||
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
|
||||||
df_map = map_keys(chirp_spikes)
|
|
||||||
sort_df = sorted(df_map.keys())
|
|
||||||
|
|
||||||
num_bin = 12
|
|
||||||
phase_vec = np.arange(0, 1+1/num_bin, 1/num_bin)
|
|
||||||
|
|
||||||
for i in sort_df:
|
|
||||||
freq = list(df_map[i])
|
|
||||||
dct_phase[i] = []
|
#Vatriablen speichern, die man für die Übersicht aller Zellen braucht
|
||||||
for k in freq:
|
name = str(dataset.strip('invivo-1'))
|
||||||
for phase in chirp_spikes[k]:
|
f = open('../results/Chirpcut/Cc_' + name + '.dat' , 'w')
|
||||||
dct_phase[i].append(phase[1])
|
f.write(str(sort_df))
|
||||||
|
f.write(str(df_map))
|
||||||
plt.figure()
|
f.write(str(chirp_spikes))
|
||||||
plt.scatter(dct_phase[-100], ls_mod)
|
f.write(str(eod))
|
||||||
plt.title('Change of std depending on the phase where the chirp occured')
|
f.write(str(times))
|
||||||
plt.show()
|
#f.write(str(chirp_mods))
|
||||||
|
#f.write(str(beat_mods))
|
||||||
|
f.close()
|
||||||
|
@ -1,95 +1,93 @@
|
|||||||
from read_baseline_data import *
|
from read_baseline_data import *
|
||||||
from read_chirp_data import *
|
from read_chirp_data import *
|
||||||
from utility import *
|
from func_spike import *
|
||||||
#import nix_helpers as nh
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from IPython import embed #Funktionen imposrtieren
|
from IPython import embed #Funktionen imposrtieren
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data_dir = "../data"
|
data_dir = "../data"
|
||||||
dataset = "2018-11-13-ad-invivo-1"
|
data_base = ("2018-11-09-ab-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-13-af-invivo-1", "2018-11-13-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-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-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-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?
|
data_chirps = ("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", "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")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
for dataset in data_base:
|
||||||
|
|
||||||
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
|
print(dataset)
|
||||||
spike_iv = np.diff(spike_times)
|
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
|
||||||
|
spike_iv = np.diff(spike_times)
|
||||||
|
x = np.arange(0.001, 0.01, 0.0001)
|
||||||
|
plt.hist(spike_iv,x)
|
||||||
|
|
||||||
|
mu = np.mean(spike_iv)
|
||||||
|
sigma = np.std(spike_iv)
|
||||||
|
cv = sigma/mu
|
||||||
|
|
||||||
x = np.arange(0.001, 0.01, 0.0001)
|
plt.title('A.lepto ISI Histogramm', fontsize = 14)
|
||||||
plt.hist(spike_iv,x)
|
plt.xlabel('duration ISI[ms]', fontsize = 12)
|
||||||
|
plt.ylabel('number of ISI', fontsize = 12)
|
||||||
|
|
||||||
mu = np.mean(iv)
|
plt.xticks(fontsize = 12)
|
||||||
sigma = np.std(iv)
|
plt.yticks(fontsize = 12)
|
||||||
cv = sigma/mu
|
'''
|
||||||
|
|
||||||
plt.title('A.lepto ISI Histogramm', fontsize = 14)
|
|
||||||
plt.xlabel('duration ISI[ms]', fontsize = 12)
|
|
||||||
plt.ylabel('number of ISI', fontsize = 12)
|
|
||||||
|
|
||||||
plt.xticks(fontsize = 12)
|
|
||||||
plt.yticks(fontsize = 12)
|
|
||||||
plt.show()
|
|
||||||
|
|
||||||
|
for dataset in data_chirps:
|
||||||
|
|
||||||
|
#Nyquist-Theorem Plot:
|
||||||
|
print(dataset)
|
||||||
|
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
||||||
|
times = read_chirp_times(os.path.join(data_dir, dataset))
|
||||||
|
eod = read_chirp_eod(os.path.join(data_dir, dataset))
|
||||||
|
df_map = map_keys(chirp_spikes)
|
||||||
|
sort_df = sorted(df_map.keys())
|
||||||
|
|
||||||
|
dct_rate, over_r = spike_rates(sort_df, df_map, chirp_spikes)
|
||||||
|
|
||||||
#Nyquist-Theorem Plot:
|
plt.figure()
|
||||||
|
ls_mean = plot_df_spikes(sort_df, dct_rate)
|
||||||
|
|
||||||
|
|
||||||
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
|
||||||
df_map = map_keys(chirp_spikes)
|
|
||||||
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!
|
|
||||||
|
|
||||||
ls_mean = []
|
#mittlere Feuerrate einer Frequenz auf Frequenz:
|
||||||
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)
|
plt.figure()
|
||||||
#Anfang Spur und Endpunkt bestimmen
|
plt.plot(np.arange(0,len(ls_mean),1),ls_mean)
|
||||||
#relativ zur mittleren Feuerrate
|
plt.scatter(np.arange(0,len(ls_mean),1), np.ones(len(ls_mean))*over_r)
|
||||||
#wie hoch ist die Adaption von Zellen
|
plt.title('Mean firing rate of a cell for a range of frequency differences')
|
||||||
plt.legend()
|
plt.xticks(np.arange(1,len(sort_df),1), (sort_df))
|
||||||
plt.title('Firing rate of the cell for all trials, sorted by df')
|
plt.xlabel('Range of frequency differences [Hz]')
|
||||||
plt.xlabel('# of trials')
|
plt.ylabel('Mean firing rate of the cell')
|
||||||
plt.ylabel('Instant firing rate of the cell')
|
|
||||||
plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#mittlere Feuerrate einer Frequenz auf Frequenz:
|
|
||||||
|
|
||||||
plt.figure()
|
#Adaption der Zellen:
|
||||||
plt.plot(np.arange(0,len(ls_mean),1),ls_mean)
|
#wie viel Prozent der Anfangsrate macht die Adaption von Zellen aus?
|
||||||
#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(1,len(sort_df),1), (sort_df))
|
|
||||||
plt.xlabel('Range of frequency differences [Hz]')
|
|
||||||
plt.ylabel('Mean firing rate of the cell')
|
|
||||||
plt.show()
|
|
||||||
|
|
||||||
|
adapt = adaptation_df(sort_df, dct_rate)
|
||||||
|
plt.figure()
|
||||||
|
plt.boxplot(adapt)
|
||||||
|
plt.title('Adaptation of cell firing rate during a trial')
|
||||||
|
plt.xlabel('Cell')
|
||||||
|
plt.ylabel('Adaptation size [Hz]')
|
||||||
|
|
||||||
|
|
||||||
#Boxplot
|
|
||||||
#wie viel Prozent macht die Adaption von Zellen aus?
|
|
||||||
|
|
||||||
|
|
||||||
#Reihen-Plot
|
#Vatriablen speichern, die man für die Übersicht aller Zellen braucht
|
||||||
#macht die zeitliche Reihenfolge der Präsentation einen Unterschied in der Zellantwort?
|
name = str(dataset.strip('invivo-1'))
|
||||||
|
f = open('../results/Nyquist/Ny_' + name + '.txt' , 'w')
|
||||||
|
f.write(str(sort_df))
|
||||||
|
f.write(str(df_map))
|
||||||
|
f.write(str(chirp_spikes))
|
||||||
|
f.write(str(times))
|
||||||
|
f.write(str(ls_mean))
|
||||||
|
f.write(str(over_r))
|
||||||
|
f.write(str(adapt))
|
||||||
|
f.close()
|
||||||
|
@ -32,10 +32,56 @@ def chirp_eod_plot(df_map, eod, times):
|
|||||||
axs[1, 1].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
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)
|
axs[1, 1].scatter(np.asarray(ct), np.ones(len(ct))*3, color = 'green', s= 22)
|
||||||
|
|
||||||
fig.suptitle('EOD for chirps', fontsize = 16)
|
fig.suptitle('EOD for chirps', fontsize = 16)
|
||||||
axs[0,0].set_ylabel('Amplitude [mV]')
|
axs[0,0].set_ylabel('Amplitude [mV]')
|
||||||
axs[0,1].set_xlabel('Amplitude [mV]')
|
axs[0,1].set_xlabel('Amplitude [mV]')
|
||||||
axs[1,0].set_xlabel('Time [ms]')
|
axs[1,0].set_xlabel('Time [ms]')
|
||||||
axs[1,1].set_xlabel('Time [ms]')
|
axs[1,1].set_xlabel('Time [ms]')
|
||||||
plt.show()
|
plt.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def cut_chirps(freq, eod, times):
|
||||||
|
ls_mod = []
|
||||||
|
ls_beat = []
|
||||||
|
for k in freq:
|
||||||
|
e1 = eod[k]
|
||||||
|
zeit = np.asarray(e1[0])
|
||||||
|
ampl = np.asarray(e1[1])
|
||||||
|
|
||||||
|
ct = times[k]
|
||||||
|
for chirp in ct:
|
||||||
|
time_cut = zeit[(zeit > chirp-10) & (zeit < chirp+10)]
|
||||||
|
eods_cut = ampl[(zeit > chirp-10) & (zeit < chirp+10)]
|
||||||
|
beat_cut = ampl[(zeit > chirp-55) & (zeit < chirp-10)]
|
||||||
|
|
||||||
|
chirp_mod = np.std(eods_cut) #Std vom Bereich um den Chirp
|
||||||
|
ls_mod.append(chirp_mod)
|
||||||
|
ls_beat.extend(beat_cut)
|
||||||
|
|
||||||
|
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.close()
|
||||||
|
return(ls_mod, beat_mod)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def plot_std_chirp(sort_df, df_map, chirp_spikes, ls_mod):
|
||||||
|
plt.figure()
|
||||||
|
dct_phase = {}
|
||||||
|
num_bin = 12
|
||||||
|
phase_vec = np.arange(0, 1+1/num_bin, 1/num_bin)
|
||||||
|
|
||||||
|
for i in sort_df:
|
||||||
|
freq = list(df_map[i])
|
||||||
|
dct_phase[i] = []
|
||||||
|
for k in freq:
|
||||||
|
for phase in chirp_spikes[k]:
|
||||||
|
dct_phase[i].append(phase[1])
|
||||||
|
|
||||||
|
plt.scatter(dct_phase[i], ls_mod[i])
|
||||||
|
plt.title('Change of std depending on the phase where the chirp occured')
|
||||||
|
plt.close()
|
||||||
|
|
||||||
|
@ -5,3 +5,65 @@ import matplotlib.pyplot as plt
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def map_keys(input):
|
||||||
|
#gibt ein Dict mit den Keys eines Dict aus, aber als Int
|
||||||
|
df_map = {}
|
||||||
|
for k in input.keys():
|
||||||
|
freq = k[1]
|
||||||
|
df = int(freq.strip('Hz'))
|
||||||
|
if df in df_map.keys():
|
||||||
|
df_map[df].append(k)
|
||||||
|
else:
|
||||||
|
df_map[df] = [k]
|
||||||
|
return df_map
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def spike_rates(sort_df, df_map, chirp_spikes):
|
||||||
|
#damit wird sowohl die individuelle Rate pro Trial, als auch die Gesamt-Feuerrate berechnet
|
||||||
|
dct_rate = {}
|
||||||
|
over_spikes = []
|
||||||
|
for i in sort_df:
|
||||||
|
freq = list(df_map[i])
|
||||||
|
dct_rate[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)
|
||||||
|
over_spikes.extend(spikes)
|
||||||
|
|
||||||
|
duration = 1.2 *1600 #1200ms für 16 Trials
|
||||||
|
overall_r = len(over_spikes)/ duration
|
||||||
|
over_r = int(overall_r)
|
||||||
|
return(dct_rate, over_r)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def plot_df_spikes(sort_df, dct_rate):
|
||||||
|
#gibt die Feuerrate gegen die Frequenz aufgetragen
|
||||||
|
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.legend()
|
||||||
|
plt.title('Firing rate of the cell for all trials, sorted by df')
|
||||||
|
plt.xlabel('# of trials')
|
||||||
|
plt.ylabel('Instant firing rate of the cell')
|
||||||
|
return(ls_mean)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def adaptation_df(sort_df, dct_rate):
|
||||||
|
adapt = []
|
||||||
|
for d in sort_df:
|
||||||
|
spur = dct_rate[d]
|
||||||
|
start = spur[0:-1:10]
|
||||||
|
stop = spur[9:len(spur):10]
|
||||||
|
diff = np.asarray(start) - np.asarray(stop)
|
||||||
|
adapt.extend(diff)
|
||||||
|
|
||||||
|
return(adapt)
|
||||||
|
Loading…
Reference in New Issue
Block a user