diff --git a/code/base_eod.py b/code/base_eod.py index bf1e757..86a5ec2 100644 --- a/code/base_eod.py +++ b/code/base_eod.py @@ -8,14 +8,16 @@ from IPython import embed #Funktionen importieren data_dir = "../data" 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") + + time,eod = read_baseline_eod(os.path.join(data_dir, dataset)) zeit = np.asarray(time) plt.plot(zeit[0:1000], eod[0:1000]) -plt.title('A.lepto EOD')#Plottitelk -plt.xlabel('time [ms]', fontsize = 12)#Achsentitel -plt.ylabel('amplitude[mv]', fontsize = 12)#Achsentitel -plt.xticks(fontsize = 12) -plt.yticks(fontsize = 12) +plt.title('A.lepto EOD', fontsize = 18)#Plottitelk +plt.xlabel('time [ms]', fontsize = 16)#Achsentitel +plt.ylabel('amplitude[mv]', fontsize = 16)#Achsentitel +plt.xticks(fontsize = 14) +plt.yticks(fontsize = 14) plt.show() diff --git a/code/base_spikes.py b/code/base_spikes.py index 754df12..32ffd68 100644 --- a/code/base_spikes.py +++ b/code/base_spikes.py @@ -11,7 +11,7 @@ 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_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-14-al-invivo-1" +dataset = "2018-11-13-ad-invivo-1" #for dataset in data_base: @@ -25,12 +25,12 @@ mu = np.mean(spike_iv) sigma = np.std(spike_iv) 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.title('A.lepto ISI Histogramm', fontsize = 18) +plt.xlabel('duration ISI[ms]', fontsize = 16) +plt.ylabel('number of ISI', fontsize = 16) -plt.xticks(fontsize = 12) -plt.yticks(fontsize = 12) +plt.xticks(fontsize = 14) +plt.yticks(fontsize = 14) plt.show() @@ -56,11 +56,12 @@ plt.show() plt.figure() 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.title('Mean firing rate of a cell for a range of frequency differences') +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', fontsize = 18) 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.xlabel('Range of frequency differences [Hz]', fontsize = 16) +plt.ylabel('Mean firing rate of the cell', fontsize = 16) +plt.tick_params(axis='both', which='major', labelsize = 14) plt.show() @@ -71,9 +72,10 @@ 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]') +plt.title('Adaptation of cell firing rate during a trial', fontsize = 18) +plt.xlabel('Cell', fontsize = 16) +plt.ylabel('Adaptation size [Hz]', fontsize = 16) +plt.tick_params(axis='both', which='major', labelsize = 14) plt.show() diff --git a/code/func_spike.py b/code/func_spike.py index d512986..ac47c8f 100644 --- a/code/func_spike.py +++ b/code/func_spike.py @@ -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.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') + plt.title('Firing rate of the cell for all trials, sorted by df', fontsize = 18) + plt.xlabel('# of trials', fontsize = 16) + plt.ylabel('Instant firing rate of the cell', fontsize = 16) + plt.tick_params(axis='both', which='major', labelsize = 14) return(ls_mean) diff --git a/code/order_eff.py b/code/order_eff.py new file mode 100644 index 0000000..35f14e1 --- /dev/null +++ b/code/order_eff.py @@ -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() + + diff --git a/code/vector_phase.py b/code/vector_phase.py deleted file mode 100644 index 7828c2c..0000000 --- a/code/vector_phase.py +++ /dev/null @@ -1,22 +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)) - - -#vs = vector_strength(spike_times, eod_durations)