Re: Slither with matplotlib.mlab.PCA makes IDL crash [message #88862 is a reply to message #88851] |
Fri, 27 June 2014 06:17   |
Fabzi
Messages: 305 Registered: July 2010
|
Senior Member |
|
|
Folks,
I tried the code on python 2.7 as well without success. If someone has
slither, numpy and matplotlib installed I would be really interested to
know what happens when the following code is executed on another machine
(works for python 2.7 and 3.3):
IDL> py = pyimport('__main__')
py->exec, 'import matplotlib.mlab as mlab'
py->exec, 'import numpy as np'
py->exec, 'import random as r'
py->exec, 'n = 50'
py->exec, 'a = np.array([r.random() for i in range(n)]).reshape(1,n)'
py->exec, 'b = np.array([r.random() for i in range(n)]).reshape(1,n)'
py->exec, 'r = np.concatenate((a,b), 0).transpose()'
py->exec, 'p = mlab.PCA(r)' ; it crashes here
thanks a lot for your help!
Fabien
On 25.06.2014 16:18, Fabien wrote:
> Hi all,
>
> I am using the Slither dlm (python3.3, linux_x64). I know this is not
> precisely an IDL question, but does anyone have an idea how to solve the
> following problem?
>
> The matplotlib.mlab.PCA function
> (http://matplotlib.org/api/mlab_api.html#) works fine under my python
> distrib.
>
> I wanted to call it from IDL but this makes IDL chrash quite badly.
>
> After several tests I noticed that it is not in the linkage between IDL
> and python but rather in python (called from IDL) that the problem comes
> from. To come to this conclusion, I made a small script.
>
> The following works fine in python3:
>
>
> import matplotlib.mlab as mlab
> import numpy as np
> import random as r
> n = 50
> a = np.array([r.random() for n in range(n)]).reshape(1,n)
> b = np.array([r.random() for n in range(n)]).reshape(1,n)
> r = np.concatenate((a,b), 0).transpose()
> p = mlab.PCA(r)
> [/python code]
>
> But the exact same called called from with IDL with the exec() syntax
> crashes:
>
> py = pyimport('__main__')
>
> py->exec, 'print(sys.version)'
> ; LOOKS OK: 3.3.2+ (default, Feb 28 2014, 00:56:04)
>
> py->exec, 'import matplotlib.mlab as mlab'
> py->exec, 'import numpy as np'
> py->exec, 'import random as r'
> py->exec, 'n = 50'
> py->exec, 'a = np.array([r.random() for n in range(n)]).reshape(1,n)'
> py->exec, 'b = np.array([r.random() for n in range(n)]).reshape(1,n)'
> py->exec, 'r = np.concatenate((a,b), 0).transpose()'
> py->exec, 'p = mlab.PCA(r)' ; it crashes here
>
> Any hint on where I should look at first?
>
> Thanks!
>
> Fabien
|
|
|