Re: [PyMOL] Starting PyMol in interactive IPython Session

2016-12-01 Thread Leonhard Heizinger
Hi Tsjerk,

thanks for your reply!

this was also my first guess. However it isn't a formatting issue:

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

41.0

Also fetched structures look "teared" in cartoon representation,
supposedly because of the wrong coordinates.

Calling the internal function from the _cmd.so C-lib also returns the
wrong coords:

>>> pymol._cmd.get_coords(cmd._COb, "1xyz")

array([[ 41., 25., 36.], [ 40., 25., 35.], [ 39., 24., 35.], ..., [ 11.,
26., 67.], [ 4., 32., 95.], [ 22., 45., 49.]], dtype=float32)

The error occurs both with local loaded pdb files and fetched pdb files.
(I initially supposed it had something to do with the fetch function of
the psicio plugin, which overloads the original fetch command)

So there must be something wrong with the loading of the pdb, when using
IPython...


regards

Leonhard


On 01.12.2016 16:35, Tsjerk Wassenaar wrote:
> 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
>
>

--
___
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

Re: [PyMOL] Starting PyMol in interactive IPython Session

2016-12-01 Thread Tsjerk Wassenaar
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.8878, 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

Re: [PyMOL] Starting PyMol in interactive IPython Session

2016-12-01 Thread Leonhard Heizinger
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.8878, 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

[PyMOL] Starting PyMol in interactive IPython Session

2016-12-01 Thread Leonhard Heizinger
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.8878, 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