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

Projects
None yet
2 participants
@Garyfallidis
Member

Garyfallidis commented Aug 13, 2014

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:

This comment has been minimized.

@arokem

arokem Aug 13, 2014

Member

You might also go with:

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

I find that slightly clearer

@arokem

This comment has been minimized.

Member

arokem commented Aug 13, 2014

Do you understand under what conditions nan appears here?

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Aug 13, 2014

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

@arokem

This comment has been minimized.

Member

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

This comment has been minimized.

Member

Garyfallidis commented Aug 13, 2014

I think it speaks by itself no?

@arokem

This comment has been minimized.

Member

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

This comment has been minimized.

Member

Garyfallidis commented Aug 13, 2014

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

Merge pull request #407 from Garyfallidis/fix_for_Jan_Schreiber
BF: fixed problem with NANs in odfdeconv

@arokem arokem merged commit 6731f5a into nipy:master Aug 13, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@arokem

This comment has been minimized.

Member

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