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.287204 0.242125 0.98934 0.834599 0.590556
2 0.560894 0.791076 0.674563 0.131913 0.985052
3 0.989331 0.0609546 0.680737 0.41408 0.493872
4 0.989599 0.098803 0.319611 0.578062 0.464569
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' -89
'b' -87
'c' 82
'd' 0
'e' 4
'f' 2
'g' -13
'h' 81
'i' 59
'j' -118
or something a little bit more complicated:
julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
65 122 49 108 14 77 54 84 52 18
113 102 74 38 75 96 57 64 9 12
[:, :, 2] =
43 66 106 81 65 39 63 1 10 99
98 69 107 26 53 96 103 101 61 2
[:, :, 3] =
63 74 16 116 115 10 75 80 70 62
52 58 46 10 89 2 70 79 119 14
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 65 122 49 108 14 77 54 84 52 18
:right 113 102 74 38 75 96 57 64 9 12