-
Notifications
You must be signed in to change notification settings - Fork 448
Update csdeconv.py #797
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
Update csdeconv.py #797
Conversation
@@ -964,7 +964,7 @@ def recursive_response(gtab, data, mask=None, sh_order=8, peak_thr=0.01, | |||
where_dwi = lazy_index(~gtab.b0s_mask) | |||
response_p = np.ones(len(n)) | |||
|
|||
for num_it in range(1, iter): | |||
for num_it in range(iter): |
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.
While you're at it, would you mind changing the name of this variable? iter
is a key-word (a function) in the language.
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.
That would break the backward compatibility of the function (it's an input), including the script I am revamping which lead me to see this. Unless we add deprecation warning and everything to it it might break more stuff than it could fix.
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.
Yes. Good point. Sigh.
@ChantalTax : could you please confirm this was your intention? |
Hey @ChantalTax - could you please confirm that this is indeed a bug fix? |
Hey! This seems indeed a bug fix, thanks! |
Great. Thanks @ChantalTax for confirming! And thanks @samuelstjean for noticing this! Is there any test you could write that would prevent this bug from recurring? |
er, not really, this just arose from the fact that matlab indexing starts from 1 and python indexing starts from 0 I think, it's just a small implementation detail overlook, not a real bug per se. |
I understand that. How did you run into this? Just by running the code, or
|
Sorry, meant to say "just by reading the code"
|
Reading the code, since it returns a whole object and the auto response returns a tuple, it was breaking a bunch of debug prints in the calling script I have to run CSD. |
OK -- thanks. I think this is fine to merge, and will wait until early next week to do so, in case anyone else has anything to add. Thanks for noticing this! |
Whoops - forgot to hit the merge button on this one! 🎄 |
In [2]: iter = 8
In [3]: range(1, iter)
Out[3]: [1, 2, 3, 4, 5, 6, 7]
In [4]: len(range(1, iter))
Out[4]: 7
So now it should do 8 iterations by default, which is what I think is originally intended.