Change node value programmatically

Hi Manos,

Welcome to the Nengo forum!

Could you provide a few details about your problem? Are you working in the Nengo GUI? Is this code fully written in Nengo, or are you using the NengoDL Keras converter?

To programatically change the value of a Node, you can set or change the Node’s output parameter, which is the first argument to the constructor. For example,

constant1_node = nengo.Node([0.5])
constant3_node = nengo.Node([0.1, 0.3, 0.5])
function_node = nengo.Node(lambda t: np.sin(t))
process_node = nengo.Node(
    nengo.processes.WhiteSignal(period=10, high=5)
)

constant1_node will return a constant 1-dimensional (scalar) value of 0.5; constant3_node will return a constant 3-dimensional (vector) value.

Nodes can also use functions to determine their output, as demonstrated by function_node, which outputs a sine wave (the input for node functions is the simulation time t, unless you set the size_in of the node to allow you to connect other things into it).

Processes are a Nengo tool that allow you to implement arbitrary systems with state that are linear or non-linear, time-dependent or time-invariant; process_node demonstrates a WhiteSignal process, which generates a periodic (here with period 10 seconds) signal that is white (equal power at all frequencies) below the cutoff frequency given by high (here 5 Hz).