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.540514  0.494197  0.0702532  0.643352   0.052264
 2    0.872575  0.056782  0.916686   0.0429596  0.366625
 3    0.770949  0.22721   0.617023   0.643237   0.609951
 4    0.718667  0.456812  0.193109   0.614571   0.275093

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'    70
 'b'   -75
 'c'    46
 'd'    -9
 'e'  -113
 'f'  -125
 'g'  -125
 'h'    72
 'i'   -55
 'j'    59

or something a little bit more complicated:

julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
 117  10  105  22   92  32  60  90  96  73
  32  69   65  27  119  71  45  71  25  71

[:, :, 2] =
  8  34  87  33   11  109   48  42   74  104
 83  50  16  68  105   82  116  70  125  104

[:, :, 3] =
  13  67  105  19  69  62  19  2   79  21
 118  39   94  98   8  12   6  6  110  71
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   117  10  105  22   92  32  60  90  96  73
  :right   32  69   65  27  119  71  45  71  25  71