I’m seeing some strange behavior with PyCall and PyPlot. I think it’s a bug 
but I thought I would
post it here, first, in case I’m doing something totally silly. The basic 
point is that after using the PyPlot command imshow a PyCall function goes 
from returning a Julia Array to returning a PyObject Array.

Start with these commands

using PyCall, PyPlot
@pyimport scipy.interpolate as scii
x = repmat([1:5].', 5, 1)
y = x.'
z = rand(5,5)
xi = repmat(linspace(1.1, 4.2, 5), 1, 5)
yi = xi.'

Now running this scipy command returns a Julia Array

julia> zi = scii.RectBivariateSpline(x[1,:], y[:,1], z, s=0)[:ev](yi[:], xi[:])
25-element Array{Float64,1}:
 0.648501 
 0.781289 
 0.646265 
 0.538897 
 0.546687 
 0.452867 
 0.959628 
 ...

Then if I call imshow, the scipy command starts returning a PyObject Array

julia> imshow(reshape(zi,5,5));

julia> zi = scii.RectBivariateSpline(x[1,:], y[:,1], z, s=0)[:ev](yi[:], xi[:])
PyObject array([ 0.64850104,  0.78128872,  0.64626474,  0.53889659,  0.54668682,
        0.45286666,  0.95962839,  1.08851578,  0.64222961,  0.06194584,
        0.62826001,  0.60841543,  0.89368155,  0.73081148,  0.22010762,
        0.80013576,  0.74286798,  0.57152777,  0.48611802,  0.43971484,
        0.71842972,  1.0495293 ,  0.44641902,  0.22005611,  0.45257916])

Any idea what is going on here? Note: the problem does not happen if I call 
plot, for example.

Thanks!

Here is my version info

julia> versioninfo()
Julia Version 0.3.2-pre+50
Commit 216b758 (2014-10-08 20:08 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

​

Reply via email to