DimensionalData.jl
DimensionalData.jl copied to clipboard
can't `cat` two empty vectors
thanks for fixing https://github.com/rafaqz/DimensionalData.jl/issues/595. cat works now if one input argument is empty. but, it's still broken if they all are:
julia> using DimensionalData
julia> c=rand(X(Int64[]))
╭───────────────────────────────╮
│ 0-element DimArray{Float64,1} │
├───────────────────────────────┴──────────── dims ┐
↓ X Sampled{Int64} [] Unordered Irregular Points
└──────────────────────────────────────────────────┘
julia> cat(c,c,dims=X)
ERROR: ArgumentError: tuple must be non-empty
Stacktrace:
[1] first(::Tuple{})
@ Base ./tuple.jl:196
[2] _check_cat_lookup_order(::Type)
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:434
[3] _check_cat_lookup_order(D::Type, lookups::DimensionalData.Dimensions.Lookups.Sampled{…})
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:435
[4] _check_cat_lookup_order(::Type, ::DimensionalData.Dimensions.Lookups.Sampled{…}, ::Vararg{…})
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:435
[5] _check_cat_lookups(D::Type, l1::DimensionalData.Dimensions.Lookups.Sampled{…}, lookups::DimensionalData.Dimensions.Lookups.Sampled{…})
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:398
[6] check_cat_lookups(::X{DimensionalData.Dimensions.Lookups.Sampled{…}}, ::Vararg{DimensionalData.Dimensions.Dimension})
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:390
[7] (::DimensionalData.var"#197#204"{DimVector{…}, Tuple{…}})(catdim::Type)
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:296
[8] map
@ ./tuple.jl:291 [inlined]
[9] _cat(catdims::Tuple{…}, A1::DimVector{…}, As::DimVector{…})
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:273
[10] _cat(catdim::Type{…}, A1::DimVector{…}, As::DimVector{…})
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:269
[11] cat(A1::DimVector{…}, As::DimVector{…}; dims::Type)
@ DimensionalData ~/.julia/packages/DimensionalData/bjXdf/src/array/methods.jl:266
[12] top-level scope
@ REPL[12]:1
Some type information was truncated. Use `show(err)` to see complete types.
julia> a=rand(X([1,2,3]))
╭───────────────────────────────╮
│ 3-element DimArray{Float64,1} │
├───────────────────────────────┴──────────────────────── dims ┐
↓ X Sampled{Int64} [1, 2, 3] ForwardOrdered Irregular Points
└──────────────────────────────────────────────────────────────┘
1 0.896782
2 0.828088
3 0.292937
julia> cat(a,c,c,dims=X)
╭───────────────────────────────╮
│ 3-element DimArray{Float64,1} │
├───────────────────────────────┴──────────────────────── dims ┐
↓ X Sampled{Int64} [1, 2, 3] ForwardOrdered Irregular Points
└──────────────────────────────────────────────────────────────┘
1 0.896782
2 0.828088
3 0.292937
julia> VERSION
v"1.10.2"
julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 12 × Apple M2 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
JULIA_PROJECT = @.
JULIA_EDITOR = vi
Ahh damn, cat has been so much whack-a-mole