Changeset 1009
- Timestamp:
- 11/22/11 15:52:42 (6 months ago)
- Location:
- branches/0.7
- Files:
-
- 2 modified
-
examples/VAbenchmarks2-csa.py (modified) (1 diff)
-
src/connectors.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.7/examples/VAbenchmarks2-csa.py
r915 r1009 126 126 inh_cells = all_cells[n_exc:] 127 127 if benchmark == "COBA": 128 ext_stim = Population(20, SpikeSourcePoisson, {'rate' : rate, 'duration' : stim_dur},"expoisson")128 ext_stim = Population(20, SpikeSourcePoisson, {'rate' : rate, 'duration' : stim_dur}, label="expoisson") 129 129 rconn = 0.01 130 130 ext_conn = FixedProbabilityConnector(rconn, weights=0.1) 131 131 132 132 print "%s Initialising membrane potential to random values..." % node_id 133 rng = NumpyRNG(seed=rngseed, parallel_safe=parallel_safe , rank=node_id, num_processes=np)133 rng = NumpyRNG(seed=rngseed, parallel_safe=parallel_safe) 134 134 uniformDistr = RandomDistribution('uniform', [v_reset,v_thresh], rng=rng) 135 135 all_cells.initialize('v', uniformDistr) -
branches/0.7/src/connectors.py
r957 r1009 895 895 Connector.__init__(self, None, None, safe=safe, verbose=verbose) 896 896 self.cset = cset 897 if cs et.arity== 0:897 if csa.arity(cset) == 0: 898 898 #assert weights is not None and delays is not None, \ 899 899 # 'must specify weights and delays in addition to a CSA mask' … … 905 905 self.delays = common.get_min_delay() 906 906 else: 907 assert cs et.arity== 2, 'must specify mask or connection-set with arity 2'907 assert csa.arity(cset) == 2, 'must specify mask or connection-set with arity 2' 908 908 assert weights is None and delays is None, \ 909 909 "weights or delays specified both in connection-set and as CSAConnector argument" … … 923 923 def connect(self, projection): 924 924 """Connect-up a Projection.""" 925 i0 = projection.pre.first_id 926 size1 = projection.pre.last_id - i0 927 j0 = projection.post.first_id 928 targets = [j - j0 for j in projection.post] 929 930 # Cut out finite part and shift to global ids 931 c = csa.shift (i0, j0) * csa.cross ((0, size1), targets) * self.cset 932 933 if csa.arity (self.cset) == 2: 925 # Cut out finite part 926 c = csa.cross((0, projection.pre.size-1), (0, projection.post.size-1)) * self.cset 927 928 if csa.arity(self.cset) == 2: 934 929 # Connection-set with arity 2 935 930 for (i, j, weight, delay) in c: 936 projection.connection_manager.connect ( i, [j], weight, delay)931 projection.connection_manager.connect (projection.pre[i], [projection.post[j]], weight, delay) 937 932 elif CSAConnector.isConstant (self.weights) \ 938 933 and CSAConnector.isConstant (self.delays): 939 934 # Mask with constant weights and delays 940 935 for (i, j) in c: 941 projection.connection_manager.connect ( i, [j], self.weights, self.delays)936 projection.connection_manager.connect (projection.pre[i], [projection.post[j]], self.weights, self.delays) 942 937 else: 943 938 # Mask with weights and/or delays iterable … … 949 944 delays = CSAConnector.constantIterator (delays) 950 945 for (i, j), weight, delay in zip (c, weights, delays): 951 projection.connection_manager.connect ( i, [j], weight, delay)946 projection.connection_manager.connect (projection.pre[i], [projection.post[j]], weight, delay)
