forked from KaliLab/HippoUnit_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModelLoader_Poirazi_2003_CA1.py
executable file
·128 lines (87 loc) · 4.25 KB
/
ModelLoader_Poirazi_2003_CA1.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Use this class (instead of the ModelLoader class of hippounit.utils) to test the Poirazi et al. 2003 model using its own receptor models in the Oblique Integration Test. This new version of the synapse functions of the ModelLoader class of HippoUnit can deal with the different (a bit outdated way using pointers) activation of the receptor models (point processes). This child class inherits from the ModelLoader class.
from __future__ import division
from builtins import range
from hippounit.utils import ModelLoader
from neuron import h
import numpy
class ModelLoader_Poirazi_2003_CA1(ModelLoader):
def __init__(self, name="model", mod_files_path = None):
#Load cell model
ModelLoader.__init__(self, name="model", mod_files_path=mod_files_path)
super(ModelLoader_Poirazi_2003_CA1, self).__init__(name=name, mod_files_path=mod_files_path)
def set_multiple_ampa_nmda(self, dend_loc, number, AMPA_weight):
"""Used in ObliqueIntegrationTest"""
ndend, xloc, loc_type = dend_loc
h("Deadtime_GLU = 0.025")
h("Deadtime_NMDA = 0.025")
exec("self.dendrite=h." + ndend)
for i in range(number):
if self.AMPA_name: # if this is given, the AMPA model defined in a mod file is used, else the built in Exp2Syn
exec("self.ampa_list[i] = h."+self.AMPA_name+"(xloc, sec=self.dendrite)")
self.ampa_list[i].gmax = AMPA_weight
# self.ampa_list[i].Deadtime = 0.025
else:
self.ampa_list[i] = h.Exp2Syn(xloc, sec=self.dendrite)
self.ampa_list[i].tau1 = self.AMPA_tau1
self.ampa_list[i].tau2 = self.AMPA_tau2
#print 'The built in Exp2Syn is used as the AMPA component. Tau1 = ', self.AMPA_tau1, ', Tau2 = self.AMPA_tau2.'
exec("self.nmda_list[i] = h."+self.NMDA_name+"(xloc, sec=self.dendrite)")
self.nmda_list[i].gmax = AMPA_weight/self.AMPA_NMDA_ratio
# self.nmda_list[i].Deadtime = 0.025
self.ndend = ndend
self.xloc = xloc
def set_pointers(self, interval, number, AMPA_weight):
"""Used in ObliqueIntegrationTest"""
self.fakecell = h.Section(name='fakecell')
for i in range(number):
self.epsp_ic[i] = h.IClamp(self.fakecell(0.5))
self.epsp_ic[i].amp = 1
self.epsp_ic[i].dur = 0.05 # let it be shorter than the interval bw synapse activation
self.epsp_ic[i].delay = self.start + (i*interval)
# print self.ampa_list[i].gmax
# h.setpointer(self.ampa_list[i].pre, self.epsp_ic[i].i)
# h.setpointer(self.nmda_list[i].pre, self.epsp_ic[i].i)
h.setpointer(self.epsp_ic[i]._ref_i, 'pre', self.ampa_list[i])
h.setpointer(self.epsp_ic[i]._ref_i, 'pre', self.nmda_list[i])
# print "pointer is set"
def run_multiple_syn(self, dend_loc, interval, number, weight):
"""Used in ObliqueIntegrationTest"""
self.ampa_list = [None] * number
self.nmda_list = [None] * number
self.ns_list = [None] * number
self.epsp_ic = [None] * number
self.initialise()
if self.cvode_active:
h.cvode_active(1)
else:
h.cvode_active(0)
self.set_multiple_ampa_nmda(dend_loc, number, weight)
self.set_pointers(interval, number, weight)
exec("self.sect_loc=h." + str(self.soma)+"("+str(0.5)+")")
# initiate recording
rec_t = h.Vector()
rec_t.record(h._ref_t)
rec_v = h.Vector()
rec_v.record(self.sect_loc._ref_v)
rec_v_dend = h.Vector()
rec_v_dend.record(self.dendrite(self.xloc)._ref_v)
# rec_i = h.Vector()
# rec_i.record(self.epsp_ic[0]._ref_i)
h.stdinit()
dt = 0.025
h.dt = dt
h.steps_per_ms = 1/dt
h.v_init = self.v_init #-80
h.celsius = self.celsius
h.init()
h.tstop =500
h.run()
# get recordings
t = numpy.array(rec_t)
v = numpy.array(rec_v)
v_dend = numpy.array(rec_v_dend)
# i=numpy.array(rec_i)
# print 'vdend max', numpy.max(v_dend)
# print 'i max', numpy.max(i)
# print 'i min', numpy.min(i)
return t, v, v_dend