コード例 #1
0
ファイル: connectors_old.py プロジェクト: tclose/PyNN
 def connect(self, projection):
     conn_array = numpy.zeros((len(self.conn_list),4))
     for i in xrange(len(self.conn_list)):
         src, tgt, weight, delay = self.conn_list[i][:]
         src = projection.pre[tuple(src)]
         tgt = projection.post[tuple(tgt)]
         conn_array[i,:] = (src, tgt, weight, delay)
     self.weights = conn_array[:,2]
     self.delays = conn_array[:,3]
     lcp = ListConnectionPredicate(conn_array[:,0:2])
     decider = pypcsim.PredicateBasedConnections(lcp)
     wiring_method = pypcsim.SimpleAllToAllWiringMethod(simulator.net)
     # pcsim does not yet deal with having lists of weights, delays, so for now we just return 0 values
     # and will set the weights, delays later
     return decider, wiring_method, self.weights, self.delays
コード例 #2
0
ファイル: connectors_old.py プロジェクト: tclose/PyNN
 def connect(self, projection):
     f = open(self.filename, 'r', 10000)
     lines = f.readlines()
     f.close()
     conn_array = numpy.zeros((len(lines),4))
     for i,line in enumerate(lines):
         single_line = line.rstrip()
         src, tgt, w, d = single_line.split("\t", 4)
         src = "[%s" % src.split("[",1)[1]
         tgt = "[%s" % tgt.split("[",1)[1]
         src = projection.pre[tuple(eval(src))]
         tgt = projection.post[tuple(eval(tgt))]
         conn_array[i,:] = (src, tgt, w, d)
     self.weights = conn_array[:,2]
     self.delays = conn_array[:,3]
     lcp = ListConnectionPredicate(conn_array[:,0:2])
     decider = pypcsim.PredicateBasedConnections(lcp)
     wiring_method = pypcsim.SimpleAllToAllWiringMethod(simulator.net)
     # pcsim does not yet deal with having lists of weights, delays, so for now we just return 0 values
     # and will set the weights, delays later
     return decider, wiring_method, self.weights, self.delays