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

Average local angle shows 'NaN' #93

Closed
Visdoom opened this issue Feb 2, 2018 · 3 comments
Closed

Average local angle shows 'NaN' #93

Visdoom opened this issue Feb 2, 2018 · 3 comments
Assignees
Labels

Comments

@Visdoom
Copy link
Contributor

Visdoom commented Feb 2, 2018

When doing

m = morphopy.Morph(data='data/C4.swc')
m.processing()
m.summary()

The summary shows a nan at the average local angle entry

...
INFO:root:    Average local angle in degree: nan
INFO:root:    Average local angle in radian: nan 
...
@huangziwei
Copy link
Collaborator

The reason the average angle is nan is because there are nan in branch angles, and that is because sometimes there are duplicate points in the swc data, so that the local vector is [0,0,0] which yields [nan, nan, nan] if we normalizing the vector.

The current fix is to check if the vector is 0 or not then decide whether normalize it, and also (although not necessary if we do the checking) change np.mean() to np.nanmean() when calculating the average of angles.

The best fix is, of course, to check if there are duplicate points in swc.

@Visdoom
Copy link
Contributor Author

Visdoom commented Feb 5, 2018

I think in the long run it would be good to provide such a fixing method, that gets rid of duplicate points.
But only as a processing function like we discussed. Should I open a new enhancement issue for that?

@huangziwei
Copy link
Collaborator

sure.

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

No branches or pull requests

2 participants