DimensionalData.jl
DimensionalData.jl copied to clipboard
`intersect` on DimUnitRanges returns a Base `UnitRange`
MWE:
julia> import DimensionalData as DD; using DimensionalData
julia> intersect(DD.Dimensions.DimUnitRange(1:5, X()), DD.Dimensions.DimUnitRange(3:7, X()))
3:5
julia> typeof(ans)
UnitRange{Int64}
Ideally this should return a DimUnitRange. Maybe it could also check that dimensions match. Let me know if this makes sense, and I can PR it.
Probably makes sense
Also, should dims2indices on an extent return a DimUnitRange?
That would mean selectors also returning DimUnitRange.
There's a compilation overhead to doing that.
What would be the benefit?
We will need to use promote_dim on the dimensions to get the right type back.
And also check that the lookup values match after the intersection.