Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyObject -> Array fails on julia 0.4 #117

Closed
swt30 opened this issue Feb 26, 2015 · 2 comments
Closed

PyObject -> Array fails on julia 0.4 #117

swt30 opened this issue Feb 26, 2015 · 2 comments

Comments

@swt30
Copy link

swt30 commented Feb 26, 2015

I have the same problem as #99 with this FITS file using astropy.io.fits on julia 0.4. It works fine on julia 0.3.

julia> using PyCall
julia> @pyimport astropy.io.fits as pyf
julia> fitsfile = pyf.open("data/fits-image.fits")
    1-element Array{Any,1}:
     PyObject <astropy.io.fits.hdu.image.PrimaryHDU object at 0x92512e4c>
julia> image = fitsfile[1]
    PyObject <astropy.io.fits.hdu.image.PrimaryHDU object at 0x92512e4c>
julia> pyimdata = image[:data]

At this stage pyimdata is an Array{Float32, 2} on julia 0.3 (perfect!) but a PyObject array([[...]], dtype=float32) on julia 0.4. Calling convert(Matrix{Float32}, pyimdata) gives exactly the same error as in #99:

ERROR: PyError (:PyFloat_AsDouble) <type 'exceptions.TypeError'>
TypeError('only length-1 arrays can be converted to Python scalars',)
...

v0.4 info:

Julia Version 0.4.0-dev+3307
Commit a387920* (2015-02-11 21:42 UTC)
Platform Info:
  System: Linux (i686-linux-gnu)
  CPU: Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz
  WORD_SIZE: 32
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
@stevengj
Copy link
Member

I can't reproduce. Can you try a Pkg.update() to see if this was fixed recently?

@swt30
Copy link
Author

swt30 commented Apr 20, 2015

Yeah, I can no longer reproduce it either. This seems to have been fixed somewhere along the line - but thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants