mcabbott / mcabbott/AxisKeys.jl

`getindex(::KeyedVector, ::Colon, ::Colon)` is broken

Open
#116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
154
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Compare

julia> rand(5)[:, :]
5×1 Matrix{Float64}:
 0.9821831290750086
 0.3574801822912895
 0.36794326869601435
 0.39263359417430765
 0.45195237298701174

julia> wrapdims(rand(5); obs=1:5)[:, :]
ERROR: BoundsError: attempt to access Tuple{Symbol} at index [2]
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/NamedDims/f4IvC/src/name_core.jl:0 [inlined]
 [2] remaining_dimnames_from_indexing(dimnames::Tuple{Symbol}, inds::Tuple{Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}})
   @ NamedDims ~/.julia/packages/NamedDims/f4IvC/src/name_core.jl:355
 [3] getindex(::NamedDimsArray{(:obs,), Float64, 1, Vector{Float64}}, ::Base.Slice{Base.OneTo{Int64}}, ::Base.Slice{Base.OneTo{Int64}})
   @ NamedDims ~/.julia/packages/NamedDims/f4IvC/src/wrapper_array.jl:160
 [4] getindex(::KeyedArray{Float64, 1, NamedDimsArray{(:obs,), Float64, 1, Vector{Float64}}, Base.RefValue{UnitRange{Int64}}}, ::Function, ::Function)
   @ AxisKeys ~/.julia/packages/AxisKeys/MK99E/src/struct.jl:77
 [5] top-level scope
   @ REPL[57]:1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the wrapdims(rand(5); obs=1:5)[:, :] example and read the getindex(::KeyedArray, ...) entry point in AxisKeys, alongside the NamedDims stack frames. Done means indexing a one-dimensional keyed array with two colons no longer raises the shown BoundsError and behaves like the plain Julia array example.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.