JuliaDataCubes / JuliaDataCubes/PyramidScheme.jl
Make a new AbstractRange that would subset into the pyramid with a given size
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 18
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
From @timholy via Slack:
Hmm, looking at PyramidScheme, do you think there's room for something that brings in fewer dependencies? I was envisioning something like this: img[sizelimit(1000, xrng), sizelimit(1000, yrng)] where sizelimit(maxsz, rng) returns an AbstractRange for which the pyramid has a special slicing implementation. If img isn't a pyramid, then this just returns img[xrng, yrng]. So sizelimit is only a "hint" about what resolution you want for the output.
The core ideas of a slim package would be:
struct SizeLimitedUnitRange <: AbstractUnitRange{Int}
r::UnitRange{Int}
lim::Int
end
Base.iterate(rng::SizeLimitedUnitRange, state...) = Base.iterate(rng.r, state...) # provides fallback behavior for non-pyramids
struct Pyramid{T,N,A<:AbstractArray{T,N},Ax<:NTuple{N,AbstractUnitRange}} <: AbstractArray{T,N}
levels::Vector{A}
axes::Ax
end
function Base.getindex(A::Pyramid, I...)
any(i -> isa(I, SizeLimitedUnitRange), I) || return invoke(getindex, Tuple{AbstractArray, Vararg{Any}}, A, I...)
# implementation that picks the level goes here
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the proposed SizeLimitedUnitRange, sizelimit usage, and Pyramid Base.getindex entry point in the issue. Determine how pyramid levels and axes are represented before implementing the requested size-limited slicing behavior, while preserving the stated fallback for non-pyramids. Done means the new range hint can select an appropriate pyramid level and ordinary array slicing still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100