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.838558 0.454113 0.965129 0.341245 0.78631
2 0.23964 0.363419 0.931584 0.981906 0.536642
3 0.738466 0.603481 0.521713 0.557319 0.734362
4 0.711704 0.201885 0.769837 0.835118 0.920981
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' -66
'b' 122
'c' -128
'd' -27
'e' -42
'f' 88
'g' 19
'h' 61
'i' -74
'j' -125
or something a little bit more complicated:
julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
83 5 28 48 80 39 64 95 115 95
15 35 67 45 14 83 97 100 53 1
[:, :, 2] =
89 37 80 3 20 19 27 31 16 97
121 15 79 57 94 105 26 118 51 88
[:, :, 3] =
127 121 9 79 65 6 64 72 14 89
86 13 56 93 12 123 113 35 89 87
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 83 5 28 48 80 39 64 95 115 95
:right 15 35 67 45 14 83 97 100 53 1