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

pcolor(): Warning: The default strides(a::AbstractArray) implementation is deprecated ....... #380

Closed
cwb0 opened this issue Aug 29, 2018 · 4 comments · Fixed by JuliaPy/PyCall.jl#653

Comments

@cwb0
Copy link

cwb0 commented Aug 29, 2018

julia> versioninfo()
Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
Environment:
JULIA_EDITOR = "C:\Users\Carsten\AppData\Local\atom\app-1.30.0\atom.exe" -a
JULIA_NUM_THREADS = 2

I‘ve got the following warning applying pcolor():

julia> pcolor(a1,a2,a3)
┌ Warning: The default strides(a::AbstractArray) implementation is deprecated for general arrays.
│ Specialize strides(::Adjoint) if Adjoint indeed uses a strided representation in memory.
│ Warning: inappropriately implementing this method for an array type that does not use strided
│ storage may lead to incorrect results or segfaults.
│ caller = stride at abstractarray.jl:350 [inlined]
└ @ Core .\abstractarray.jl:350
┌ Warning: The default strides(a::AbstractArray) implementation is deprecated for general arrays.
│ Specialize strides(::Adjoint) if Adjoint indeed uses a strided representation in memory.
│ Warning: inappropriately implementing this method for an array type that does not use strided
│ storage may lead to incorrect results or segfaults.
│ caller = stride at abstractarray.jl:350 [inlined]
└ @ Core .\abstractarray.jl:350
┌ Warning: The default strides(a::AbstractArray) implementation is deprecated for general arrays.
│ Specialize strides(::Adjoint) if Adjoint indeed uses a strided representation in memory.
│ Warning: inappropriately implementing this method for an array type that does not use strided
│ storage may lead to incorrect results or segfaults.
│ caller = ip:0x0
└ @ Core :-1
PyObject <matplotlib.collections.PolyCollection object at 0x0000000026F8EEF0>

with

julia> a1
1×64 Adjoint{Float64,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}:

julia> a2
-0.4921875:0.015625:0.4921875

julia> a3
64×64 Adjoint{Float64,Array{Float64,2}}:

@cwb0
Copy link
Author

cwb0 commented Aug 29, 2018

same warnings for

pcolormesh(a1,a2,a3)

@cwb0
Copy link
Author

cwb0 commented Aug 30, 2018

To avoid the above mentioned warnings a workaround is (see example below) to convert the transposed array B of type: (Transpose{Float64,Array{Float64,2}}) to an array of type: Array{Float64,2}.

_ _ ()_ | A fresh approach to technical computing
() | () () | Documentation: https://docs.julialang.org
_ _ | | __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 0.7.0 (2018-08-08 06:46 UTC)
/ |_'|||_'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32

julia> using PyPlot

julia> A = rand(1:8,8,8)*1.0;

julia> B = transpose(A);

julia> C = convert(Array{Float64,2},B);

julia> figure("A")
Figure(PyObject <Figure size 640x478 with 0 Axes>)

julia> pcolor(A)
PyObject <matplotlib.collections.PolyCollection object at 0x0000000026EE04E0>

julia> figure("C")
Figure(PyObject <Figure size 640x478 with 0 Axes>)

julia> pcolor(C)
PyObject <matplotlib.collections.PolyCollection object at 0x000000002787E438>

julia> figure("B")
Figure(PyObject <Figure size 640x480 with 0 Axes>)

julia> pcolor(B)
┌ Warning: The default strides(a::AbstractArray) implementation is deprecated for general arrays.
│ Specialize strides(::LinearAlgebra.Transpose) if LinearAlgebra.Transpose indeed uses a strided representation in memory.
│ Warning: inappropriately implementing this method for an array type that does not use strided
│ storage may lead to incorrect results or segfaults.
│ caller = ip:0x0
└ @ Core :-1
PyObject <matplotlib.collections.PolyCollection object at 0x00000000278E4FD0>

The warning occurs only once.

julia> figure("B1")
Figure(PyObject <Figure size 640x480 with 0 Axes>)

julia> pcolor(B)
PyObject <matplotlib.collections.PolyCollection object at 0x00000000012B1E10>

julia>

Running the same command pcolor(B) again no warning appears anymore (why?).

@cwb0 cwb0 closed this as completed Aug 30, 2018
@cwb0 cwb0 reopened this Aug 30, 2018
@cwb0
Copy link
Author

cwb0 commented Aug 30, 2018

(why?)

@Nosferican
Copy link

Still persists (see JuliaLang/julia#25321 (comment) for solution). It is very prevalent when using p[:ax] with ::Adjoint... For now one has to Matrix(obj') in order to get it to work.

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

Successfully merging a pull request may close this issue.

2 participants