-
Notifications
You must be signed in to change notification settings - Fork 76
The Data Class
IDTxl uses its own class to handle data.
from idtxl.data import Data
The Data class holds up to 3D data, where one dimension represents processes, one dimension represents samples, and one dimension represents replications. For example, in a neuroscience setting, processes would correspond to EEG channels, samples to time steps, and replications to trials (repetitions of the same experiment).
To import your own data set, create a Data object passing a 1D, 2D, or 3D numpy array. To specify which axis of the numpy array represents which dimension of the data, pass a one to three-letter string as dim_order
, where 'p' stands for processes, 's' for samples, and 'r' for replications.
Example: 3D numpy array
# Initialise a data object holding data with 50000 samples,
# 10 processes, and 5 replications.
mydata = np.arange(50000).reshape((1000, 10, 5))
dat = Data(mydata, dim_order='spr')
Example: 2D numpy array
# Initialise a data object holding data with 5 processes and
# 5000 samples
mydata = np.arange(5000).reshape((5, 1000))
dat = Data(mydata, dim_order='ps')
Example: 1D numpy array
# Initialise a data object holding data with 1 process and
# 1000 samples
mydata = np.arange(1000)
dat = Data(mydata, dim_order='s')
IDTxl also provides the functionality to generate synthetic test data.