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

nengo.Node Docs #1663

Open
IgnacioRubioScola opened this issue Jan 13, 2021 · 1 comment
Open

nengo.Node Docs #1663

IgnacioRubioScola opened this issue Jan 13, 2021 · 1 comment

Comments

@IgnacioRubioScola
Copy link

Hi,
I am learning how to use nengo and I think that the use of implicit time argument should be explained in the documentation of Node because it is non-trivial. I found these cases in a solved issue (#212), i don't know if it is completely correct, but help me to understand.

# Case 1: constant
n = nengo.Node([0,0,0])   
nengo.Connection(n, b, fiter=None)

# Case 2: time-varying
def my_function(t):
    return np.sin(t)
n = nengo.Node(my_function) 
nengo.Connection(n, b, filter=None)

# Case 3: time-and-state-varying
def my_function(t, x):
   return np.sin(t*x)
n = nengo.Node(my_function, dimensions=1)  
nengo.Connection(a, n, filter=None)
nengo.Connection(n, b, filter=None)

Thank you!

@hunse
Copy link
Collaborator

hunse commented Feb 2, 2021

Thanks @IgnacioRubioScola, this is a good suggestion to add these details to the documentation. We've added this issue to our backlog, and plan to do this as part of the Nengo 4.0 release.

I think you've got the general idea correct. The one thing I noticed is that you've used dimensions instead of the correct size_in to set the size of your Node (we do this because a Node can have an input size that is different from its output size).

To summarize, node functions always take the simulation time t as the first input. If the node has a size_in != None then the function must also have a second argument x, which is the vector coming in to the node at the current time (the size of the vector equals size_in).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants