Changeset 399
- Timestamp:
- 06/26/08 14:52:10 (5 months ago)
- Files:
-
- trunk/src/common.py (modified) (1 diff)
- trunk/src/nest1/__init__.py (modified) (1 diff)
- trunk/src/nest1/connectors.py (modified) (3 diffs)
- trunk/src/nest2/connectors.py (modified) (3 diffs)
- trunk/src/neuron2/connectors.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/common.py
r398 r399 1414 1414 # given by the user to look for some key function and add numpy 1415 1415 # in front of them (or add from numpy import *) 1416 func = ['exp','log','sin','cos','cosh','sinh','tan','tanh']1417 for item in func:1418 self.d_expression = self.d_expression.replace(item,"numpy.%s" %item)1416 #func = ['exp','log','sin','cos','cosh','sinh','tan','tanh'] 1417 #for item in func: 1418 #self.d_expression = self.d_expression.replace(item,"numpy.%s" %item) 1419 1419 self.allow_self_connections = allow_self_connections 1420 1420 self.mask = DistanceDependentProbabilityConnector.AXES[axes] trunk/src/nest1/__init__.py
r390 r399 823 823 """ 824 824 print "\n------- Population description -------" 825 print "Population called %s is made of %d cells" %(self.label, len(self.cell ))825 print "Population called %s is made of %d cells" %(self.label, len(self.cell.flatten())) 826 826 print "-> Cells are aranged on a %dD grid of size %s" %(len(self.dim), self.dim) 827 827 print "-> Celltype is %s" %self.celltype 828 828 print "-> Cell Parameters used for cell[0] (during initialization and now) are: " 829 829 for key, value in self.cellparams.items(): 830 print "\t|", key, "\t: ", "init->", value, "\t now->", pynest.getDict([self.cell [0]])[0][key]830 print "\t|", key, "\t: ", "init->", value, "\t now->", pynest.getDict([self.cell.flatten()[0]])[0][key] 831 831 print "--- End of Population description ----" 832 832 trunk/src/nest1/connectors.py
r392 r399 8 8 from pyNN.random import RandomDistribution, NativeRNG 9 9 from math import * 10 from numpy import arccos, arcsin, arctan, arctan2, ceil, cos, cosh, e, exp, \ 11 fabs, floor, fmod, hypot, ldexp, log, log10, modf, pi, power, \ 12 sin, sinh, sqrt, tan, tanh 10 13 11 14 common.get_min_delay = get_min_delay … … 94 97 if periodic_boundaries is True: 95 98 dimensions = projection.post.dim 96 periodic_boundaries = numpy.concatenate((dimensions, numpy.zeros(3-len(dimensions))))99 periodic_boundaries = tuple(numpy.concatenate((dimensions, numpy.zeros(3-len(dimensions))))) 97 100 if periodic_boundaries: 98 print "Periodic boundaries set to size ", periodic_boundaries101 print "Periodic boundaries activated and set to size ", periodic_boundaries 99 102 postsynaptic_neurons = numpy.reshape(projection.post.cell,(projection.post.cell.size,)) 100 103 presynaptic_neurons = numpy.reshape(projection.pre.cell,(projection.pre.cell.size,)) … … 113 116 idx_pre = 0 114 117 distances = common.distances(projection.pre, post, self.mask, self.scale_factor, self.offset, periodic_boundaries) 118 func = eval("lambda d: %s" %self.d_expression) 119 distances[:,0] = func(distances[:,0]) 120 115 121 for pre in presynaptic_neurons: 116 122 if self.allow_self_connections or pre != post: 117 123 # calculate the distance between the two cells : 118 d = distances[idx_pre][0] 119 p = eval(self.d_expression) 124 p = distances[idx_pre,0] 120 125 if p >= 1 or (0 < p < 1 and rarr[j] < p): 121 126 source_list.append(pre) 122 #projection._targets.append(post)123 #projection._targetPorts.append(pynest.connectWD(pre_addr, post_addr, weight, delay))124 127 j += 1 125 128 idx_pre += 1 trunk/src/nest2/connectors.py
r398 r399 12 12 from pyNN.random import RandomDistribution, NativeRNG 13 13 from math import * 14 from numpy import arccos, arcsin, arctan, arctan2, ceil, cos, cosh, e, exp, \ 15 fabs, floor, fmod, hypot, ldexp, log, log10, modf, pi, power, \ 16 sin, sinh, sqrt, tan, tanh 14 17 15 18 def _convertWeight(w, synapse_type): … … 113 116 if periodic_boundaries is True: 114 117 dimensions = projection.post.dim 115 periodic_boundaries = numpy.concatenate((dimensions, numpy.zeros(3-len(dimensions))))118 periodic_boundaries = tuple(numpy.concatenate((dimensions, numpy.zeros(3-len(dimensions))))) 116 119 if periodic_boundaries: 117 print "Periodic boundaries set to size ", periodic_boundaries120 print "Periodic boundaries activated and set to size ", periodic_boundaries 118 121 postsynaptic_neurons = projection.post.cell.flatten() # array 119 122 presynaptic_neurons = projection.pre.cell.flat # iterator … … 139 142 distances[0] = func(distances[0]) 140 143 for post in postsynaptic_neurons: 141 #probabilities = map(func,distances[0])142 144 if self.allow_self_connections or pre != post: 143 145 # calculate the distance between the two cells : 144 #d = distances[0][idx_post] 145 #p = eval(self.d_expression) 146 p = distances[0][idx_post] 146 p = distances[0,idx_post] 147 147 if p >= 1 or (0 < p < 1 and rarr[j] < p): 148 148 target_list.append(post) 149 #projection._targets.append(post)150 #projection._target_ports.append(nest.connect(pre_addr,post_addr))151 #nest.ConnectWD([pre],[post], [weight], [delay])152 149 j += 1 153 150 idx_post += 1 trunk/src/neuron2/connectors.py
r392 r399 124 124 if periodic_boundaries is True: 125 125 dimensions = projection.post.dim 126 periodic_boundaries = numpy.concatenate((dimensions, numpy.zeros(3-len(dimensions))))126 periodic_boundaries = tuple(numpy.concatenate((dimensions, numpy.zeros(3-len(dimensions))))) 127 127 if periodic_boundaries: 128 print "Periodic boundaries set to size ", periodic_boundaries 129 j = 0 128 print "Periodic boundaries activated and set to size ", periodic_boundaries 130 129 # this is not going to work for parallel sims 131 130 # either build up d gradually by iterating over local target cells,

