Hi Leonhard,

I would guess it's the formatting setting of numpy in IPython. You can see
what one float really is:

print(cmd.get_coords("1xyz")[0,0])

Cheers,

Tsjerk

On Thu, Dec 1, 2016 at 1:40 PM, Leonhard Heizinger <leonhard.heizin...@ur.de
> wrote:

> I guess formatting didn't work out as i expected. So once again and
> hopefully formatted:
>
>
> Hi!
>
> I stumbled upon some odd behavior when starting PyMol in an interactive
> IPython Session.
>
> PyMol can be launched from interactive IPython like this:
>
> In [1]: import pymol
> In [2]: from pymol import cmd
> In [3]: pymol.finish_launching()
> In [4]: cmd.fetch("1xyz")
>
> So far, everything is normal.
> However, when I want to get the coordinates of the structure the following
> happens:
>
> In [5]: cmd.get_coords("1xyz")
> Out[5]:
> array([[ 41., 25., 36.],
> [ 40., 25., 35.],
> [ 39., 24., 35.], ...,
> [ 11., 26., 67.],
> [ 4., 32., 95.],
> [ 22., 45., 49.]], dtype=float32)
>
> Even though the datatype is float32 apparently the decimals got lost
> somehow.
> The coordinates of the first atom should be: 41.511  25.152  36.876
>
> Repeating the above in a normal interactive Python Session everything
> works just fine:
>
> >>> import pymol
> >>> from pymol import cmd
> >>> pymol.finish_launching()
> >>> cmd.fetch("1xyz")
> >>> cmd.get_coords("1xyz")
> array([[ 41.51100159, 25.15200043, 36.87599945],
> [ 40.9070015 , 25.55500031, 35.56299973],
> [ 39.68399811, 24.70700073, 35.10599899], ...,
> [ 11.88700008, 26.97699928, 67.03900146],
> [ 4.45699978, 32.77299881, 95.16600037],
> [ 22.64100075, 45.7840004 , 49.03900146]], dtype=float32)
>
> As I use IPython only for debugging of PyMol scripts/plugins this is not a
> very big problem.
> Still I'm interested in what causes this strange behavior. Is it a
> problem/bug in IPython or in PyMol?
> Maybe someone has more insights here and can give clarity!
>
> Using Python 2.7.12, IPython 5.1.0 and PyMol 1.8.4.0
>
> Thanks!
>
> regards
> Leonhard
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>



-- 
Tsjerk A. Wassenaar, Ph.D.
------------------------------------------------------------------------------
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to