PickElectrode¶
- class torcheeg.transforms.PickElectrode(pick_list: List[int], apply_to_baseline: bool = False)[source][source]¶
Select parts of electrode signals based on a given electrode index list.
from torcheeg import transforms from torcheeg.datasets.constants import DEAP_CHANNEL_LIST t = transforms.PickElectrode(transforms.PickElectrode.to_index_list( ['FP1', 'AF3', 'F3', 'F7', 'FC5', 'FC1', 'C3', 'T7', 'CP5', 'CP1', 'P3', 'P7', 'PO3','O1', 'FP2', 'AF4', 'F4', 'F8', 'FC6', 'FC2', 'C4', 'T8', 'CP6', 'CP2', 'P4', 'P8', 'PO4', 'O2'], DEAP_CHANNEL_LIST)) t(eeg=np.random.randn(32, 128))['eeg'].shape >>> (28, 128)
- Parameters:
pick_list (np.ndarray) – Selected electrode list. Should consist of integers representing the corresponding electrode indices.
to_index_list
can be used to obtain an index list when we only know the names of the electrode and not their indices.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 in shape of [number of electrodes, number of data points].
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 output signals with the shape of [number of picked electrodes, number of data points].
- Return type:
np.ndarray