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

Bump DimensionalData to fix broadcasting #34

Merged
merged 7 commits into from
Nov 10, 2022
Merged

Conversation

sefffal
Copy link
Member

@sefffal sefffal commented Oct 23, 2022

Fixes #33

@giordano
Copy link
Member

giordano commented Oct 23, 2022

CompatHelper should probably be enabled on this repo?

@sefffal
Copy link
Member Author

sefffal commented Oct 23, 2022

Agreed, enabled now

@sefffal
Copy link
Member Author

sefffal commented Oct 23, 2022

The docs failure is specific to these changes, but I don't see it locally.

@giordano
Copy link
Member

Are you using Julia v1.7:

?

@sefffal
Copy link
Member Author

sefffal commented Oct 25, 2022

Thanks for the pointer. Looks like it affects newer Julia versions too.

I think the failure may be a result of DimensionalData's new printing format combined with RGBA elements, but I can't find a small reproducible example.
Something may be wrong with the AstroImages implementation of DimensionalData.rebuildsliced.

The error happens while Documenter is rendering. The relevant stack trace:

Stacktrace:
  [1] throw_boundserror(A::Base.OneTo{Int64}, I::Tuple{UnitRange{Int64}})
    @ Base .\abstractarray.jl:691
  [2] checkbounds
    @ .\abstractarray.jl:656 [inlined]
  [3] getindex
    @ .\range.jl:918 [inlined]
  [4] getindex
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\LookupArrays\lookup_arrays.jl:174 [inlined]
  [5] getindex
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\Dimensions\indexing.jl:11 [inlined]
  [6] _slicedims
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\Dimensions\primitives.jl:425 [inlined]
  [7] _slicedims
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\Dimensions\primitives.jl:417 [inlined]
  [8] _slicedims
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\Dimensions\primitives.jl:418 [inlined]
  [9] _slicedims
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\Dimensions\primitives.jl:409 [inlined]
 [10] slicedims
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\Dimensions\primitives.jl:389 [inlined]
 [11] rebuildsliced (repeats 5 times)
    @ C:\Users\William\.julia\dev\AstroImages\src\AstroImages.jl:252 [inlined]
 [12] getindex
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\array\indexing.jl:53 [inlined]
 [13] print_matrix(io::IOContext{IOBuffer}, A::AstroImageMat{RGBA{N0f8}, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}, Tuple{}, MappedArrays.ReadonlyMultiMappedArray{RGBA{N0f8}, 2, Tuple{SubArray{Float64, 2, Matrix{Float64}, Tuple{StepRange{Int64, Int64}, Base.Slice{Base.OneTo{Int64}}}, false}, MappedArrays.ReadonlyMappedArray{Any, 2, SubArray{Float64, 2, Matrix{Float64}, Tuple{StepRange{Int64, Int64}, Base.Slice{Base.OneTo{Int64}}}, false}, AstroImages.var"#132#133"{Int64}}}, AstroImages.var"#colormap#83"{typeof(asinhstretch), ColorSchemes.ColorScheme{Vector{RGB{Float64}}, String, String}, Float64, Float64}}, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}})
    @ DimensionalData C:\Users\William\.julia\packages\DimensionalData\4an2r\src\array\show.jl:95
 [14] print_array
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\array\show.jl:44 [inlined]
 [15] show_after
    @ C:\Users\William\.julia\packages\DimensionalData\4an2r\src\array\show.jl:33 [inlined]
 [16] show(io::IOContext{IOBuffer}, mime::MIME{Symbol("text/plain")}, A::AstroImageMat{RGBA{N0f8}, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}, Tuple{}, MappedArrays.ReadonlyMultiMappedArray{RGBA{N0f8}, 2, Tuple{SubArray{Float64, 2, Matrix{Float64}, Tuple{StepRange{Int64, Int64}, Base.Slice{Base.OneTo{Int64}}}, false}, MappedArrays.ReadonlyMappedArray{Any, 2, SubArray{Float64, 2, Matrix{Float64}, Tuple{StepRange{Int64, Int64}, Base.Slice{Base.OneTo{Int64}}}, false}, AstroImages.var"#132#133"{Int64}}}, AstroImages.var"#colormap#83"{typeof(asinhstretch), ColorSchemes.ColorScheme{Vector{RGB{Float64}}, String, String}, Float64, Float64}}, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}})
    @ DimensionalData C:\Users\William\.julia\packages\DimensionalData\4an2r\src\array\show.jl:25

@sefffal
Copy link
Member Author

sefffal commented Nov 9, 2022

I have narrowed down the docs issue to a small reproducer.

julia> using AstroImages
julia> d = AstroImage(randn(20,10),(X,Y));
julia> size(d')
(10, 20)
julia> size.(dims(d'))
((20,), (10,))

The above snippet works if AstroImage is replaced by a DimArray.
Somehow the transpose is not applying to the dimensions, but is applying to the data.
@rafaqz do you have any ideas on where to look? I can't find what's wrong with our implementation.

This was never working correctly, but is now causing our docs build to break due to some unrelated changes in newer DimensionalData.

@rafaqz
Copy link

rafaqz commented Nov 9, 2022

Ah interesting. Probably there is a mistake in the implementation of '. I will fix.

It's better to use permutedims unless you actually need the adjoint, as it can't be applied to some dimensions like categorical dimensions as its recursive and will fail on e.g. strings.

* header now shared more often when taking views of data
* restored imview live update functionality (actually behave like a view)
* Removed ability to call imview then implot and keep axes. This was never going to work in the long run.
@sefffal sefffal merged commit 26f8189 into master Nov 10, 2022
@abhro abhro deleted the dim-broadcasting branch July 16, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor interaction with broadcastable but not equal dimensions
3 participants