Changeset 404
- Timestamp:
- 06/27/08 04:05:10 (5 months ago)
- Files:
-
- trunk/src/nest1/connectors.py (modified) (1 diff)
- trunk/src/nest2/connectors.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/nest1/connectors.py
r399 r404 106 106 if isinstance(projection.rng, NativeRNG): 107 107 print "Warning: use of NativeRNG not implemented. Using NumpyRNG" 108 r arr = numpy.random.uniform(0,1,(projection.pre.size*projection.post.size,))108 rng = numpy.random 109 109 else: 110 r arr = projection.rng.uniform(0,1,(projection.pre.size*projection.post.size,))110 rng = projection.rng 111 111 else: 112 rarr = numpy.random.uniform(0,1,(projection.pre.size*projection.post.size,)) 113 j = 0 112 rng = numpy.random 114 113 for post in postsynaptic_neurons: 115 source_list=[]116 idx_pre = 0117 114 distances = common.distances(projection.pre, post, self.mask, self.scale_factor, self.offset, periodic_boundaries) 118 115 func = eval("lambda d: %s" %self.d_expression) 119 116 distances[:,0] = func(distances[:,0]) 120 121 for pre in presynaptic_neurons: 122 if self.allow_self_connections or pre != post: 123 # calculate the distance between the two cells : 124 p = distances[idx_pre,0] 125 if p >= 1 or (0 < p < 1 and rarr[j] < p): 126 source_list.append(pre) 127 j += 1 128 idx_pre += 1 117 rarr = rng.uniform(0, 1, len(distances[:,0]),) 118 idx = numpy.where((distances[:,0] >= 1) | ((0 < distances[:,0]) & (distances[:,0] < 1) & (rarr < distances[:,0])))[0] 119 source_list = presynaptic_neurons[idx].tolist() 120 if self.allow_self_connections: 121 try: 122 source_list.remove(post) 123 except Exception: 124 pass 125 #for pre in presynaptic_neurons: 126 #if self.allow_self_connections or pre != post: 127 ## calculate the distance between the two cells : 128 #p = distances[idx_pre,0] 129 #if p >= 1 or (0 < p < 1 and rarr[j] < p): 130 #source_list.append(pre) 131 #j += 1 132 #idx_pre += 1 129 133 N = len(source_list) 130 134 weights = self.getWeights(N) trunk/src/nest2/connectors.py
r399 r404 130 130 else: 131 131 rng = numpy.random 132 rarr = rng.uniform(0, 1, (projection.pre.size*projection.post.size,))133 j = 0134 idx_post = 0135 132 for pre in presynaptic_neurons: 136 target_list = []137 idx_post = 0138 133 distances = common.distances(pre, projection.post, self.mask, 139 134 self.scale_factor, self.offset, … … 141 136 func = eval("lambda d: %s" %self.d_expression) 142 137 distances[0] = func(distances[0]) 143 for post in postsynaptic_neurons: 144 if self.allow_self_connections or pre != post: 138 rarr = rng.uniform(0, 1, len(distances[0,:]),) 139 idx = numpy.where((distances[0,:] >= 1) | ((0 < distances[0,:]) & (distances[0,:] < 1) & (rarr < distances[0,:])))[0] 140 target_list = postsynaptic_neurons[idx].tolist() 141 if self.allow_self_connections: 142 try: 143 target_list.remove(pre) 144 except Exception: 145 pass 146 #for post in postsynaptic_neurons: 147 # if self.allow_self_connections or pre != post: 145 148 # calculate the distance between the two cells : 146 p = distances[0,idx_post]147 if p >= 1 or (0 < p < 1 and rarr[j] < p):148 target_list.append(post)149 j += 1150 idx_post += 1149 # p = distances[0,idx_post] 150 # if p >= 1 or (0 < p < 1 and rarr[j] < p): 151 # target_list.append(post) 152 # j += 1 153 # idx_post += 1 151 154 N = len(target_list) 152 155 weights = self.getWeights(N)

