helanal analysis module

136 views
Skip to first unread message

Xavier Deupi

unread,
Apr 11, 2013, 11:21:23 AM4/11/13
to mdnalysis-...@googlegroups.com
Hi all,

I am interested in using the HelAnal module in MDAnalysis. I am trying to run some simple tests before using it on MD trajectories, but I find an error message that I cannot figure out. My very simple script is:

import MDAnalysis
import MDAnalysis.analysis.helanal
u = MDAnalysis.Universe("helix5.pdb")
MDAnalysis.analysis.helanal.helanal_main("helix5.pdb", selection='name CA', start=192, end=223, ref_axis=None, permissive=False)

I get the following message:

Analysing 32/32 residues
[ 0.03710163 -0.38496059 -0.92218697]
[ 0.03710163 -0.38496059 -0.92218697]
Traceback (most recent call last):
  File "mytest.py", line 4, in <module>
    MDAnalysis.analysis.helanal.helanal_main("helix5.pdb", selection='name CA', start=192, end=223, ref_axis=None, permissive=False)
  File "/Library/Python/2.7/site-packages/MDAnalysis-0.7.7-py2.7-macosx-10.8-intel.egg/MDAnalysis/analysis/helanal.py", line 509, in helanal_main
    if i == j:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

(I printed the values of i and j right before line 509 in helanal.py; these are the two arrays at the top of the message).

I have googled the message, but all references I find refer to how NumPy compare arrays. So I am pretty sure that there is something wrong in my script. I have been trying all what I could think of, but I am stuck.

Does anybody know where is the error?

Thanks in advance,

Xavier
helix5.pdb

Danny Parton

unread,
Apr 11, 2013, 6:51:40 PM4/11/13
to mdnalysis-...@googlegroups.com
Hi Xavier,

Thanks for point this out. Looks like a bug.

Note to other mdanalysis developers: I've fixed this and pushed to the develop branch. Should this be merged into the master branch for Xavier to download? Or should we instead direct him to the develop branch? I'm not sure how merging to the master branch is done (I haven't done much development recently) - I think the release manager needs to take care of this?

The bug was because two 3-dimensional arrays were being compared, resulting in a 3-dimensional array of Booleans. Example:

i = array([0.1,0.2,0.3])
j = array([0.1,0.2,0.3])
i == j
>>> array([ True,  True,  True], dtype=bool)

Instead this should be used:

(i == j).all()
>>> True

Best,

Danny


--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To post to this group, send email to mdnalysis-...@googlegroups.com.
Visit this group at http://groups.google.com/group/mdnalysis-discussion?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Oliver Beckstein

unread,
Apr 11, 2013, 8:33:37 PM4/11/13
to mdnalysis-...@googlegroups.com
Hi Danny,

On 11 Apr, 2013, at 15:51, Danny Parton wrote:

> Thanks for point this out. Looks like a bug.

Thanks for fixing it promptly.

> Note to other mdanalysis developers: I've fixed this and pushed to the develop branch. Should this be merged into the master branch for Xavier to download?

No, master only contains releases (see https://code.google.com/p/mdanalysis/wiki/DevelopmentWorkflow for the nitty-gritty details).

> Or should we instead direct him to the develop branch?

For right now, I would suggest to check out the development branch as described under

https://code.google.com/p/mdanalysis/wiki/DevelopmentBranch

(Or manually apply the one-line fix to MDAnalysis/analysis/helanal.py in the local sources and re-install.)

> I'm not sure how merging to the master branch is done (I haven't done much development recently) - I think the release manager needs to take care of this?

Just let Séb take care of it... that's my approach :-).

Oliver

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst * orbe...@gmail.com

Danny Parton

unread,
Apr 11, 2013, 8:50:40 PM4/11/13
to mdnalysis-...@googlegroups.com
Ok, thanks Oli!

Xavier, that should fix things for you, but let us know if there any further issues.

Danny


Xavier Deupi

unread,
Apr 12, 2013, 10:31:57 AM4/12/13
to mdnalysis-...@googlegroups.com
Hi Danny and Oliver,

Thank you very much. It works fine.

I noticed that in helanal_main the individual twist angles are not printed out. I just added a print myself, but I guess it would be nice to add this in future versions of the code.

xavi


On Friday, April 12, 2013 2:50:40 AM UTC+2, Danny wrote:
Ok, thanks Oli!

Xavier, that should fix things for you, but let us know if there any further issues.

Danny
On 11 April 2013 20:33, Oliver Beckstein <orbe...@gmail.com> wrote:
Hi Danny,

On 11 Apr, 2013, at 15:51, Danny Parton wrote:

> Thanks for point this out. Looks like a bug.

Thanks for fixing it promptly.

> Note to other mdanalysis developers: I've fixed this and pushed to the develop branch. Should this be merged into the master branch for Xavier to download?

No, master only contains releases (see https://code.google.com/p/mdanalysis/wiki/DevelopmentWorkflow for the nitty-gritty details).

> Or should we instead direct him to the develop branch?

For right now, I would suggest to check out the development branch as described under

https://code.google.com/p/mdanalysis/wiki/DevelopmentBranch

(Or manually apply the one-line fix to MDAnalysis/analysis/helanal.py in the local sources and re-install.)

> I'm not sure how merging to the master branch is done (I haven't done much development recently) - I think the release manager needs to take care of this?

Just let Séb take care of it... that's my approach :-).

Oliver

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst  * orbe...@gmail.com

--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discussion+unsub...@googlegroups.com.

Oliver Beckstein

unread,
Apr 12, 2013, 11:52:40 AM4/12/13
to mdnalysis-...@googlegroups.com

On 12 Apr, 2013, at 07:31, Xavier Deupi wrote:

> I noticed that in helanal_main the individual twist angles are not printed out. I just added a print myself, but I guess it would be nice to add this in future versions of the code.

Open an issue in the Issue Tracker and paste your code there. We'll integrate it in the next version.
Reply all
Reply to author
Forward
0 new messages