pyntbci.utilities.correct_latency

pyntbci.utilities.correct_latency(X: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], latency: ndarray[Any, dtype[_ScalarType_co]], fs: int, axis: int = -1) ndarray[Any, dtype[_ScalarType_co]][source]

Correct for a latency in data. This is done by shifting data according to the class-specific latencies.

Parameters:
  • X (NDArray) – The EEG data of shape (n_trials, …)

  • y (NDArray) – The labels of the EEG data of shape (n_trials) that indicate which latency to use for which trials.

  • latency (NDArray) – The list with latencies in seconds of shape (n_classes).

  • fs (int) – The sampling frequency of the EEG data in Hz.

  • axis (int (default: -1)) – The axis in X to perform the correction to.

Returns:

X – The latency-corrected EEG data of shape (n_trials, …).

Return type:

NDArray