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.541806  0.0282382  0.762794  0.844547  0.919763
 2    0.300768  0.247683   0.388243  0.95636   0.383632
 3    0.70597   0.599558   0.803192  0.675435  0.487578
 4    0.93479   0.624685   0.774731  0.216524  0.102405

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'  112
 'b'   85
 'c'  -86
 'd'  123
 'e'   95
 'f'   59
 'g'  -91
 'h'   55
 'i'  -78
 'j'  -15

or something a little bit more complicated:

julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
  65  110   71  108  76  15  120   65  121  126
 125   78  118  101  11  32   87  108   49  115

[:, :, 2] =
 106  84  74  80   9   26  35  74  28  47
  87   1  42  54  15  107  77  23  89  34

[:, :, 3] =
 65  66  113  1  123  16  69  104  -128  26
 25  13   29  1   21  72  24   48    51  88
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  110   71  108  76  15  120   65  121  126
  :right  125   78  118  101  11  32   87  108   49  115