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.919181 0.954159 0.789493 0.123538 0.464413
2 0.426019 0.845895 0.619259 0.74002 0.824787
3 0.746586 0.586749 0.477645 0.705747 0.579592
4 0.819201 0.121813 0.804193 0.991961 0.803867
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' 74
'b' 89
'c' 58
'd' 30
'e' -89
'f' 5
'g' -71
'h' -118
'i' -52
'j' -89
or something a little bit more complicated:
julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
93 9 2 89 116 16 37 60 91 95
44 29 92 18 120 109 90 18 17 19
[:, :, 2] =
60 68 126 62 15 99 53 22 119 100
84 41 81 78 27 53 22 31 50 53
[:, :, 3] =
88 42 113 12 86 77 117 40 92 94
9 40 34 93 0 16 122 114 33 102
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 93 9 2 89 116 16 37 60 91 95
:right 44 29 92 18 120 109 90 18 17 19