-
Notifications
You must be signed in to change notification settings - Fork 123
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
RxD indexing bug? #3337
base: master
Are you sure you want to change the base?
RxD indexing bug? #3337
Conversation
@@ -431,7 +431,7 @@ def node_by_ijk(self, i, j, k): | |||
index += (i * e._ny + j) * e._nz + k | |||
else: | |||
e = ecs._region | |||
index += e._nz * e._ny * e._nz | |||
index += e._nx * e._ny * e._nz |
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.
Seems like an obviously correct fix. But the incremental indexing over the ecs loop this is embedded in is not clear to me at all. E.g I don't really know what is going on in this loop but I would have expected to break out of the loop at the end of the ecs == s fragment. So I guess this needs the author of this code to chime in. Do the rxd tests cover this code?
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 think Michael is right. @Hjorthmedh could you tell us more about the context in which you stumbled across this?
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.
We were digging through the code to understand how to use the extracellular feature in RxD. The line updated above jumped out at us when we were looking at the code as wrong.
I do not know the full context of this code, but from what I can see it looks like you need to find the index into the array storing all the nodes. And that the species appear to be stored one after the other, in an array (ie to get to the next species you need to step forward nxnynz.
I agree @nrnhines, there should be a break statement in the if, so I updated the pull-request. Otherwise the loop will keep increasing the index with (nxnynz) after it matched the requested ecs? But someone else please verify that we are correct.
@ramcdougal : Do you have unit tests that cover this function, and do they deal with non-cubic volumes?
|
We found a potential RxD bug...
#3335
Here is a suggestion for a fix. @ramcdougal