@@ -100,7 +100,7 @@ def setup(self):
100100 self .sim = ephys .simulators .NrnSimulator ()
101101
102102 def test_instantiate (self ):
103- """ephys.locations.NrnSomaDistanceCompLocation : test instantiate"""
103+ """ephys.locations.NrnSeclistCompLocation : test instantiate"""
104104
105105 # Create a little test class with a soma and two dendritic sections
106106 class Cell (object ):
@@ -128,6 +128,50 @@ class Cell(object):
128128 soma_comp = self .loc .instantiate (sim = self .sim , icell = cell )
129129
130130
131+ @pytest .mark .unit
132+ class TestNrnSeclistSecLocation (object ):
133+
134+ """Test class for NrnSeclistSecLocation"""
135+
136+ def setup (self ):
137+ """Setup"""
138+ self .loc = ephys .locations .NrnSeclistSecLocation (
139+ name = 'test' ,
140+ seclist_name = 'somatic' ,
141+ sec_index = 0 )
142+ self .loc_dend = ephys .locations .NrnSeclistSecLocation (
143+ name = 'test' ,
144+ seclist_name = 'basal' ,
145+ sec_index = 1 )
146+ assert self .loc .name == 'test'
147+ self .sim = ephys .simulators .NrnSimulator ()
148+
149+ def test_instantiate (self ):
150+ """ephys.locations.NrnSeclistSecLocation: test instantiate"""
151+
152+ # Create a little test class with a soma and two dendritic sections
153+ class Cell (object ):
154+ """Cell class"""
155+ pass
156+
157+ cell = Cell ()
158+ soma = self .sim .neuron .h .Section ()
159+ dend1 = self .sim .neuron .h .Section (name = 'dend1' )
160+ dend2 = self .sim .neuron .h .Section (name = 'dend2' )
161+
162+ cell .somatic = self .sim .neuron .h .SectionList ()
163+ cell .somatic .append (soma )
164+ cell .basal = self .sim .neuron .h .SectionList ()
165+ cell .basal .append (dend1 )
166+ cell .basal .append (dend2 )
167+
168+ soma_comp = self .loc .instantiate (sim = self .sim , icell = cell )
169+ assert soma_comp == soma
170+
171+ dend_comp = self .loc_dend .instantiate (sim = self .sim , icell = cell )
172+ assert dend_comp == dend2
173+
174+
131175@pytest .mark .unit
132176class TestNrnSomaDistanceCompLocation (object ):
133177
@@ -172,6 +216,62 @@ class Cell(object):
172216 assert comp == dend2 (0.5 )
173217
174218
219+ @pytest .mark .unit
220+ class TestNrnSecSomaDistanceCompLocation (object ):
221+
222+ """Test class for NrnSecSomaDistanceCompLocation"""
223+
224+ def setup (self ):
225+ """Setup"""
226+ self .loc = ephys .locations .NrnSecSomaDistanceCompLocation (
227+ 'test' ,
228+ 125 ,
229+ 1 ,
230+ 'testdend' )
231+ self .loc_other = ephys .locations .NrnSecSomaDistanceCompLocation (
232+ 'test' ,
233+ 250 ,
234+ 4 ,
235+ 'testdend' )
236+ assert self .loc .name == 'test'
237+ self .sim = ephys .simulators .NrnSimulator ()
238+
239+ def test_instantiate (self ):
240+ """ephys.locations.NrnSomaDistanceCompLocation: test instantiate"""
241+
242+ # Create a little test class with a soma and two dendritic sections
243+ class Cell (object ):
244+
245+ """Cell class"""
246+ pass
247+ cell = Cell ()
248+ soma = self .sim .neuron .h .Section (name = "soma[0]" )
249+ cell .soma = [soma ]
250+ cell .testdend = self .sim .neuron .h .SectionList ()
251+ dend1 = self .sim .neuron .h .Section (name = 'dend[0]' )
252+ dend2 = self .sim .neuron .h .Section (name = 'dend[1]' )
253+ dend3 = self .sim .neuron .h .Section (name = 'dend[2]' )
254+ dend4 = self .sim .neuron .h .Section (name = 'dend[3]' )
255+ dend5 = self .sim .neuron .h .Section (name = 'dend[4]' )
256+
257+ cell .testdend .append (sec = dend1 )
258+ cell .testdend .append (sec = dend2 )
259+ cell .testdend .append (sec = dend3 )
260+ cell .testdend .append (sec = dend4 )
261+ cell .testdend .append (sec = dend5 )
262+
263+ dend1 .connect (soma (0.5 ), 0.0 )
264+ dend2 .connect (dend1 (1.0 ), 0.0 )
265+ dend3 .connect (dend1 (1.0 ), 0.0 )
266+ dend4 .connect (dend3 (1.0 ), 0.0 )
267+ dend5 .connect (dend4 (1.0 ), 0.0 )
268+
269+ comp = self .loc .instantiate (sim = self .sim , icell = cell )
270+ assert comp == dend2 (0.5 )
271+ comp = self .loc_other .instantiate (sim = self .sim , icell = cell )
272+ assert comp == dend4 (0.5 )
273+
274+
175275@pytest .mark .unit
176276def test_serialize ():
177277 """ephys.locations: Test serialize functionality"""
0 commit comments