JuliaGeometry / Contour.jl

Calculating contour curves for 2D scalar fields in Julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken on Julia 0.4

tomasaschan opened this issue · comments

julia> begin
Σy = 1.1
Σx = 0.7
X0 = 2
Y0 = 3

z(x,y) = exp(-(x-X0)^2/2Σx^2 - (y-Y0)^2/2Σy^2)
end

julia> using Contour
julia> contours(Float64[1:5], Float64[1:5], Float64[z(x,y) for x in 1:5, y in 1:5])
ERROR: MethodError: `convert` has no method matching convert(::Type{ImmutableArrays.Vector2{Float64}})
This may have arisen from a call to the constructor ImmutableArrays.Vector2{Float64}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  convert{T}(::Type{ImmutableArrays.Vector2{T}}, ::ImmutableArrays.Vector2{T})
  convert{T}(::Type{ImmutableArrays.Vector2{T}}, ::AbstractArray{T,1})
  convert{T}(::Type{T}, ::T)
  ...
 in push! at array.jl:533
 in add_vertex! at C:\Users\Tomas Lycken\.julia\v0.4\Contour\src\Contour.jl:147
 in trace_contour at C:\Users\Tomas Lycken\.julia\v0.4\Contour\src\Contour.jl:253
 in contours at C:\Users\Tomas Lycken\.julia\v0.4\Contour\src\Contour.jl:23
 in anonymous at no file

I've tried to take a look at this, but I can't figure out why the conversion doesn't work. The stack trace seems accurate enough, though, so it should be a good starting point, but from what I can tell with println debugging, there is never a call to convert, or to a constructor of Vector2{Float64}, with no other arguments.

I think this is fixed in ImmutableArrays now. JuliaGeometry/OldImmutableArrays.jl#37

@darwindarak The next thing holding us back now is JuliaLang/julia#13137, which won't be fixed until 0.4.1. In the meantime, the realistic data set tested here needs to be made smaller, or initialized differently. Do you remember how you generated those arrays? What was the function which generated z?

Ah, nvm, that data was provided from elsewhere. I'll keep digging :)

Close this?

@PallHaraldsson Thanks for the reminder!