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

BF: fixed problem with NANs in odfdeconv #407

Merged
merged 4 commits into from
Aug 13, 2014

Conversation

Garyfallidis
Copy link
Contributor

Added tests and fix for calculation of odf_deconv when NANs are present.
This was identified by Dr. Jan Schreiber as reported in the mailing list. See discussion here: http://mail.scipy.org/pipermail/nipy-devel/2014-August/010419.html

@@ -450,6 +450,9 @@ def odf_deconv(odf_sh, R, B_reg, lambda_=1., tau=0.1, r2_term=False):
Distributions
.. [3] Descoteaux, M, PhD thesis, INRIA Sophia-Antipolis, 2008.
"""
if np.sum(np.isnan(odf_sh)) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also go with:

if np.any(np.isnan(odf_sh)):

I find that slightly clearer

@arokem
Copy link
Contributor

arokem commented Aug 13, 2014

Do you understand under what conditions nan appears here?

@Garyfallidis
Copy link
Contributor Author

Yeah, it's division by zero. When the odf_sh is divided by Z.

@arokem
Copy link
Contributor

arokem commented Aug 13, 2014

Cool - maybe add a comment on the first line of the function, right before
if np.any(np.isnan(...?

On Wed, Aug 13, 2014 at 12:06 PM, Eleftherios Garyfallidis <
notifications@github.com> wrote:

Yeah, it's division by zero. When the odf_sh is divided by Z.


Reply to this email directly or view it on GitHub
#407 (comment).

@Garyfallidis
Copy link
Contributor Author

I think it speaks by itself no?

@arokem
Copy link
Contributor

arokem commented Aug 13, 2014

I don't think so, which is why I asked (but I am generally quite slow). I suggest something like:

# odf_sh is divided by Z, in ConstrainedSphericalDeconvModel.fit, which sometimes contains 0's 

Did I get that right?

@Garyfallidis
Copy link
Contributor Author

Nearly, there @arokem. This affects only the Sharpening Deconvolution transform not the CSD.

Happy?

arokem added a commit that referenced this pull request Aug 13, 2014
BF: fixed problem with NANs in odfdeconv
@arokem arokem merged commit 6731f5a into dipy:master Aug 13, 2014
@arokem
Copy link
Contributor

arokem commented Aug 13, 2014

Yes - very happy

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

Successfully merging this pull request may close these issues.

2 participants