layer1 = GrFNN(params1, frequency_range=(50,200), num_oscs=200, stimulus_conn_type='active') 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)
# plt.plot(t, np.real(s)) # Create a GrFNN layer layer = GrFNN(params, frequency_range=(0.5,2), num_oscs=200, stimulus_conn_type='linear') # store layer's states layer.save_states = True # True by default, but it can be disabled to save memory print(layer) # create the model and add the layer model = Model() model.add_layer(layer, input_channel=0) # setup real-time plot GrFNN_RT_plot(layer, update_interval=0.2, title='Single Layer') # run the model model.run(s, t, dt) # plot time-frequency representation (magnitude and phase) tf_detail(layer.Z, t, layer.f, t_detail=[np.max(t)/2, np.max(t)], x=np.real(s)) tf_detail(layer.Z, t, layer.f, x=np.real(s), display_op=np.angle) plt.show()