pyntbci.utilities.trials_to_epochs

pyntbci.utilities.trials_to_epochs(X: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], codes: ndarray[Any, dtype[_ScalarType_co]], epoch_size: int, step_size: int) tuple[ndarray[Any, dtype[_ScalarType_co]], ndarray[Any, dtype[_ScalarType_co]]][source]

Slice trials to epochs.

Parameters:
  • X (NDArray) – The EEG data of shape (n_trials, n_channels, n_samples).

  • y (NDArray) – Label vector of shape (n_trials).

  • codes (NDArray) – Codes matrix of shape (n_codes, n_samples).

  • epoch_size (int) – The width of an epoch starting at the onset of an epoch in samples.

  • step_size (int) – The distance between consecutive epochs in samples.

Returns:

  • NDArray – The sliced EEG data of shape (n_trials, n_epochs, n_channels, epoch_size).

  • NDArray – The sliced label information of shape (n_trials, n_epochs).