Skip to content

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.536273  0.658321  0.521769   0.520744   0.229281
 2    0.522262  0.791138  0.0881736  0.858065   0.780824
 3    0.365971  0.237824  0.47951    0.630469   0.793913
 4    0.271209  0.879738  0.165853   0.0153937  0.725765

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'   -4
 'b'   60
 'c'  -92
 'd'  -87
 'e'  109
 'f'  -52
 'g'  -42
 'h'  108
 'i'  -92
 'j'   95

or something a little bit more complicated:

julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
 91   27   6  95   15  100  72  49  106  18
 29  106  53  21  102   53  17  47   77  80

[:, :, 2] =
 41  45  124  82  117    6  107   63  45  118
 97  15  111  40   71  118   67  118  29   96

[:, :, 3] =
 -128   49  105  27  27  37  29  33   15  12
   67  110  123   6  51  91  27  78  120  73
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   91   27   6  95   15  100  72  49  106  18
  :right  29  106  53  21  102   53  17  47   77  80