[Chimera-users] axes

Hernando J Sosa hernando.sosa at einsteinmed.org
Fri Jul 10 13:59:41 PDT 2020

Hi Eric,

I can't find the function. Trying to call it within the chimera idle-python shell I get the following error:

>>> chimera.StructMeasure.axis()
Traceback (most recent call last):
  File "<pyshell#3>", line 2, in <module>
AttributeError: 'module' object has no attribute 'StructMeasure'

I can't see it either (or something similarly called) within the functions listed  if a do

Hernando Sosa
Dept. of Physiology and Biophysics
Albert Einstein College of Medicine
1300 Morris Park Av.
Bronx NY 10461
phone (718) 430-3456
FAX (718) 430-8819
emai:  hernando.sosa at einsteinmed.org<mailto:hernando.sosa at einsteinmed.org>

From: Eric Pettersen <pett at cgl.ucsf.edu>
Sent: Friday, July 10, 2020 4:44 PM
To: Hernando J Sosa <hernando.sosa at einsteinmed.org>
Cc: chimera-users at cgl.ucsf.edu <chimera-users at cgl.ucsf.edu>
Subject: Re: [Chimera-users] axes

CAUTION: This email comes from an external source; the attachments and/or links may compromise our secure environment. Do not open or click on suspicious emails. Please click on the “Phish Alert” button on the top right of the Outlook dashboard to report any suspicious emails.
Hi Hernando,
Mostly yes.  The function is chimera.StructMeasure.axis().  There is a doc string for the function describing its arguments and return values.  In its simplest form it takes a numpy array of xyz values and returns a Point (centroid) instance and a Vector (unit direction vector) instance.  To get a length you would also have to supply the findBounds=True keyword argument, in which case it will return two additional floating-point values, the scale factors to apply to the unit vector to get it to the approximate bounds of the axis in each direction (so one of the scale factors will be negative).
If you have a list of Atom instances, the easiest way to generate the numpy xyz array is with numpyArrayFromAtoms, e.g.:

import chimera
xyzs = chimera.numpyArrayForAtoms(atoms)

If you only really have an atom spec, let me know and I can help with how to generate a list of Atoms from that.


Eric Pettersen
UCSF Computer Graphics Lab

On Jul 10, 2020, at 11:54 AM, Hernando J Sosa <hernando.sosa at einsteinmed.org<mailto:hernando.sosa at einsteinmed.org>> wrote:

Dear Chimera,

Is there a way to run a  command within a python script equivalent to the chimera command 'define axis' to be able to retrieve the results (length,center, direction) ?  Something like:

(length,center,direction) = mydefineaxis(atomspec)



Chimera-users mailing list: Chimera-users at cgl.ucsf.edu<mailto:Chimera-users at cgl.ucsf.edu>
Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplato.cgl.ucsf.edu%2Fmailman%2Flistinfo%2Fchimera-users&data=02%7C01%7Chernando.sosa%40einsteinmed.org%7Cdf93aa552ac3413bb97708d8251216e0%7C9c01f0fd65e040c089a82dfd51e62025%7C0%7C0%7C637300106911058025&sdata=8fjGN1Ve%2B4HNUZL4ltu41pBMDoEsEFa3nY7CeNrL%2Fio%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20200710/d4cf705d/attachment.html>

More information about the Chimera-users mailing list