 # Disable connection after a certain amount of time

Is there any direct way to disable the connection between a node and an ensemble without actually inhibiting the ensemble?

In the setup I’m imagining, I’d have a` pre` and `post` ensemble both receiving input from a `sine` node and some learning happening on the connection between `pre` and `post`.
I would then like to turn off the input from `sine` to `post` to see if the connection between `pre` and` post` has learned to properly represent `pre` (which is still receiving input from `sine`).

Would setting the weights of the connection between `sine` and `post` achieve the desired effect?

The easiest way to do this would probably just be to have your sine node function go to 0 after some length of time, like

``````nengo.Node(lambda t: np.sin(t) if t < 1.0 else 0)
``````

(which will output `sine` for the first second and then 0 afterwards).

But I would like to maintain the sine input to pre unchanged and also outputting zero could change the representation of post.

You would create two input Nodes, one that cuts off after some length of time and one that doesn’t, like

``````input0 = nengo.Node(lambda t: np.sin(t))
input1 = nengo.Node(lambda t: np.sin(t) if t < 1.0 else 0)
``````

And then connect `input0` to `pre` and `input1` to `post`.

If you just wanted to have one source of the sine wave, you could do something like.

``````input0 = nengo.Node(lambda t: np.sin(t))
input1 = nengo.Node(lambda t, x: x if t < 1.0 else 0)
nengo.Connection(input0, input1, synapse=None)
``````

And then connect `input0` to `pre` and `input1` to `post`, same as above.

Setting the input of a Connection to zero is the same as setting the connection weights to zero (either way the output of the Connection will be zero).

Thanks! So, if I understand, there is now way of “removing” a connection at runtime? The best I can hope for is to set it to always transmit zero?
This in theory should not change the output of the post synaptic ensemble as it would be simply summing this zero to anything else it receives on other connections, correct?

That’s correct, you can’t modify a network after it has been constructed (when it is passed to the Simulator). However, setting the Connection to output zero is the same as removing it, from a functional perspective.

Awesome, thanks again! ``````input0 = nengo.Node(lambda t: np.sin(t))
input1 = nengo.Node(lambda t, x: x if t < 1.0 else 0)
nengo.Connection(input0, input1, synapse=None)
``````

This does not seem to work as I’m getting:
`nengo.exceptions.ValidationError: Node.output: output function '<function <lambda> at 0x111113400>' is expected to accept exactly 1 argument (time, as a float)`

Sorry, missed one part, you need to specify `nengo.Node((lambda t, x: x if t < 1.0 else 0), size_in=1)`