def testConnectWithProbability(self): """connect(): If p=0.5, it is very unlikely that either zero or the maximum number of connections should be created.""" connlist = nest.connect(self.precells, self.postcells, p=0.5) assert 0 < len(connlist) < len(self.precells) * len( self.postcells ), 'Number of connections is %d: this is very unlikely (although possible).' % len( connlist)
def testConnectTwoCellsWithDelay(self): """connect(): Delay set should match delay retrieved.""" conn_id = nest.connect(self.precells[0], self.postcells[0], delay=4.321) delay = nest.pynest.getDelay(nest.pynest.getAddress(self.precells[0]), conn_id) assert delay == 4.3, "Delay set does not match delay retrieved." # Note that delays are only stored to the precision of the timestep.
def testConnectTwoCellsWithWeight(self): """connect(): Weight set should match weight retrieved.""" conn_id = nest.connect(self.precells[0], self.postcells[0], weight=0.1234) weight = nest.pynest.getWeight( nest.pynest.getAddress(self.precells[0]), conn_id) assert weight == 0.1234 * 1000, "Weight set does not match weight retrieved." # note that pyNN.nest uses nA for weights, whereas NEST uses pA
def testConnectOneToMany(self): """connect(): Connecting one source to n targets should return a list of target ports.""" connlist = nest.connect(self.precells[0], self.postcells) assert connlist == [0, 1, 2]
def testConnectManyToOne(self): """connect(): Connecting n sources to one target should return a list of size n, each element being the target port.""" connlist = nest.connect(self.precells, self.postcells[0]) assert connlist == [0] * len(self.precells)
def testConnectTwoCells(self): """connect(): The first connection created should have id 0.""" conn = nest.connect(self.precells[0], self.postcells[0]) assert conn == 0, 'Error creating connection'
def testConnectManyToMany(self): """connect(): Connecting m sources to n targets should return a list of length m x n""" connlist = nest.connect(self.precells, self.postcells) assert connlist == [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2]