Installation
If you want to use this package you need to install it first. You can do it using the following commands:
julia
julia> ] # ']' should be pressed
pkg> add DimensionalData
or
julia
julia> using Pkg
julia> Pkg.add("DimensionalData")
Additionally, it is recommended to check the version that you have installed with the status command.
julia
julia> ]
pkg> status DimensionalData
Basics
Start using the package:
julia
using DimensionalData
and create your first DimArray
julia
julia> A = DimArray(rand(4,5), (a=1:4, b=1:5))
╭─────────────────────────╮
│ 4×5 DimArray{Float64,2} │
├─────────────────────────┴────────────────────────────────────────────── dims ┐
↓ a Sampled{Int64} 1:4 ForwardOrdered Regular Points,
→ b Sampled{Int64} 1:5 ForwardOrdered Regular Points
└──────────────────────────────────────────────────────────────────────────────┘
↓ → 1 2 3 4 5
1 0.0333106 0.758203 0.973154 0.0710221 0.868064
2 0.52849 0.571821 0.920182 0.545156 0.106593
3 0.70366 0.539028 0.0670111 0.404635 0.799977
4 0.68316 0.965008 0.0781957 0.130775 0.570914
or
julia
julia> C = DimArray(rand(Int8, 10), (alpha='a':'j',))
╭─────────────────────────────╮
│ 10-element DimArray{Int8,1} │
├─────────────────────────────┴────────────────────────────────────────── dims ┐
↓ alpha Categorical{Char} 'a':1:'j' ForwardOrdered
└──────────────────────────────────────────────────────────────────────────────┘
'a' -21
'b' 101
'c' 51
'd' -35
'e' 106
'f' 88
'g' -98
'h' 14
'i' -73
'j' -54
or something a little bit more complicated:
julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
46 76 38 32 120 122 29 57 9 23
78 26 6 50 16 125 11 98 39 95
[:, :, 2] =
50 101 46 48 76 17 1 69 11 112
105 15 50 90 5 70 107 120 86 15
[:, :, 3] =
38 59 41 47 41 11 117 82 74 61
76 72 112 89 39 109 86 117 117 120
julia
julia> B = DimArray(data, (channel=[:left, :right], time=1:10, iter=1:3))
╭─────────────────────────╮
│ 2×10×3 DimArray{Int8,3} │
├─────────────────────────┴────────────────────────────────────────────── dims ┐
↓ channel Categorical{Symbol} [:left, :right] ForwardOrdered,
→ time Sampled{Int64} 1:10 ForwardOrdered Regular Points,
↗ iter Sampled{Int64} 1:3 ForwardOrdered Regular Points
└──────────────────────────────────────────────────────────────────────────────┘
[:, :, 1]
↓ → 1 2 3 4 5 6 7 8 9 10
:left 46 76 38 32 120 122 29 57 9 23
:right 78 26 6 50 16 125 11 98 39 95