@@ -0,0 +1,2427 @@
+%22%22%22%0ACreated to test the pattern presentation.%0A%0A$Id$%0A%22%22%22%0Aimport unittest, random%0Afrom topo.sheets.generatorsheet import GeneratorSheet%0Afrom topo.base.parameter import Dynamic%0Afrom topo.patterns.basic import FuzzyLineGenerator%0Afrom topo.base.boundingregion import BoundingBox%0Afrom topo.sheets.cfsom import CFSOM%0Afrom topo.patterns.random import UniformRandomGenerator%0Afrom topo.projections.kernelprojection import KernelProjection%0Aimport topo.base.object%0Afrom math import pi%0Afrom topo.patterns.patternpresent import pattern_present%0A%0Aclass TestPatternPresent(unittest.TestCase):%0A%0A    def test_pattern_present(self):%0A        GeneratorSheet.period = 1.0%0A        GeneratorSheet.density = 20*20%0A        FuzzyLineGenerator.x = Dynamic(lambda : random.uniform(-0.5,0.5))%0A        FuzzyLineGenerator.y = Dynamic(lambda : random.uniform(-0.5,0.5))%0A        FuzzyLineGenerator.theta = Dynamic(lambda :random.uniform(-pi,pi))%0A        FuzzyLineGenerator.width = 0.02%0A        FuzzyLineGenerator.bounds = BoundingBox(points=((-0.8,-0.8),(0.8,0.8)))%0A        CFSOM.density = 10*10%0A        CFSOM.learning_length = 10000%0A        CFSOM.radius_0 = 0.1%0A        KernelProjection.weights_generator = UniformRandomGenerator(bounds=BoundingBox(points=((-0.1,-0.1),(0.1,0.1))))%0A        topo.base.object.min_print_level = topo.base.object.MESSAGE%0A        s = topo.base.simulator.Simulator()%0A        retina = GeneratorSheet(input_generator=FuzzyLineGenerator(),name='Retina')%0A        retina2 = GeneratorSheet(input_generator=FuzzyLineGenerator(),name='Retina2')%0A        V1 = CFSOM(name='V1')%0A        V2 = CFSOM(name='V2')%0A        s.connect(retina,V1,delay=0.5,projection_type=KernelProjection,%0A                  projection_params=%7B'name':'R1toV1'%7D)%0A        s.connect(retina,V2,delay=0.5,projection_type=KernelProjection,%0A                  projection_params=%7B'name':'R1toV2'%7D)%0A        s.connect(retina2,V2,delay=0.5,projection_type=KernelProjection,%0A                  projection_params=%7B'name':'R2toV2'%7D)%0A        s.run(2)%0A%0A        # Want to temporarily replace this:%0A        #retina = GeneratorSheet(input_generator=FuzzyLineGenerator(),name='Retina')%0A        pattern_present(%7B'Retina':FuzzyLineGenerator()%7D,5.0)%0A%0A        %0A%0A%0Asuite = unittest.TestSuite()%0A#  Uncomment the following line of code, to disable the test if%0A#  $DISPLAY is undefined.  Used mainly for GUI testing.%0A# suite.requires_display = True%0Asuite.addTest(unittest.makeSuite(TestPatternPresent))%0A

Test patternpresent.py