@@ -0,0 +1,1703 @@
+%0A%0Afrom topo.inputsheet import *%0Afrom topo.kernelfactory import *%0Afrom topo.simulator import *%0Afrom topo.rfsom import RFSOM%0Afrom topo.image import ImageSaver%0Afrom math import pi%0Afrom topo.params import Dynamic%0Aimport random%0Aimport pdb #debugger%0A%0A%0A###########################################%0A# Set parameters%0A%0Aprint %22Setting parameters...%22%0A%0A# input generation params%0AInputSheet.period = 1.0%0AInputSheet.density = 900%0A%0AFuzzyLineFactory.x = Dynamic(lambda : random.uniform(-0.5,0.5))%0AFuzzyLineFactory.y = Dynamic(lambda : random.uniform(-0.5,0.5))%0A%0AFuzzyLineFactory.theta = Dynamic(lambda :random.uniform(-pi,pi))%0AFuzzyLineFactory.width = 0.02%0AFuzzyLineFactory.height = 0.9%0AFuzzyLineFactory.bounds = BoundingBox(points=((-0.8,-0.8),(0.8,0.8)))%0A%0A%0A# rf som parameters%0ARFSOM.density = 2500%0ARFSOM.weights_factory = UniformRandomFactory(bounds=BoundingBox(points=((-0.1,-0.1),(0.1,0.1))))%0ARFSOM.training_length = 10000%0ARFSOM.radius_0 = 0.1%0A%0A# image saver parameters%0AImageSaver.file_format='png'%0AImageSaver.time_format='%250.4d'%0A%0A###########################################%0A# build simulation%0A%0Abase.min_print_level = base.MESSAGE%0A%0Aprint %22Creating simulation objects...%22%0As = topo.simulator.Simulator()%0A%0Aretina = InputSheet(input_generator=FuzzyLineFactory(),name='Retina')%0AV1 = RFSOM(name='V1')%0Asave  = ImageSaver(name='RFSOM')%0A%0As.connect(retina,V1,delay=1)%0A%0A# Uncomment the connections to the image saver, to save all the activation%0A# images to disk.%0A#s.connect(retina,save,dest_port='retina',delay=2)%0A#s.connect(V1,save,dest_port='V1',delay=1)%0Atopo.gui.link_to_sim(s)%0A%0As.run(200)%0A%0A#V1.projections%5B'Retina'%5D%5B0%5D.plot_rfs()%0A%0A# import profile,pstats%0A#%0A# p = profile.Profile()%0A# p.runctx('s.run(10)',locals(),globals())%0A

Copy of rfsom_example.py except with 200 steps instead of 10000, and a topo.gui.link_to_sim() call