def main(): TIMESTEPS = 30 net = nxsdk.net.net.NxNet() state_machine = StateMachine(net) out_groups = create_simulated_input(net, TIMESTEPS) state_machine.connect_in(out_groups) net.run(TIMESTEPS) net.disconnect() #create_visualization(state_machine.behaviors, state_machine.behavior_dictionary, TIMESTEPS) behavior_names = [ "look", "state_machine.look_at_object", "state_machine.recognize_object", "state_machine.learn_new_object", "state_machine.dummy", "state_machine.recognize_object", "query", "state_machine.query_memory" ] plotter = Plotter() for name in behavior_names: plotter.plot_behavior(state_machine.behavior_dictionary[name])
from dft_loihi.inputs.simulated_input import HomogeneousPiecewiseStaticInput from dft_loihi.dft.util import connect # set up the network net = nxsdk.net.net.NxNet() neurons_per_node = 1 simulated_input = HomogeneousPiecewiseStaticInput("input", net, neurons_per_node) simulated_input.add_spike_rate(0, 100) simulated_input.add_spike_rate(500, 100) simulated_input.add_spike_rate(2000, 100) simulated_input.add_spike_rate(500, 100) simulated_input.add_spike_rate(0.0, 100) simulated_input.create() node = Node("node", net, self_excitation=1.1) connect(simulated_input, node, 1.1) # run the network time_steps = 500 net.run(time_steps) net.disconnect() # plot results plotter = Plotter() plotter.add_input_plot(simulated_input) plotter.add_node_plot(node) plotter.plot()