示例#1
0
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])
示例#2
0
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()
示例#3
0
gauss_input2.create()

kernel = SelectiveKernel(amp_exc=0.495,
                         width_exc=2.5,
                         global_inh=0.2,
                         border_type="inhibition")

field = Field("field",
              net,
              domain=field_domain,
              shape=field_shape,
              kernel=kernel,
              tau_voltage=2,
              tau_current=10,
              delay=3)

connect(gauss_input1, field, 0.1, mask="one-to-one")
connect(gauss_input2, field, 0.1, mask="one-to-one")

# run the network
time_steps = 500
net.run(time_steps)
net.disconnect()

# plot results
plotter = Plotter()
plotter.add_input_plot(gauss_input1)
plotter.add_input_plot(gauss_input2)
plotter.add_field_plot(field)
plotter.plot()
示例#4
0
kernel = MultiPeakKernel(amp_exc=0.47,
                         width_exc=2.5,
                         amp_inh=-0.35,
                         width_inh=3.85,
                         border_type="zeros")

field = Field("field",
              net,
              domain=field_domain,
              shape=field_shape,
              kernel=kernel,
              tau_voltage=2,
              tau_current=10,
              delay=3)

connect(gauss_input, field, 0.06, mask="one-to-one")
connect(node, field, 0.04, mask="full")

# run the network
time_steps = 500
net.run(time_steps)
net.disconnect()

# plot results
plotter = Plotter()
plotter.add_input_plot(homogeneous_input)
plotter.add_input_plot(gauss_input)
plotter.add_field_plot(node)
plotter.add_field_plot(field)
plotter.plot()