Merge branch 'master' of https://whale.am28.uni-tuebingen.de/git/jgrewe/gp_neurobio
This commit is contained in:
commit
5875657ca9
@ -8,45 +8,48 @@ from IPython import embed
|
|||||||
|
|
||||||
|
|
||||||
data_dir = "../data"
|
data_dir = "../data"
|
||||||
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")
|
dataset = "2018-11-13-ah-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))
|
sort_df = sorted(df_map.keys())
|
||||||
df_map = map_keys(eod)
|
|
||||||
sort_df = sorted(df_map.keys())
|
|
||||||
|
|
||||||
|
|
||||||
chirp_eod_plot(df_map, eod, times)
|
eods = chirp_eod_plot(df_map, eod, times)
|
||||||
|
plt.show()
|
||||||
|
plt.close('all')
|
||||||
|
|
||||||
|
|
||||||
chirp_mods = []
|
|
||||||
beat_mods = []
|
|
||||||
for i in sort_df:
|
|
||||||
freq = list(df_map[i])
|
|
||||||
ls_mod, beat_mod = cut_chirps(freq, eod, times)
|
|
||||||
chirp_mods.append(ls_mod)
|
|
||||||
beat_mods.append(beat_mod)
|
|
||||||
|
|
||||||
|
|
||||||
|
chirp_mods = {}
|
||||||
|
beat_mods = []
|
||||||
|
for i in sort_df:
|
||||||
|
chirp_mods[i] = []
|
||||||
|
freq = list(df_map[i])
|
||||||
|
ls_mod, beat_mod = cut_chirps(freq, eod, times)
|
||||||
|
chirp_mods[i].append(ls_mod)
|
||||||
|
beat_mods.append(beat_mod)
|
||||||
|
|
||||||
|
|
||||||
#Chirps einer Phase zuordnen - zusammen plotten
|
#Chirps einer Phase zuordnen - zusammen plotten
|
||||||
|
|
||||||
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
||||||
df_map = map_keys(chirp_spikes)
|
df_map = map_keys(chirp_spikes)
|
||||||
sort_df = sorted(df_map.keys())
|
sort_df = sorted(df_map.keys())
|
||||||
|
dct_phase = plot_std_chirp(sort_df, df_map, chirp_spikes, chirp_mods)
|
||||||
#plot_std_chirp(sort_df, df_map, chirp_spikes, chirp_mods)
|
plt.show()
|
||||||
|
plt.close('all')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
#Vatriablen speichern, die man für die Übersicht aller Zellen braucht
|
#Vatriablen speichern, die man für die Übersicht aller Zellen braucht
|
||||||
name = str(dataset.strip('invivo-1'))
|
name = str(dataset.replace('-invivo-1', ''))
|
||||||
|
print('saving ../results/Chirpcut/Cc_' + name + '.dat')
|
||||||
f = open('../results/Chirpcut/Cc_' + name + '.dat' , 'w')
|
f = open('../results/Chirpcut/Cc_' + name + '.dat' , 'w')
|
||||||
f.write(str(sort_df))
|
f.write(str(sort_df))
|
||||||
f.write(str(df_map))
|
f.write(str(df_map))
|
||||||
@ -56,3 +59,4 @@ for dataset in data:
|
|||||||
#f.write(str(chirp_mods))
|
#f.write(str(chirp_mods))
|
||||||
#f.write(str(beat_mods))
|
#f.write(str(beat_mods))
|
||||||
f.close()
|
f.close()
|
||||||
|
'''
|
||||||
|
@ -8,14 +8,16 @@ from IPython import embed #Funktionen importieren
|
|||||||
data_dir = "../data"
|
data_dir = "../data"
|
||||||
dataset = "2018-11-09-aa-invivo-1"
|
dataset = "2018-11-09-aa-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", "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-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", "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")
|
||||||
|
|
||||||
|
|
||||||
time,eod = read_baseline_eod(os.path.join(data_dir, dataset))
|
time,eod = read_baseline_eod(os.path.join(data_dir, dataset))
|
||||||
zeit = np.asarray(time)
|
zeit = np.asarray(time)
|
||||||
|
|
||||||
|
|
||||||
plt.plot(zeit[0:1000], eod[0:1000])
|
plt.plot(zeit[0:1000], eod[0:1000])
|
||||||
plt.title('A.lepto EOD')#Plottitelk
|
plt.title('A.lepto EOD', fontsize = 18)#Plottitelk
|
||||||
plt.xlabel('time [ms]', fontsize = 12)#Achsentitel
|
plt.xlabel('time [ms]', fontsize = 16)#Achsentitel
|
||||||
plt.ylabel('amplitude[mv]', fontsize = 12)#Achsentitel
|
plt.ylabel('amplitude[mv]', fontsize = 16)#Achsentitel
|
||||||
plt.xticks(fontsize = 12)
|
plt.xticks(fontsize = 14)
|
||||||
plt.yticks(fontsize = 12)
|
plt.yticks(fontsize = 14)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
@ -3,7 +3,7 @@ from read_chirp_data import *
|
|||||||
from func_spike import *
|
from func_spike import *
|
||||||
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 importieren
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -11,77 +11,79 @@ data_dir = "../data"
|
|||||||
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_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_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")
|
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")
|
||||||
|
|
||||||
|
dataset = "2018-11-13-ad-invivo-1"
|
||||||
|
|
||||||
|
|
||||||
'''
|
#for dataset in data_base:
|
||||||
for dataset in data_base:
|
|
||||||
|
|
||||||
print(dataset)
|
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
|
||||||
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
|
spike_iv = np.diff(spike_times)
|
||||||
spike_iv = np.diff(spike_times)
|
x = np.arange(0.001, 0.01, 0.0001)
|
||||||
x = np.arange(0.001, 0.01, 0.0001)
|
plt.hist(spike_iv,x)
|
||||||
plt.hist(spike_iv,x)
|
|
||||||
|
|
||||||
mu = np.mean(spike_iv)
|
mu = np.mean(spike_iv)
|
||||||
sigma = np.std(spike_iv)
|
sigma = np.std(spike_iv)
|
||||||
cv = sigma/mu
|
cv = sigma/mu
|
||||||
|
|
||||||
plt.title('A.lepto ISI Histogramm', fontsize = 14)
|
plt.title('A.lepto ISI Histogramm', fontsize = 18)
|
||||||
plt.xlabel('duration ISI[ms]', fontsize = 12)
|
plt.xlabel('duration ISI[ms]', fontsize = 16)
|
||||||
plt.ylabel('number of ISI', fontsize = 12)
|
plt.ylabel('number of ISI', fontsize = 16)
|
||||||
|
|
||||||
plt.xticks(fontsize = 12)
|
plt.xticks(fontsize = 14)
|
||||||
plt.yticks(fontsize = 12)
|
plt.yticks(fontsize = 14)
|
||||||
'''
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for dataset in data_chirps:
|
#for dataset in data_chirps:
|
||||||
|
|
||||||
#Nyquist-Theorem Plot:
|
#Nyquist-Theorem Plot:
|
||||||
print(dataset)
|
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
||||||
chirp_spikes = read_chirp_spikes(os.path.join(data_dir, dataset))
|
times = read_chirp_times(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))
|
||||||
eod = read_chirp_eod(os.path.join(data_dir, dataset))
|
df_map = map_keys(chirp_spikes)
|
||||||
df_map = map_keys(chirp_spikes)
|
sort_df = sorted(df_map.keys())
|
||||||
sort_df = sorted(df_map.keys())
|
|
||||||
|
|
||||||
dct_rate, over_r = spike_rates(sort_df, df_map, chirp_spikes)
|
|
||||||
|
|
||||||
plt.figure()
|
dct_rate, over_r = spike_rates(sort_df, df_map, chirp_spikes)
|
||||||
ls_mean = plot_df_spikes(sort_df, dct_rate)
|
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
ls_mean = plot_df_spikes(sort_df, dct_rate)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#mittlere Feuerrate einer Frequenz auf Frequenz:
|
#mittlere Feuerrate einer Frequenz auf Frequenz:
|
||||||
|
|
||||||
plt.figure()
|
plt.figure()
|
||||||
plt.plot(np.arange(0,len(ls_mean),1),ls_mean)
|
plt.plot(np.arange(0,len(ls_mean),1),ls_mean)
|
||||||
plt.scatter(np.arange(0,len(ls_mean),1), np.ones(len(ls_mean))*over_r)
|
plt.scatter(np.arange(0,len(ls_mean),1), np.ones(len(ls_mean))*over_r, color = 'green')
|
||||||
plt.title('Mean firing rate of a cell for a range of frequency differences')
|
plt.title('Mean firing rate of a cell for a range of frequency differences', fontsize = 18)
|
||||||
plt.xticks(np.arange(1,len(sort_df),1), (sort_df))
|
plt.xticks(np.arange(1,len(sort_df),1), (sort_df))
|
||||||
plt.xlabel('Range of frequency differences [Hz]')
|
plt.xlabel('Range of frequency differences [Hz]', fontsize = 16)
|
||||||
plt.ylabel('Mean firing rate of the cell')
|
plt.ylabel('Mean firing rate of the cell', fontsize = 16)
|
||||||
|
plt.tick_params(axis='both', which='major', labelsize = 14)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Adaption der Zellen:
|
#Adaption der Zellen:
|
||||||
#wie viel Prozent der Anfangsrate macht die Adaption von Zellen aus?
|
#wie viel Prozent der Anfangsrate macht die Adaption von Zellen aus?
|
||||||
|
|
||||||
adapt = adaptation_df(sort_df, dct_rate)
|
adapt = adaptation_df(sort_df, dct_rate)
|
||||||
plt.figure()
|
plt.figure()
|
||||||
plt.boxplot(adapt)
|
plt.boxplot(adapt)
|
||||||
plt.title('Adaptation of cell firing rate during a trial')
|
plt.title('Adaptation of cell firing rate during a trial', fontsize = 18)
|
||||||
plt.xlabel('Cell')
|
plt.xlabel('Cell', fontsize = 16)
|
||||||
plt.ylabel('Adaptation size [Hz]')
|
plt.ylabel('Adaptation size [Hz]', fontsize = 16)
|
||||||
|
plt.tick_params(axis='both', which='major', labelsize = 14)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
#Vatriablen speichern, die man für die Übersicht aller Zellen braucht
|
#Vatriablen speichern, die man für die Übersicht aller Zellen braucht
|
||||||
name = str(dataset.strip('invivo-1'))
|
name = str(dataset.replace('-invivo-1', ''))
|
||||||
f = open('../results/Nyquist/Ny_' + name + '.txt' , 'w')
|
f = open('../results/Nyquist/Ny_' + name + '.txt' , 'w')
|
||||||
f.write(str(sort_df))
|
f.write(str(sort_df))
|
||||||
f.write(str(df_map))
|
f.write(str(df_map))
|
||||||
@ -91,3 +93,4 @@ for dataset in data_chirps:
|
|||||||
f.write(str(over_r))
|
f.write(str(over_r))
|
||||||
f.write(str(adapt))
|
f.write(str(adapt))
|
||||||
f.close()
|
f.close()
|
||||||
|
'''
|
||||||
|
@ -21,23 +21,21 @@ def chirp_eod_plot(df_map, eod, times):
|
|||||||
|
|
||||||
if idx <= 3:
|
if idx <= 3:
|
||||||
axs[0, 0].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
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)
|
axs[0, 0].scatter(np.asarray(ct), np.ones(len(ct))*np.mean(eods), color = 'green', s= 22)
|
||||||
elif 4<= idx <= 7:
|
elif 4<= idx <= 7:
|
||||||
axs[0, 1].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
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)
|
axs[0, 1].scatter(np.asarray(ct), np.ones(len(ct))*np.mean(eods), color = 'green', s= 22)
|
||||||
elif 8<= idx <= 11:
|
elif 8<= idx <= 11:
|
||||||
axs[1, 0].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
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)
|
axs[1, 0].scatter(np.asarray(ct), np.ones(len(ct))*np.mean(eods), color = 'green', s= 22)
|
||||||
else:
|
else:
|
||||||
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))*np.mean(eods), color = 'green', s= 22)
|
||||||
|
|
||||||
|
axs[0,1].set_ylabel('Amplitude [mV]')
|
||||||
|
axs[1,0].set_xlabel('Time [ms]')
|
||||||
fig.suptitle('EOD for chirps', fontsize = 16)
|
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]')
|
|
||||||
plt.close()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -60,15 +58,17 @@ def cut_chirps(freq, eod, times):
|
|||||||
ls_beat.extend(beat_cut)
|
ls_beat.extend(beat_cut)
|
||||||
|
|
||||||
beat_mod = np.std(ls_beat) #Std vom Bereich vor dem Chirp
|
beat_mod = np.std(ls_beat) #Std vom Bereich vor dem Chirp
|
||||||
plt.figure()
|
#plt.figure()
|
||||||
plt.scatter(np.arange(0,len(ls_mod),1), ls_mod)
|
#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.scatter(np.arange(0,len(ls_mod),1), np.ones(len(ls_mod))*beat_mod, color = 'violet')
|
||||||
plt.close()
|
|
||||||
return(ls_mod, beat_mod)
|
return(ls_mod, beat_mod)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def plot_std_chirp(sort_df, df_map, chirp_spikes, ls_mod):
|
|
||||||
|
|
||||||
|
def plot_std_chirp(sort_df, df_map, chirp_spikes, chirp_mods):
|
||||||
|
|
||||||
plt.figure()
|
plt.figure()
|
||||||
dct_phase = {}
|
dct_phase = {}
|
||||||
num_bin = 12
|
num_bin = 12
|
||||||
@ -80,8 +80,12 @@ def plot_std_chirp(sort_df, df_map, chirp_spikes, ls_mod):
|
|||||||
for k in freq:
|
for k in freq:
|
||||||
for phase in chirp_spikes[k]:
|
for phase in chirp_spikes[k]:
|
||||||
dct_phase[i].append(phase[1])
|
dct_phase[i].append(phase[1])
|
||||||
|
|
||||||
plt.scatter(dct_phase[i], ls_mod[i])
|
for i in sort_df:
|
||||||
plt.title('Change of std depending on the phase where the chirp occured')
|
plt.scatter(dct_phase[i], chirp_mods[i], label = i)
|
||||||
plt.close()
|
plt.title('Change of std depending on the phase where the chirp occured')
|
||||||
|
plt.xlabel('Phase')
|
||||||
|
plt.ylabel('Standard deviation of the amplitude modulation')
|
||||||
|
plt.legend()
|
||||||
|
return(dct_phase)
|
||||||
|
|
||||||
|
@ -50,9 +50,10 @@ def plot_df_spikes(sort_df, dct_rate):
|
|||||||
plt.plot(np.arange(0,len(dct_rate[h]),1),dct_rate[h], label = h)
|
plt.plot(np.arange(0,len(dct_rate[h]),1),dct_rate[h], label = h)
|
||||||
|
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.title('Firing rate of the cell for all trials, sorted by df')
|
plt.title('Firing rate of the cell for all trials, sorted by df', fontsize = 18)
|
||||||
plt.xlabel('# of trials')
|
plt.xlabel('# of trials', fontsize = 16)
|
||||||
plt.ylabel('Instant firing rate of the cell')
|
plt.ylabel('Instant firing rate of the cell', fontsize = 16)
|
||||||
|
plt.tick_params(axis='both', which='major', labelsize = 14)
|
||||||
return(ls_mean)
|
return(ls_mean)
|
||||||
|
|
||||||
|
|
||||||
|
44
code/order_eff.py
Normal file
44
code/order_eff.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
from read_chirp_data import *
|
||||||
|
from func_spike import *
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
from IPython import embed #Funktionen importieren
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data_dir = "../data"
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data_rate_dict = {}
|
||||||
|
for dataset in data_chirps:
|
||||||
|
|
||||||
|
data_rate_dict[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)
|
||||||
|
|
||||||
|
|
||||||
|
for i in df_map.keys():
|
||||||
|
freq = list(df_map[i])
|
||||||
|
k = freq[0]
|
||||||
|
phase = list(chirp_spikes[k].keys())[0]
|
||||||
|
|
||||||
|
spikes = chirp_spikes[k][phase]
|
||||||
|
rate = len(spikes)/ 1.2
|
||||||
|
data_rate_dict[dataset].append(rate)
|
||||||
|
|
||||||
|
|
||||||
|
for dataset in data_rate_dict:
|
||||||
|
plt.plot(data_rate_dict[dataset])
|
||||||
|
plt.title('Test for sequence effects', fontsize = 20)
|
||||||
|
plt.xlabel('Number of stimulus presentations', fontsize = 18)
|
||||||
|
plt.ylabel('Firing rates of cells', fontsize = 18)
|
||||||
|
plt.tick_params(axis='both', which='major', labelsize = 16)
|
||||||
|
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
from read_baseline_data import *
|
|
||||||
from utility import *
|
|
||||||
#import nix_helpers as nh
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import numpy as np
|
|
||||||
from IPython import embed #Funktionen importieren
|
|
||||||
|
|
||||||
|
|
||||||
#Zeitpunkte einer EOD über Zero-crossings finden, die in einer Steigung liegen
|
|
||||||
data_dir = "../data"
|
|
||||||
dataset = "2018-11-09-ad-invivo-1"
|
|
||||||
time,eod = read_baseline_eod(os.path.join(data_dir, dataset))
|
|
||||||
spike_times = read_baseline_spikes(os.path.join(data_dir, dataset))
|
|
||||||
print(len(spike_times))
|
|
||||||
|
|
||||||
eod_times = zero_crossing(eod,time)
|
|
||||||
eod_durations = np.diff(eod_times)
|
|
||||||
print(len(spike_times))
|
|
||||||
print(len(eod_durations))
|
|
||||||
|
|
||||||
#for st in spike_times:
|
|
||||||
#et = eod_times[eod_times < st]
|
|
||||||
#dt = st - et
|
|
||||||
|
|
||||||
#vs = vector_strength(spike_times, eod_durations)
|
|
Loading…
Reference in New Issue
Block a user