-
Notifications
You must be signed in to change notification settings - Fork 370
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
Fix spatial attribute positions of sliced NodeCollection #2415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test only creates a single neuron when it should probably create multiple neurons and then create a sliced NC from that.
@mlober @nicolossus Thanks for your reviews. I've updated with the suggested changes. Please have another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes. I still think the node collection object should be sliced first for the test, since now the NC is a standard one with size 10.
I think it would work if you added the line
nodes = nodes[::2] in the code.
If I am misunderstanding, please explain.
@mlober The test already checks positions of a NC sliced to a single node. The positions of each node are gathered to a list that can be compared to the original positions:
However, I've added a check of positions sliced with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks!
For internal consistency and efficiency, metadata of nodes in a sliced NodeCollection points to the metadata of the original NodeCollection. When getting the positions in the spatial parameter of a sliced NodeCollection, using
nodes.spatial['positions']
, positions for all nodes in the original NodeCollection is therefore returned. This PR adds a filter on the returned positions to only get positions of nodes in the sliced NodeCollection, which fixes #2414.