Exemple #1
0
plt.ylim(0, ymax)
plt.title('Robot controlled by spiking neurons')
plt.xlabel('X')
plt.ylabel('Y')
for Ob in Env.Obs:
    plt.scatter(Ob['x'], Ob['y'], s=np.pi * (Ob['r']**2), c='lime')

plt.ion()
plt.show()

## SIMULATE
print 'Start Simulation'
for t in xrange(len(T)):
    # Input from Sensors
    # SL, SR = RobotGetSensors(Env, x[t], y[t], w[t], xmax, ymax)
    SL, SR = Env.GetSensors(x[t], y[t], w[t])

    # Carry over firings that might not have reached their targets yet
    for lr in xrange(L):
        firings = []
        for f in net.layer[lr].firings:
            # discard all earlier firings
            if f[0] > dt - Dmax:
                # also decrease the time so that it is in -Dmax to -1
                f[0] = f[0] - dt
                firings.append(f)
        net.layer[lr].firings = np.array(firings)

    for t2 in xrange(dt):
        # Deliver stimulus as a Poisson spike stream
        net.layer[0].I = rn.poisson(SL * 15, N0)