示例#1
0
def test_basic():
    n = IFNeuron(20)
    spike_train = []
    for i in range(1000):
        spike_train.append(n.potential)
        n.advance()
示例#2
0
import matplotlib.pyplot as plt

from neatsociety.ifnn import IFNeuron

n = IFNeuron()
times = []
currents = []
potentials = []
fired = []
for i in range(1000):
    times.append(1.0 * i)

    n.current = 0.0 if i < 100 or i > 800 else 16.0
    currents.append(n.current)

    n.advance()

    potentials.append(n.potential)
    fired.append(1.0 if n.has_fired else 0.0)

plt.subplot(3, 1, 1)
plt.title("IFNN model")
plt.ylabel("Input current")
plt.ylim(0, 20)
plt.grid()
plt.plot(times, currents, "b-", label="current")

plt.subplot(3, 1, 2)
plt.ylabel("Potential")
plt.grid()
plt.plot(times, potentials, "g-", label="potential")
示例#3
0
def test_basic():
    n = IFNeuron(20)
    spike_train = []
    for i in range(1000):
        spike_train.append(n.potential)
        n.advance()