RearrangeElectrode¶
- class torcheeg.transforms.RearrangeElectrode(source: List[str], target: List[str], missing: str = 'mean', apply_to_baseline: bool = False)[source][source]¶
Select parts of electrode signals based on a given electrode index list.
from torcheeg import transforms t = transforms.RearrangeElectrode( source=['FP1', 'F3', 'F7'], target=['F3', 'F7', 'FP1', 'AF2'], missing='mean' ) t(eeg=np.random.randn(3, 128))['eeg'].shape >>> (4, 128)
- Parameters:
source (list) – The list of electrode names to be rearranged.
target (list) – The list of electrode names to be rearranged to.
missing (str) – The method to deal with missing electrodes. (default:
'random'
)
- __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