Downsample¶
- class torcheeg.transforms.Downsample(num_points: int, axis: int | None = -1, apply_to_baseline: bool = False)[source][source]¶
Downsample the EEG signal to a specified number of data points.
from torcheeg import transforms t = transforms.Downsample(num_points=32, axis=-1) # normalize along the first dimension (electrode dimension) t(eeg=np.random.randn(32, 128))['eeg'].shape >>> (32, 32)
- Parameters:
num_points (int) – The number of data points after downsampling.
axis (int, optional) – The dimension to normalize, when no dimension is specified, the entire data is normalized. (default:
-1
)apply_to_baseline – (bool): Whether to act on the baseline signal at the same time, if the baseline is passed in when calling. (default:
False
)
- __call__(*args, eeg: ndarray, baseline: ndarray | None = None, **kwargs) Dict[str, ndarray] [source][source]¶
- Parameters:
eeg (np.ndarray) – The input EEG signals or features.
baseline (np.ndarray, optional) – The corresponding baseline signal, if apply_to_baseline is set to True and baseline is passed, the baseline signal will be transformed with the same way as the experimental signal.
- Returns:
The normalized results.
- Return type:
np.ndarray