osl_dynamics.data.task#
Functions to handle task data.
Functions#
|
Transform (time, channels) data to (epochs, time, channels) data. |
|
Get the mean over epochs of a (time, channels) dataset. |
Module Contents#
- osl_dynamics.data.task.epoch(data, time_index, pre, post, pad=False)[source]#
Transform (time, channels) data to (epochs, time, channels) data.
Given a series of triggers given by
time_index, spit a continuous dataset into epochs.time_indexshould be a sequence of integers representing the triggers of the epochs.preandpostspecify the window around each trigger event.- Parameters:
data (np.ndarray) – A (time, channels) dataset to be epoched.
time_index (np.ndarray) – The integer indices of the start of each epoch.
pre (int) – The integer number of samples to include before the trigger.
post (int) – The integer number of samples to include after the trigger.
pad (bool, optional) – Pad with NaNs so that initial epochs will always been included.
- Returns:
epoched – An (epochs, time, channels) dataset.
- Return type:
np.ndarray
- osl_dynamics.data.task.epoch_mean(data, time_index, pre, post, pad=False)[source]#
Get the mean over epochs of a (time, channels) dataset.
Calls
epoch_mean, and takes a mean over epochs, returning data with dimensions (time, channels) in which the time is the length of the epoch window.- Parameters:
data (np.ndarray) – A (time, channels) dataset to be epoched.
time_index (np.ndarray) – The integer indices of the start of each epoch.
pre (int) – The integer number of samples to include before the trigger.
post (int) – The integer number of samples to include after the trigger.
pad (bool, optional) – Pad with NaNs so that initial epochs will always been included.
- Returns:
epoch_mean – (time, channels) data meant over epochs.
- Return type:
np.ndarray