Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset system and rerun with different whitenoise signal #582

Closed
studywolf opened this issue Dec 10, 2014 · 1 comment
Closed

Reset system and rerun with different whitenoise signal #582

studywolf opened this issue Dec 10, 2014 · 1 comment

Comments

@studywolf
Copy link
Collaborator

I was wanting to run a single simulation a bunch of times, with the same neurons but with random noise that was different between runs. sim.reset() also reset the noise, so I used this workaround:

other_t = np.random.random()

with m:

    ...

    from nengo.utils.functions import whitenoise
    noise_func = whitenoise(0.1, 10, .001, dimensions=2)
    def func(t):
        print other_t
        return noise_func(t + other_t)
    noisenode = nengo.Node(output=func)

    ...

sim = nengo.Simulator(m)
for ii in range(50):
    sim.reset()
    other_t = np.random.random()
    sim.run(.75)

So this is mostly just a workaround post in case someone is looking to do this. It would be cool if there was a less hack way to do this as well!

@studywolf studywolf added this to the Wish list milestone Dec 10, 2014
@hunse
Copy link
Collaborator

hunse commented Dec 10, 2014

The issue is that whitenoise generates the input signal when it's called, not at runtime. A straightforward way to do what you want is to change the node function to a whitenoise function with a different seed, reset the simulator, and off you go. #372 allows changing node functions like this.

hunse added a commit that referenced this issue May 15, 2015
The simulator now re-makes all `step` functions on a reset, which
should reset all operators. Fixes #616.

The simulator seed (currently only used by Processes, I think) can
be changed when calling `Simulator.reset`. Fixes #582.
hunse added a commit that referenced this issue May 15, 2015
The simulator now re-makes all `step` functions on a reset, which
should reset all operators. Fixes #616.

The simulator seed (currently only used by Processes, I think) can
be changed when calling `Simulator.reset`. Fixes #582.
@hunse hunse closed this as completed in f912d1f May 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants