-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathModel_Simulator.py
93 lines (75 loc) · 2.11 KB
/
Model_Simulator.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
__author__ = "Devrim Celik"
import tkinter as tk
from sys import platform as sys_pf
if sys_pf == 'darwin':
import matplotlib
matplotlib.use("TkAgg")
from Models.LIF_Interactive import start_LIF_sim
from Models.Hodgkin_Huxley_Interactive import start_HH_sim
from Models.Izhikevich_Interactive import start_IZ_sim
from Models.FitzHugh_Nagumo_Interactive import start_FN_sim
if (__name__ == "__main__"):
####### Initialize root
root = tk.Tk()
root.title("Neuron Model Selector")
####### Size and Position of GUI
w = 450
h = 140
ws = root.winfo_screenwidth() # width of the screen
hs = root.winfo_screenheight() # height of the screen
x = (ws / 2) - (w / 2)
y = (hs / 2) - (h / 2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
####### Text
lbl = tk.Label(root, text="Please select the Model you are interested in:")
lbl.pack()
lbl.config(font=("MS Sans Serif", 20, "bold"))
####### Button events --> corresponds to displaying Model
def LIF_clicked(): # Leaky Integrate and Fire
start_LIF_sim()
def HH_clicked(): # Hodgkin-Huxely
start_HH_sim()
def IZ_clicked(): # Izhikevich
start_IZ_sim()
def FN_clicked(): # FitzHugh-Nagumo
start_FN_sim()
def close_window(root=root): # close window button
root.destroy()
####### Buttons
LIF_btn = tk.Button(
root,
text="Leaky Integrate-and-Fire Model",
command=LIF_clicked,
height=1,
width=30)
LIF_btn.pack()
HH_btn = tk.Button(
root,
text="Hodgkin-Huxley Model",
command=HH_clicked,
height=1,
width=30)
HH_btn.pack()
IZ_btn = tk.Button(
root,
text="Izhikevich Model",
command=IZ_clicked,
height=1,
width=30)
IZ_btn.pack()
FN_btn = tk.Button(
root,
text="FitzHugh-Nagumo Model",
command=FN_clicked,
height=1,
width=30)
FN_btn.pack()
EXIT_btn = tk.Button(
root,
text="Exit",
command=close_window,
height=1,
width=15)
EXIT_btn.pack()
######## start root
root.mainloop()