示例#1
0
 def testConnectTwoCells(self):
     """connect(): The first connection created should have id 0."""
     neuron.hoc_comment("=== ConnectionTest.testConnectTwoCells ===")
     conn = neuron.connect(self.precells[0], self.postcells[0])
     # conn will be an empty list if it does not exist on that node
     assert conn == [
         0
     ] or conn == [], 'Error creating connection, conn=%s' % conn
示例#2
0
 def testCreateStandardCellsWithNegative_n(self):
     """create(): n must be positive definite"""
     neuron.hoc_comment(
         '=== CreationTest.testCreateStandardCellsWithNegative_n ===')
     self.assertRaises(AssertionError,
                       neuron.create,
                       neuron.IF_curr_alpha,
                       n=-1)
示例#3
0
 def tearDown(self):
     neuron.hoc_comment("=== ConnectionTest.tearDown() ===")
     hoc_commands = ['objref cell%d\n' % i for i in neuron.gidlist]
     hoc_commands += ['netconlist = new List()']
     neuron.hoc_execute(hoc_commands, '=== ConnectionTest.tearDown() ===')
     neuron.gid = 0
     neuron.ncid = 0
     neuron.gidlist = []
示例#4
0
 def testCreateNEURONCell(self):
     """create(): First cell created should have index 0."""
     neuron.hoc_comment('=== CreationTest.testCreateNEURONCell ===')
     ifcell = neuron.create('StandardIF', {
         'syn_type': 'current',
         'syn_shape': 'exp'
     })
     assert ifcell == 0, 'Failed to create NEURON-specific cell'
示例#5
0
 def testSetFloat(self):
     neuron.hoc_comment("=== SetValueTest.testSetFloat() ===")
     neuron.set(self.cells, 'tau_m', 35.7)
     for cell in self.cells:
         try:
             assert getattr(h, 'cell%d' % cell).tau_m == 35.7
         except AttributeError:  # if cell is not on this node
             pass
示例#6
0
 def testConnectTwoCellsWithWeight(self):
     """connect(): Weight set should match weight retrieved."""
     neuron.hoc_comment(
         "=== ConnectionTest.testConnectTwoCellsWithWeight() ===")
     conn_id = neuron.connect(self.precells[0],
                              self.postcells[0],
                              weight=0.1234)
     if conn_id:
         weight = h.netconlist.object(conn_id[0]).weight[0]
         assert weight == 0.1234, "Weight set (0.1234) does not match weight retrieved (%s)" % weight
示例#7
0
 def testCreateStandardCellWithParams(self):
     """create(): Parameters set on creation should be the same as retrieved with the top-level HocObject"""
     neuron.hoc_comment(
         '=== CreationTest.testCreateStandardCellWithParams ===')
     ifcell = neuron.create(neuron.IF_curr_alpha,
                            {'tau_syn_E': 3.141592654})
     #self.assertAlmostEqual(HocToPy.get('cell%d.esyn.tau' % ifcell, 'float'), 3.141592654, places=5)
     try:
         self.assertAlmostEqual(getattr(h, 'cell%d' % ifcell).esyn.tau,
                                3.141592654,
                                places=5)
     except AttributeError:  # if the cell is not on that node
         pass
示例#8
0
 def setUp(self):
     neuron.hoc_comment("=== ConnectionTest.setUp() ===")
     self.postcells = neuron.create(neuron.IF_curr_alpha, n=3)
     self.precells = neuron.create(neuron.SpikeSourcePoisson, n=5)
示例#9
0
 def testCreateStandardCells(self):
     """create(): Creating multiple cells should return a list of integers"""
     neuron.hoc_comment('=== CreationTest.testCreateStandardCells ===')
     ifcells = neuron.create(neuron.IF_curr_alpha, n=10)
     assert ifcells == range(0, 10), 'Failed to create 10 standard cells'
示例#10
0
 def testCreateStandardCell(self):
     """create(): First cell created should have index 0."""
     neuron.hoc_comment('=== CreationTest.testCreateStandardCell() ===')
     ifcell = neuron.create(neuron.IF_curr_alpha)
     assert ifcell == 0, 'Failed to create standard cell'