You can achieve this functionality by creating your own custom process. Here’s some example code to do this:
import matplotlib.pyplot as plt
import numpy as np
from nengo.processes import Process, WhiteSignal
# Custom process class
def __init__(self, t_switch, **kwargs):
# Time at which to perform the switch between the two signals
self.t_switch = t_switch
# Signal to use pre-switch
self.preswitch_signal = np.sin
# Signal to use post-switch
self.postswitch_signal = WhiteSignal(60, 3)
def make_step(self, shape_in, shape_out, dt, rng, state):
# Call the `make_step` method of any Process used. The `make_step` method
# creates the function that is actually called when the simulator evaluates one
# timestep. In this instance, `self.postswitch_signal` is a `nengo.Process`, so
# we call the `make_step` method for that.
postswitch_step = self.postswitch_signal.make_step(shape_in, shape_out, dt, rng, state)
# The function returned to the simulator to call for this custom process
if t < self.t_switch:
return self.preswitch_signal(t * 3 * np.pi)
# Define the Nengo model
with nengo.Network() as model:
# Make a nengo node with our custom process
in_node = nengo.Node(SignalSwitchProcess(2))
p_in = nengo.Probe(in_node)
# Run the simulation
with nengo.Simulator(model) as sim:
# Plot the figures
And here is some sample output:
Note that this code does not bother to deal with the discontinuity at $t=2s$ when the signal switches over from one to the other.
Let me know if you have any further questions regarding the code!
Note: This code has been super quickly slapped together, so it hard codes several function parameters, but you get the idea.