forked from bendalab/punitmodel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_mem_tau_ref_period.py
65 lines (54 loc) · 2.48 KB
/
plot_mem_tau_ref_period.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 00:34:14 2020
@author: Ibrahim Alperen Tunc
"""
#Plot the frequency-dependent long delay index for different membrane tau and refractory period values
import os
import numpy as np
import matplotlib.pyplot as plt
import random
import helper_functions as helpers
import pandas as pd
savepath = r'D:\ALPEREN\Tübingen NB\Semester 3\Benda\git\punitmodel\data'
datapathes = os.listdir(savepath)
paths = [ path[:5] == 'decay' and path[29]!='1' for path in datapathes]
pathes = list(np.array(datapathes)[paths])
fig, ax = plt.subplots(1,3)
for i, dataname in enumerate(pathes):
data = pd.read_csv(savepath+'\\'+dataname)
print(data[:10])
img = ax[i].imshow(data, extent = [0,data.shape[0],
data.shape[1],0], vmin = 1, vmax = 6)
ax[i].xaxis.tick_top()
ax[i].set_xticks(np.arange(0,data.shape[0]+1,10))
ax[i].set_yticks(np.arange(0,data.shape[0]+1,10))
ax[i].set_xticklabels(np.round(np.logspace(np.log10(50), np.log10(200), 11),1))
ax[i].set_yticklabels(np.round(np.logspace(np.log10(50), np.log10(200), 11),1))
fig.colorbar(img, ax=ax[i], shrink=0.5)
#plt.gca().invert_yaxis()
ax[i].set_title('f = %1.f Hz' %(eval(dataname[29:34])), y = 1.05)
ax[i].tick_params(axis='both', labelsize=8)
plt.subplots_adjust(left=0.05, right=1, wspace=0.07)
ax[0].set_ylabel('membrane tau [ms]')
ax[0].set_xlabel('refractory period [ms]')
newpaths = [ path[:5] == 'decay' and path[29]=='1' for path in datapathes]
newpathes = list(np.array(datapathes)[newpaths])
fig, ax = plt.subplots(1,4)
for i, dataname in enumerate(newpathes):
data = pd.read_csv(savepath+'\\'+dataname)
print(data[:10], np.max(np.max(data)), np.min(np.min(data)))
img = ax[i].imshow(data, extent = [0,data.shape[0],
data.shape[1],0], vmin = 0, vmax = 13)
ax[i].xaxis.tick_top()
ax[i].set_xticks(np.arange(0,data.shape[0]+1,4))
ax[i].set_yticks(np.arange(0,data.shape[0]+1,4))
ax[i].set_xticklabels(np.round(np.logspace(np.log10(1), np.log10(1000), 6),1))
ax[i].set_yticklabels(np.round(np.logspace(np.log10(1), np.log10(1000), 6),1))
fig.colorbar(img, ax=ax[i], shrink=0.5)
#plt.gca().invert_yaxis()
ax[i].set_title('f = %1.f Hz' %(eval(dataname[29:30+i])), y = 1.1)
ax[i].tick_params(axis='both', labelsize=8)
plt.subplots_adjust(left=0.05, right=1, wspace=0.1)
ax[0].set_ylabel('membrane tau [ms]')
ax[0].set_xlabel('refractory period [ms]')