Skip to content

Installation ​

If 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.881693  0.768257  0.354892  0.811276   0.567821
 2    0.995006  0.584213  0.665648  0.568392   0.0659506
 3    0.269856  0.569863  0.312852  0.947815   0.289733
 4    0.564605  0.718966  0.345718  0.0229006  0.922028

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'  -16
 'b'   83
 'c'   -2
 'd'  -54
 'e'   60
 'f'    5
 'g'   35
 'h'   11
 'i'  121
 'j'   52

or something a little bit more complicated:

julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
 33   13   18  26  96  62   6  88   78    8
 78  100  124  97  36   8  13  81  116  127

[:, :, 2] =
 66   41  14  113  79    76  119  23  37  15
 57  109  55   29  40  -128   77  87  19  28

[:, :, 3] =
 12   66   54   4  107  72  56   61  22  77
 86  120  109  89   40  74  62  110  57  80
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   33   13   18  26  96  62   6  88   78    8
  :right  78  100  124  97  36   8  13  81  116  127