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.293244 0.907294 0.309357 0.423416 0.43772
2 0.126174 0.848155 0.55659 0.338582 0.273702
3 0.903477 0.131581 0.909606 0.33761 0.551282
4 0.34069 0.402424 0.737793 0.608996 0.728006
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' 92
'b' -97
'c' 105
'd' 90
'e' -9
'f' 107
'g' 96
'h' 48
'i' -48
'j' -33
or something a little bit more complicated:
julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
98 3 82 41 40 71 79 83 95 86
79 122 64 46 88 112 49 114 69 61
[:, :, 2] =
18 78 89 107 82 29 67 28 89 0
77 81 38 36 124 80 5 39 27 38
[:, :, 3] =
62 125 22 1 48 84 38 23 113 21
85 66 93 88 63 72 86 9 71 45
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 98 3 82 41 40 71 79 83 95 86
:right 79 122 64 46 88 112 49 114 69 61