Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapslices errors for AxisArrays #193

Open
glennmoy opened this issue Feb 24, 2021 · 0 comments
Open

mapslices errors for AxisArrays #193

glennmoy opened this issue Feb 24, 2021 · 0 comments

Comments

@glennmoy
Copy link

Trying to call mapslices over an AxisArray errors which I think can be fixed with the appropriate method for reduce_indices.

This seems somewhat related to #7.

MWE:

julia> A = AxisArray(collect(reshape(1:15,3,5)), :y, :x)
2-dimensional AxisArray{Int64,2,...} with axes:
    :y, Base.OneTo(3)
    :x, Base.OneTo(5)
And data, a 3×5 Array{Int64,2}:
 1  4  7  10  13
 2  5  8  11  14
 3  6  9  12  15

julia> mapslices(sum, A; dims=1)
ERROR: MethodError: no method matching reduced_indices(::Tuple{Axis{:y,UnitRange{Int64}}}, ::UnitRange{Int64})
Closest candidates are:
  reduced_indices(::Tuple{Vararg{Axis,N} where N}, ::Tuple{}) at /Users/glenn/.julia/dev/AxisArrays/src/core.jl:350
  reduced_indices(::Tuple{Vararg{Axis,N} where N}, ::Integer) at /Users/glenn/.julia/dev/AxisArrays/src/core.jl:352
  reduced_indices(::Tuple{Vararg{Axis,N}}, ::Tuple{Vararg{Int64,N}} where N) where N at /Users/glenn/.julia/dev/AxisArrays/src/core.jl:357
  ...
Stacktrace:
 [1] reduced_indices(::AxisArray{Int64,1,Array{Int64,1},Tuple{Axis{:y,UnitRange{Int64}}}}, ::UnitRange{Int64}) at /Users/glenn/.julia/dev/AxisArrays/src/core.jl:347
 [2] mapslices(::typeof(sum), ::AxisArray{Int64,2,Array{Int64,2},Tuple{Axis{:y,Base.OneTo{Int64}},Axis{:x,Base.OneTo{Int64}}}}; dims::Int64) at ./abstractarray.jl:2098
 [3] top-level scope at REPL[90]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant