1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414import os
15- from pyNN .random import NumpyRNG
1615import pyNN .spiNNaker as sim
1716import numpy
1817import matplotlib .pyplot as pylab
2625SLOWDOWN_PLASTIC = 10
2726
2827# bool hard code for extracting the weights or not
29- EXTRACT_WEIGHTS = False
30- GENERATE_PLOT = False
28+ EXTRACT_WEIGHTS = True
29+ GENERATE_PLOT = True
3130
3231# how many boards to use for this test
3332N_BOARDS = 1
@@ -115,39 +114,36 @@ def _build_network(self, uses_stdp, slow_down):
115114 sim .set_number_of_neurons_per_core (
116115 sim .IF_curr_exp , self .N_NEURONS_PER_CORE )
117116
118- rng = NumpyRNG ( 59 )
117+ rng_seed = 59
119118
120119 # Create excitatory and inhibitory populations of neurons
121120 ex_pop = sim .Population (
122121 self .NUM_EXCITATORY , self .MODEL (** self .CELL_PARAMETERS ),
123- label = "excit_pop" )
122+ label = "excit_pop" , seed = rng_seed )
124123 in_pop = sim .Population (
125124 self .NUM_INHIBITORY , self .MODEL (** self .CELL_PARAMETERS ),
126- label = "inhib_pop" )
125+ label = "inhib_pop" , seed = rng_seed )
127126
128127 # Record excitatory spikes
129128 ex_pop .record (['spikes' ])
130129 in_pop .record (['spikes' ])
131130
132- # create seeder
133- # rng_seeder = NumpyRNG(seed=self.RANDOM_NUMBER_GENERATOR_SEED)
134-
135131 # Make excitatory->inhibitory projections
136132 proj1 = sim .Projection (
137133 ex_pop , in_pop ,
138- sim .FixedProbabilityConnector (0.02 , rng = rng ),
134+ sim .FixedProbabilityConnector (0.02 ),
139135 receptor_type = 'excitatory' ,
140136 synapse_type = sim .StaticSynapse (weight = 0.029 ))
141137 proj2 = sim .Projection (
142138 ex_pop , ex_pop ,
143- sim .FixedProbabilityConnector (0.02 , rng = rng ),
139+ sim .FixedProbabilityConnector (0.02 ),
144140 receptor_type = 'excitatory' ,
145141 synapse_type = sim .StaticSynapse (weight = 0.029 ))
146142
147143 # Make inhibitory->inhibitory projections
148144 proj3 = sim .Projection (
149145 in_pop , in_pop ,
150- sim .FixedProbabilityConnector (0.02 , rng = rng ),
146+ sim .FixedProbabilityConnector (0.02 ),
151147 receptor_type = 'inhibitory' ,
152148 synapse_type = sim .StaticSynapse (weight = - 0.29 ))
153149
@@ -163,7 +159,7 @@ def _build_network(self, uses_stdp, slow_down):
163159 # Make inhibitory->excitatory projection
164160 ie_projection = sim .Projection (
165161 in_pop , ex_pop ,
166- sim .FixedProbabilityConnector (0.02 , rng = rng ),
162+ sim .FixedProbabilityConnector (0.02 ),
167163 receptor_type = 'inhibitory' , synapse_type = stdp_model )
168164
169165 # return the excitatory population and the inhibitory->excitatory
@@ -348,9 +344,8 @@ def plot(
348344 pylab .show ()
349345
350346
351- if __name__ == "__main__" :
352- x = Vogels2011 ()
353- result_weights , static , plastic = x .run (
354- SLOWDOWN_STATIC , SLOWDOWN_PLASTIC , EXTRACT_WEIGHTS )
355- if GENERATE_PLOT :
356- x .plot (result_weights , static , plastic )
347+ x = Vogels2011 ()
348+ result_weights , static , plastic = x .run (
349+ SLOWDOWN_STATIC , SLOWDOWN_PLASTIC , EXTRACT_WEIGHTS )
350+ if GENERATE_PLOT :
351+ x .plot (result_weights , static , plastic )
0 commit comments