Exemple #1
0
layer2 = GrFNN(params2,
               frequency_range=(50,200),
               num_oscs=200)

# create a connection matrix
# C = make_connections(layer1, layer2, 1, 1.005, self_connect=True)
C = np.eye(len(layer2.f), len(layer1.f))


# Make the model
model = Model()
model.add_layer(layer1, input_channel=0)  # layer one will receive the external stimulus
model.add_layer(layer2)  # layer 2 is a hidden layer (no external input)

# connect the layers
conn = model.connect_layers(layer1, layer2, C, '1freq', self_connect=True)
plot_connections(conn, title='Connection matrix (abs)')

# prepare real-time plots
GrFNN_RT_plot(layer1, update_interval=0.005, title='First Layer')
GrFNN_RT_plot(layer2, update_interval=0.005, title='Second Layer')


# 3. Run the model

model.run(s, t, dt)


## Profile
# cmd = "model.run(s, t, dt)"
# import cProfile