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.819127 0.277305 0.304197 0.856351 0.352734
2 0.815138 0.200943 0.228686 0.0995888 0.359255
3 0.890946 0.198568 0.0204393 0.915317 0.04282
4 0.042328 0.00595393 0.822293 0.796227 0.258851
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' 22
'b' -41
'c' -115
'd' 24
'e' -56
'f' 14
'g' 86
'h' 124
'i' -16
'j' -88
or something a little bit more complicated:
julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
82 27 14 110 3 34 89 13 108 2
65 72 100 88 21 28 11 113 108 83
[:, :, 2] =
127 56 17 18 109 29 86 2 54 43
30 86 99 34 78 123 104 7 2 21
[:, :, 3] =
72 44 119 49 24 76 84 103 13 2
5 77 38 27 45 110 98 49 83 1
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 82 27 14 110 3 34 89 13 108 2
:right 65 72 100 88 21 28 11 113 108 83