Skip to content

Commit

Permalink
fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Apr 1, 2023
1 parent f2fb0e7 commit 06298c2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 64 deletions.
18 changes: 9 additions & 9 deletions src/LookupArrays/lookup_arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ y = Y(Sampled([1, 4, 7, 10]; span=Regular(3), sampling=Intervals(Start())))
A = ones(x, y)
# output
5×4 DimArray{Float64,2}[90m with dimensions: [39m
[31mX[39m Sampled{Int64} [36m100:-20:20[39m ReverseOrdered Regular Intervals,
[31mY[39m Sampled{Int64} [36mInt64[1, 4, 7, 10][39m ForwardOrdered Regular Intervals
[90m1[39m [90m4[39m [90m7[39m [90m10[39m
[39m[90m100[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
[39m[90m80[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
[39m[90m60[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
[39m[90m40[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
[39m[90m20[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
5×4 DimArray{Float64,2} with dimensions:
X Sampled{Int64} 100:-20:20 ReverseOrdered Regular Intervals,
Y Sampled{Int64} Int64[1, 4, 7, 10] ForwardOrdered Regular Intervals
1 4 7 10
100 1.0 1.0 1.0 1.0
80 1.0 1.0 1.0 1.0
60 1.0 1.0 1.0 1.0
40 1.0 1.0 1.0 1.0
20 1.0 1.0 1.0 1.0
```
"""
struct Sampled{T,A<:AbstractVector{T},O,Sp,Sa,M} <: AbstractSampled{T,O,Sp,Sa}
Expand Down
42 changes: 21 additions & 21 deletions src/LookupArrays/selector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ A[X(Between(15, 25)), Y(Between(4, 6.5))]
# output
1×2 DimArray{Int64,2}[90m with dimensions: [39m
[31mX[39m Sampled{Int64} [36m20:10:20[39m ForwardOrdered Regular Points,
[31mY[39m Sampled{Int64} [36m5:6[39m ForwardOrdered Regular Points
[90m5[39m [90m6[39m
[39m[90m20[39m [39m[39m4 [39m[39m5
1×2 DimArray{Int64,2} with dimensions:
X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points,
Y Sampled{Int64} 5:6 ForwardOrdered Regular Points
5 6
20 4 5
```
"""
struct Between{T<:Union{<:AbstractVector{<:Tuple{Any,Any}},Tuple{Any,Any},Nothing}} <: ArraySelector{T}
Expand Down Expand Up @@ -667,11 +667,11 @@ A = DimArray([1 2 3; 4 5 6], (X(10:10:20), Y(5:7)))
A[X(Touches(15, 25)), Y(Touches(4, 6.5))]
# output
1×2 DimArray{Int64,2}[90m with dimensions: [39m
[31mX[39m Sampled{Int64} [36m20:10:20[39m ForwardOrdered Regular Points,
[31mY[39m Sampled{Int64} [36m5:6[39m ForwardOrdered Regular Points
[90m5[39m [90m6[39m
[39m[90m20[39m [39m[39m4 [39m[39m5
1×2 DimArray{Int64,2} with dimensions:
X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points,
Y Sampled{Int64} 5:6 ForwardOrdered Regular Points
5 6
20 4 5
```
"""
struct Touches{T<:Union{<:AbstractVector{<:Tuple{Any,Any}},Tuple{Any,Any},Nothing,Extents.Extent}} <: ArraySelector{T}
Expand Down Expand Up @@ -840,11 +840,11 @@ A[X(Where(x -> x > 15)), Y(Where(x -> x in (19, 21)))]
# output
1×2 DimArray{Int64,2}[90m with dimensions: [39m
[31mX[39m Sampled{Int64} [36mInt64[20][39m ForwardOrdered Regular Points,
[31mY[39m Sampled{Int64} [36mInt64[19, 21][39m ForwardOrdered Regular Points
[90m19[39m [90m21[39m
[39m[90m20[39m [39m[39m4 [39m[39m6
1×2 DimArray{Int64,2} with dimensions:
X Sampled{Int64} Int64[20] ForwardOrdered Regular Points,
Y Sampled{Int64} Int64[19, 21] ForwardOrdered Regular Points
19 21
20 4 6
```
"""
struct Where{T} <: ArraySelector{T}
Expand Down Expand Up @@ -877,12 +877,12 @@ A[X=All(At(10.0), At(50.0)), Ti=All(1u"s"..10u"s", 90u"s"..100u"s")]
# output
2×4 DimArray{Int64,2}[90m with dimensions: [39m
[31mX[39m Sampled{Float64} [36mFloat64[10.0, 50.0][39m ForwardOrdered Regular Points,
[31mTi[39m Sampled{Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} [36mQuantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}[1 s, 6 s, 91 s, 96 s][39m ForwardOrdered Regular Points
[90m1 s[39m [90m6 s[39m [90m91 s[39m [90m96 s[39m
[39m[90m10.0[39m [39m[39m1 [39m[39m2 [39m[39m19 [39m[39m20
[39m[90m50.0[39m [39m[39m3 [39m[39m6 [39m[39m57 [39m[39m60
2×4 DimArray{Int64,2} with dimensions:
X Sampled{Float64} Float64[10.0, 50.0] ForwardOrdered Regular Points,
Ti Sampled{Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}[1 s, 6 s, 91 s, 96 s] ForwardOrdered Regular Points
1 s 6 s 91 s 96 s
10.0 1 2 19 20
50.0 3 6 57 60
```
"""
struct All{S<:Tuple{Vararg{SelectorOrInterval}}} <: Selector{S}
Expand Down
68 changes: 34 additions & 34 deletions src/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,64 +39,64 @@ DimensionalData
julia> da = DimArray(zeros(3, 4), (custom=10.0:010.0:30.0, Z=-20:010.0:10.0));
julia> set(da, ones(3, 4))
3×4 DimArray{Float64,2}[90m with dimensions: [39m
[31mDim{[39m[33m:custom[39m[31m}[39m Sampled{Float64} [36m10.0:10.0:30.0[39m ForwardOrdered Regular Points,
[31mZ[39m Sampled{Float64} [36m-20.0:10.0:10.0[39m ForwardOrdered Regular Points
[90m-20.0[39m [90m-10.0[39m [90m0.0[39m [90m10.0[39m
[39m[90m10.0[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
[39m[90m20.0[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
[39m[90m30.0[39m [39m[39m1.0 [39m[39m1.0 [39m[39m1.0 [39m[39m1.0
3×4 DimArray{Float64,2} with dimensions:
Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points,
Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points
-20.0 -10.0 0.0 10.0
10.0 1.0 1.0 1.0 1.0
20.0 1.0 1.0 1.0 1.0
30.0 1.0 1.0 1.0 1.0
```
Change the `Dimension` wrapper type:
```jldoctest set
julia> set(da, :Z => Ti, :custom => Z)
3×4 DimArray{Float64,2}[90m with dimensions: [39m
[31mZ[39m Sampled{Float64} [36m10.0:10.0:30.0[39m ForwardOrdered Regular Points,
[31mTi[39m Sampled{Float64} [36m-20.0:10.0:10.0[39m ForwardOrdered Regular Points
[90m-20.0[39m [90m-10.0[39m [90m0.0[39m [90m10.0[39m
[39m[90m10.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m20.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m30.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
3×4 DimArray{Float64,2} with dimensions:
Z Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points,
Ti Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points
-20.0 -10.0 0.0 10.0
10.0 0.0 0.0 0.0 0.0
20.0 0.0 0.0 0.0 0.0
30.0 0.0 0.0 0.0 0.0
```
Change the lookup `Vector`:
```jldoctest set
julia> set(da, Z => [:a, :b, :c, :d], :custom => [4, 5, 6])
3×4 DimArray{Float64,2}[90m with dimensions: [39m
[31mDim{[39m[33m:custom[39m[31m}[39m Sampled{Int64} [36mInt64[4, 5, 6][39m ForwardOrdered Regular Points,
[31mZ[39m Sampled{Symbol} [36mSymbol[:a, :b, :c, :d][39m ForwardOrdered Regular Points
[90m:a[39m [90m:b[39m [90m:c[39m [90m:d[39m
[39m[90m4[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m5[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m6[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
3×4 DimArray{Float64,2} with dimensions:
Dim{:custom} Sampled{Int64} Int64[4, 5, 6] ForwardOrdered Regular Points,
Z Sampled{Symbol} Symbol[:a, :b, :c, :d] ForwardOrdered Regular Points
:a :b :c :d
4 0.0 0.0 0.0 0.0
5 0.0 0.0 0.0 0.0
6 0.0 0.0 0.0 0.0
```
Change the `LookupArray` type:
```jldoctest set
julia> set(da, Z=DD.NoLookup(), custom=DD.Sampled())
3×4 DimArray{Float64,2}[90m with dimensions: [39m
[31mDim{[39m[33m:custom[39m[31m}[39m Sampled{Float64} [36m10.0:10.0:30.0[39m ForwardOrdered Regular Points,
[31mZ[39m
[39m[90m10.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m20.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m30.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
3×4 DimArray{Float64,2} with dimensions:
Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points,
Z
10.0 0.0 0.0 0.0 0.0
20.0 0.0 0.0 0.0 0.0
30.0 0.0 0.0 0.0 0.0
```
Change the `Sampling` trait:
```jldoctest set
julia> set(da, :custom => DD.Irregular(10, 12), Z => DD.Regular(9.9))
3×4 DimArray{Float64,2}[90m with dimensions: [39m
[31mDim{[39m[33m:custom[39m[31m}[39m Sampled{Float64} [36m10.0:10.0:30.0[39m ForwardOrdered Irregular Points,
[31mZ[39m Sampled{Float64} [36m-20.0:10.0:10.0[39m ForwardOrdered Regular Points
[90m-20.0[39m [90m-10.0[39m [90m0.0[39m [90m10.0[39m
[39m[90m10.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m20.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
[39m[90m30.0[39m [39m[39m0.0 [39m[39m0.0 [39m[39m0.0 [39m[39m0.0
3×4 DimArray{Float64,2} with dimensions:
Dim{:custom} Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Irregular Points,
Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points
-20.0 -10.0 0.0 10.0
10.0 0.0 0.0 0.0 0.0
20.0 0.0 0.0 0.0 0.0
30.0 0.0 0.0 0.0 0.0
```
"""
function set end
Expand Down

0 comments on commit 06298c2

Please sign in to comment.