zwischendrin
This commit is contained in:
parent
3db401a3ea
commit
b618c2d9ca
@ -8,7 +8,7 @@ from IPython import embed
|
||||
|
||||
|
||||
data_dir = "../data"
|
||||
dataset = "2018-11-13-ah-invivo-1"
|
||||
dataset = "2018-11-13-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"]
|
||||
|
||||
|
||||
@ -41,7 +41,9 @@ for i in sort_df:
|
||||
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)
|
||||
example = [-50, 200, 400]
|
||||
|
||||
dct_phase = plot_std_chirp(example, df_map, chirp_spikes, chirp_mods)
|
||||
plt.show()
|
||||
plt.close('all')
|
||||
|
||||
|
@ -14,10 +14,16 @@ 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', 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)
|
||||
|
||||
inch_factor = 2.54
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
|
||||
plt.plot(zeit[0:1000], eod[0:1000], color = 'darkblue')
|
||||
plt.title('A.lepto EOD', fontsize = 24)#Plottitel
|
||||
plt.xlabel('time [ms]', fontsize = 22)#Achsentitel
|
||||
plt.ylabel('amplitude[mv]', fontsize = 22)#Achsentitel
|
||||
plt.tick_params(axis='both', which='major', labelsize = 22)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
fig.tight_layout()
|
||||
plt.show()
|
||||
|
@ -12,25 +12,28 @@ data_base = ("2018-11-09-ab-invivo-1", "2018-11-09-ad-invivo-1", "2018-11-13-aa-
|
||||
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"
|
||||
|
||||
inch_factor = 2.54
|
||||
|
||||
#for dataset in data_base:
|
||||
|
||||
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)
|
||||
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
plt.hist(spike_iv,x, color = 'darkblue')
|
||||
|
||||
mu = np.mean(spike_iv)
|
||||
sigma = np.std(spike_iv)
|
||||
cv = sigma/mu
|
||||
|
||||
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 = 14)
|
||||
plt.yticks(fontsize = 14)
|
||||
plt.title('A.lepto ISI Histogramm', fontsize = 24)
|
||||
plt.xlabel('duration ISI[ms]', fontsize = 22)
|
||||
plt.ylabel('number of ISI', fontsize = 22)
|
||||
plt.tick_params(axis='both', which='major', labelsize = 22)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
|
||||
@ -47,6 +50,7 @@ sort_df = sorted(df_map.keys())
|
||||
dct_rate, over_r = spike_rates(sort_df, df_map, chirp_spikes)
|
||||
|
||||
plt.figure()
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
ls_mean = plot_df_spikes(sort_df, dct_rate)
|
||||
plt.show()
|
||||
|
||||
@ -54,14 +58,17 @@ plt.show()
|
||||
|
||||
#mittlere Feuerrate einer Frequenz auf Frequenz:
|
||||
|
||||
plt.figure()
|
||||
plt.plot(np.arange(0,len(ls_mean),1),ls_mean)
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
plt.plot(np.arange(0,len(ls_mean),1),ls_mean, color = 'darkblue')
|
||||
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.title('Mean firing rate of a cell for a range of frequency differences', fontsize = 24)
|
||||
plt.xticks(np.arange(1,len(sort_df),1), (sort_df))
|
||||
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.xlabel('Range of frequency differences [Hz]', fontsize = 22)
|
||||
plt.ylabel('Mean firing rate of the cell', fontsize = 22)
|
||||
plt.tick_params(axis='both', which='major', labelsize = 18)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
|
||||
@ -70,12 +77,15 @@ plt.show()
|
||||
#wie viel Prozent der Anfangsrate macht die Adaption von Zellen aus?
|
||||
|
||||
adapt = adaptation_df(sort_df, dct_rate)
|
||||
plt.figure()
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
plt.boxplot(adapt)
|
||||
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.title('Adaptation of cell firing rate during a trial', fontsize = 24)
|
||||
plt.xlabel('Cell', fontsize = 22)
|
||||
plt.ylabel('Adaptation size [Hz]', fontsize = 22)
|
||||
plt.tick_params(axis='both', which='major', labelsize = 18)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
|
||||
|
@ -2,8 +2,10 @@ from read_baseline_data import *
|
||||
from read_chirp_data import *
|
||||
from utility import *
|
||||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
inch_factor = 2.54
|
||||
|
||||
def chirp_eod_plot(df_map, eod, times):
|
||||
#die äußere Schleife geht für alle Keys durch und somit durch alle dfs
|
||||
@ -11,7 +13,7 @@ def chirp_eod_plot(df_map, eod, times):
|
||||
|
||||
for i in df_map.keys():
|
||||
freq = list(df_map[i])
|
||||
fig,axs = plt.subplots(2, 2, sharex = True, sharey = True)
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
|
||||
for idx, k in enumerate(freq):
|
||||
ct = times[k]
|
||||
@ -19,22 +21,28 @@ def chirp_eod_plot(df_map, eod, times):
|
||||
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))*np.mean(eods), 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))*np.mean(eods), 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))*np.mean(eods), 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))*np.mean(eods), color = 'green', s= 22)
|
||||
if idx <= 1:
|
||||
ax.plot(zeit, eods, color= 'darkblue')
|
||||
ax.scatter(np.asarray(ct), np.ones(len(ct))*np.mean(eods), 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))*np.mean(eods), 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))*np.mean(eods), color = 'green', s= 22)
|
||||
else:
|
||||
continue
|
||||
#axs[1, 1].plot(zeit, eods, color= 'blue', linewidth = 0.25)
|
||||
#axs[1, 1].scatter(np.asarray(ct), np.ones(len(ct))*np.mean(eods), color = 'green', s= 22)
|
||||
|
||||
ax.set_ylabel('Amplitude [mV]', fontsize = 22)
|
||||
ax.set_xlabel('Time [ms]', fontsize = 22)
|
||||
ax.tick_params(axis='both', which='major', labelsize = 18)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
fig.suptitle('EOD for chirps', fontsize = 24)
|
||||
fig.tight_layout()
|
||||
|
||||
axs[0,1].set_ylabel('Amplitude [mV]')
|
||||
axs[1,0].set_xlabel('Time [ms]')
|
||||
fig.suptitle('EOD for chirps', fontsize = 16)
|
||||
|
||||
|
||||
|
||||
@ -69,7 +77,7 @@ def cut_chirps(freq, eod, times):
|
||||
|
||||
def plot_std_chirp(sort_df, df_map, chirp_spikes, chirp_mods):
|
||||
|
||||
plt.figure()
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
dct_phase = {}
|
||||
num_bin = 12
|
||||
phase_vec = np.arange(0, 1+1/num_bin, 1/num_bin)
|
||||
@ -82,10 +90,13 @@ def plot_std_chirp(sort_df, df_map, chirp_spikes, chirp_mods):
|
||||
dct_phase[i].append(phase[1])
|
||||
|
||||
for i in sort_df:
|
||||
plt.scatter(dct_phase[i], chirp_mods[i], label = i)
|
||||
plt.title('Change of std depending on the phase where the chirp occured')
|
||||
plt.xlabel('Phase')
|
||||
plt.ylabel('Standard deviation of the amplitude modulation')
|
||||
norm = np.asarray(dct_phase[i]) *2*math.pi
|
||||
plt.scatter(norm, chirp_mods[i], label = i, s = 22)
|
||||
plt.title('Change of std depending on the phase where the chirp occured', fontsize = 24)
|
||||
plt.xlabel('Phase', fontsize = 22)
|
||||
plt.ylabel('Standard deviation of the amplitude modulation', fontsize = 22)
|
||||
plt.xticks([0, math.pi/2, math.pi, math.pi*1.5, math.pi*2], ('0', '$\pi$ /2', '$\pi$', '1.5 $\pi$', '2$\pi$'))
|
||||
plt.tick_params(axis='both', which='major', labelsize = 18)
|
||||
plt.legend()
|
||||
return(dct_phase)
|
||||
|
||||
|
@ -43,6 +43,8 @@ def spike_rates(sort_df, df_map, chirp_spikes):
|
||||
|
||||
def plot_df_spikes(sort_df, dct_rate):
|
||||
#gibt die Feuerrate gegen die Frequenz aufgetragen
|
||||
inch_factor = 2.54
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
ls_mean = []
|
||||
for h in sort_df:
|
||||
mean = np.mean(dct_rate[h])
|
||||
@ -50,10 +52,13 @@ 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', 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)
|
||||
plt.title('Firing rate of the cell for all trials, sorted by df', fontsize = 24)
|
||||
plt.xlabel('# of trials', fontsize = 22)
|
||||
plt.ylabel('Instant firing rate of the cell', fontsize = 22)
|
||||
plt.tick_params(axis='both', which='major', labelsize = 18)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
plt.tight_layout()
|
||||
return(ls_mean)
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@ data_chirps = ("2018-11-09-ad-invivo-1", "2018-11-09-ae-invivo-1", "2018-11-09-a
|
||||
|
||||
|
||||
|
||||
inch_factor = 2.54
|
||||
data_rate_dict = {}
|
||||
for dataset in data_chirps:
|
||||
|
||||
@ -31,14 +32,17 @@ for dataset in data_chirps:
|
||||
rate = len(spikes)/ 1.2
|
||||
data_rate_dict[dataset].append(rate)
|
||||
|
||||
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
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.title('Test for sequence effects', fontsize = 24)
|
||||
plt.xlabel('Number of stimulus presentations', fontsize = 22)
|
||||
plt.ylabel('Firing rates of cells', fontsize = 22)
|
||||
plt.tick_params(axis='both', which='major', labelsize = 22)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
fig.tight_layout()
|
||||
plt.show()
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ interspikeintervals = np.diff(spikes)*1000
|
||||
|
||||
fig, ax = plt.subplots(figsize=(20/inch_factor, 10/inch_factor))
|
||||
plt.hist(interspikeintervals, bins=np.arange(0, np.max(interspikeintervals), 0.0001), color='darkblue')
|
||||
#Titel fehlt!!
|
||||
plt.xlabel("time [ms]", fontsize = 22)
|
||||
plt.xticks(fontsize = 18)
|
||||
plt.ylabel("Number of \n Interspikeinterval", fontsize = 22)
|
||||
|
Loading…
Reference in New Issue
Block a user