JuliaGeometry / Contour.jl

Calculating contour curves for 2D scalar fields in Julia
Other
44 stars 13 forks source link

key not found #13

Closed epipping closed 10 years ago

epipping commented 10 years ago

I'm trying to compute multiple contour levels for the same dataset.

Some levels work just fine but others give me the following error:

ERROR: key not found: (313,58)
 in chase at ~/.julia/v0.3/Contour/src/Contour.jl:150
 in trace_contour at ~/.julia/v0.3/Contour/src/Contour.jl:218
 in contours at ~/.julia/v0.3/Contour/src/Contour.jl:23
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
while loading .../foo.jl, in expression starting on line 32

The error can be reproduced with the dataset (x,y,z) that I've uploaded to http://dev.exherbo.org/~pipping/broken/ and the following script:

using Contour

z = readdlm("broken/z")
y = readdlm("broken/x")
x = readdlm("broken/y")
hs = [-20e-6, -10e-6, 0]

println(size(z))
println(size(x))
println(size(y))

println("Me: Dear data set, tell me a bit about yourself")
for h in hs
    c = contour(x, y, z, h);
    println("Dataset: <<= Here's my level $h. =>>")
    clines = c.lines
    for (i,cline) in enumerate(clines)
        xs, ys = coordinates(cline);
        println("Dataset: Here's my line #$i")
        println("Dataset: my min/max x values are: $(minimum(xs)), $(maximum(xs))")
        println("Dataset: my min/max y values are: $(minimum(ys)), $(maximum(ys))")
        println("Dataset: I contain $(length(xs)) points.")
    end
end

The error occurs for the zero-level.

System info: julia version 0.3.1-pre+50,

tomasaschan commented 10 years ago

Yeah, this is a known bug and we're working on it (see #12). Basically, we (think we) know what's causing it, but we haven't had time to implement a fix yet. (Feel free to submit a PR if you're up to it! :smiley:)

But thanks for another dataset to test against, before we consider this fixed!