-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
When I try to plot a DimArray with Unitful dimensions I am getting a StackOverflowError. There was previously a resolved issue about what seems to be the same error: #723. It seems that this issue was reintroduced with version 0.29.19.
Here is the same minimal example as provided by @david-macmahon in the original issue.
Version 0.29.18 works:
(jl_uAVeuD) pkg> st CairoMakie DimensionalData Unitful
Status `/tmp/jl_uAVeuD/Project.toml`
⌃ [13f3f980] CairoMakie v0.14.0
⌃ [0703355e] DimensionalData v0.29.18
[1986cc42] Unitful v1.24.0
Info Packages marked with ⌃ have new versions available and may be upgradable.
julia> using DimensionalData, CairoMakie, Unitful
julia> dd = DimArray(rand(3,5), (Dim{:freq}(1.0:0.5:2.0), Dim{:time}(0:4)))
┌ 3×5 DimArray{Float64, 2} ┐
├──────────────────────────┴──────────────────────────────────── dims ┐
↓ freq Sampled{Float64} 1.0:0.5:2.0 ForwardOrdered Regular Points,
→ time Sampled{Int64} 0:4 ForwardOrdered Regular Points
└─────────────────────────────────────────────────────────────────────┘
↓ → 0 1 2 3 4
1.0 0.866261 0.542912 0.556222 0.575055 0.423188
1.5 0.716689 0.267359 0.25917 0.267714 0.199823
2.0 0.619127 0.838477 0.821431 0.261603 0.0693282
julia> plot(dd) # works
julia> ddu = DimArray(rand(3,5), (Dim{:freq}((1.0:0.5:2.0)u"Hz"), Dim{:time}((0:4)u"s")))
┌ 3×5 DimArray{Float64, 2} ┐
├──────────────────────────┴────────────────────────────────────────────────────────── dims ┐
↓ freq Sampled{Quantity{Float64, 𝐓^-1, Unitful.FreeUnits{(Hz,), 𝐓^-1, nothing}}} (1.0:0.5:2.0) Hz ForwardOrdered Regular Points,
→ time Sampled{Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} (0:4) s ForwardOrdered Regular Points
└───────────────────────────────────────────────────────────────────────────────────────────┘
↓ → 0 s 1 s 2 s 3 s 4 s
1.0 Hz 0.205511 0.993605 0.966492 0.787188 0.685997
1.5 Hz 0.905903 0.272701 0.617019 0.161883 0.0868278
2.0 Hz 0.7243 0.735437 0.350271 0.906789 0.981961
julia> plot(ddu) # also works
Version 0.29.19 does not work:
(jl_Y1J9tn) pkg> st CairoMakie DimensionalData Unitful
Status `/tmp/jl_Y1J9tn/Project.toml`
[13f3f980] CairoMakie v0.15.6
⌃ [0703355e] DimensionalData v0.29.19
[1986cc42] Unitful v1.24.0
Info Packages marked with ⌃ have new versions available and may be upgradable.
julia> using DimensionalData, CairoMakie, Unitful
julia> dd = DimArray(rand(3,5), (Dim{:freq}(1.0:0.5:2.0), Dim{:time}(0:4)))
┌ 3×5 DimArray{Float64, 2} ┐
├──────────────────────────┴──────────────────────────────────── dims ┐
↓ freq Sampled{Float64} 1.0:0.5:2.0 ForwardOrdered Regular Points,
→ time Sampled{Int64} 0:4 ForwardOrdered Regular Points
└─────────────────────────────────────────────────────────────────────┘
↓ → 0 1 2 3 4
1.0 0.863165 0.0334873 0.951236 0.905314 0.579467
1.5 0.32396 0.988554 0.776589 0.912863 0.206955
2.0 0.0461706 0.880968 0.32979 0.0800129 0.662683
julia> plot(dd) # works
julia> ddu = DimArray(rand(3,5), (Dim{:freq}((1.0:0.5:2.0)u"Hz"), Dim{:time}((0:4)u"s")))
┌ 3×5 DimArray{Float64, 2} ┐
├──────────────────────────┴────────────────────────────────────────────────────────── dims ┐
↓ freq Sampled{Quantity{Float64, 𝐓^-1, Unitful.FreeUnits{(Hz,), 𝐓^-1, nothing}}} (1.0:0.5:2.0) Hz ForwardOrdered Regular Points,
→ time Sampled{Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} (0:4) s ForwardOrdered Regular Points
└───────────────────────────────────────────────────────────────────────────────────────────┘
↓ → 0 s 1 s 2 s 3 s 4 s
1.0 Hz 0.290704 0.777649 0.169968 0.104919 0.900903
1.5 Hz 0.00916393 0.763765 0.994425 0.47843 0.693603
2.0 Hz 0.917727 0.525552 0.0422042 0.418307 0.787847
julia> plot(ddu)
ERROR: StackOverflowError:
Stacktrace:
[1] Base.TwicePrecision{Float64}(nd::Tuple{Int128, Int128})
@ Base ./twiceprecision.jl:222
[2] steprangelen_hp(::Type{…}, ref::Tuple{…}, step::Tuple{…}, nb::Int64, len::Int64, offset::Int64)
@ Base ./twiceprecision.jl:344
[3] _linspace(::Type{Float64}, start_n::Int64, stop_n::Int64, len::Int64, den::Int64)
@ Base ./twiceprecision.jl:730
[4] range_start_stop_length(start::Float64, stop::Float64, len::Int64)
@ Base ./twiceprecision.jl:660
[5] _range
@ ./range.jl:167 [inlined]
[6] _range(start::Quantity{…}, ::Nothing, stop::Quantity{…}, len::Int64)
@ Unitful ~/.julia/packages/Unitful/sxiHA/src/range.jl:26
[7] range
@ ./range.jl:148 [inlined]
[8] to_linspace
@ ~/.julia/packages/Makie/4JW9B/src/conversions.jl:737 [inlined]
[9] convert_arguments(P::CellGrid, x::StepRangeLen{…}, y::StepRangeLen{…}, z::Matrix{…}) (repeats 79979 times)
@ Makie ~/.julia/packages/Makie/4JW9B/src/conversions.jl:372
Some type information was truncated. Use `show(err)` to see complete types.
Metadata
Metadata
Assignees
Labels
No labels