def measure_tae(): print "Measuring initial perception of all orientations..." before=test_all_orientations(0.0,0.0) pylab.figure(figsize=(5,5)) vectorplot(degrees(before.keys()), degrees(before.keys()),style="--") # add a dashed reference line vectorplot(degrees(before.values()),degrees(before.keys()),\ title="Initial perceived values for each orientation") print "Adapting to pi/2 gaussian at the center of retina for 90 iterations..." for p in ["LateralExcitatory","LateralInhibitory","LGNOnAfferent","LGNOffAfferent"]: # Value is just an approximate match to bednar:nc00; not calculated directly topo.sim["V1"].projections(p).learning_rate = 0.005 inputs = [pattern.Gaussian(x = 0.0, y = 0.0, orientation = pi/2.0, size=0.088388, aspect_ratio=4.66667, scale=1.0)] topo.sim['Retina'].input_generator.generators = inputs topo.sim.run(90) print "Measuring adapted perception of all orientations..." after=test_all_orientations(0.0,0.0) before_vals = array(before.values()) after_vals = array(after.values()) diff_vals = before_vals-after_vals # Sign flipped to match conventions pylab.figure(figsize=(5,5)) pylab.axvline(90.0) pylab.axhline(0.0) vectorplot(wrap(-90.0,90.0,degrees(diff_vals)),degrees(before.keys()),\ title="Difference from initial perceived value for each orientation")
def measure_dae(scale=0.6): print "Measuring initial perception of all directions..." before=test_all_directions(0.0,0.0,scale) pylab.figure(figsize=(5,5)) vectorplot(degrees(before.keys()), degrees(before.keys()),style="--") # add a dashed reference line vectorplot(degrees(before.values()),degrees(before.keys()),\ title="Initial perceived values for each direction") print "Adapting to pi/2 gaussian at the center of retina for 90 iterations..." for p in ["LateralExcitatory","LateralInhibitory", "LGNOnAfferent0","LGNOffAfferent0", "LGNOnAfferent1","LGNOffAfferent1", "LGNOnAfferent2","LGNOffAfferent2", "LGNOnAfferent3","LGNOffAfferent3"]: # Value is just an approximate match to bednar:nc00; not calculated directly topo.sim["V1"].projections(p).learning_rate = 0.005 ## g = pattern.Gaussian(x=0.0,y=0.0,orientation=pi/2.0,size=0.088388, ## aspect_ratio=4.66667,scale=1.0) g = pattern.SineGrating(frequency=2.4,phase=0.0,orientation=pi/2,scale=scale) for j in range(4): topo.sim['Retina%s'%j].set_input_generator(pattern.Sweeper( generator=copy.deepcopy(g), speed=2.0/24.0, step=j)) topo.sim.run(90) print "Measuring adapted perception of all directions..." after=test_all_directions(0.0,0.0,scale) before_vals = array(before.values()) after_vals = array(after.values()) diff_vals = before_vals-after_vals # Sign flipped to match conventions pylab.figure(figsize=(5,5)) pylab.axvline(180.0) pylab.axhline(0.0) vectorplot(wrap(-2*90.0,2*90.0,degrees(diff_vals)),degrees(before.keys()),\ title="Difference from initial perceived value for each direction")