scaling

selfeeg.augmentation.functional.scaling(x: ArrayLike, value: float = None, batch_equal: bool = True) ArrayLike[source]

rescales the ArrayLike object by a given amplitude.

Parameters:
  • x (ArrayLike) – The input Tensor or Array. The last two dimensions must refer to the EEG recording (Channels x Samples).

  • value (float, optional) –

    The rescaling factor. If not given, a random value is extracted from a uniform distribution in range [0.5, 2].

    Default: None

  • batch_equal (bool, optional) –

    Whether to apply the same rescaling on all signals or not. If False, value must be left to None, otherwise batch_equal will be reset to True.

    Default: True

Returns:

x (ArrayLike) – The augmented version of the input Tensor or Array.

Example

>>> import torch
>>> import selfeeg.augmentation as aug
>>> x = torch.zeros(16,32,1024) + torch.sin(torch.linspace(0, 8*torch.pi,1024))
>>> xaug = aug.scaling(x, 1.5)
>>> print( xaug.max()==x.max()*1.5)# should return True
>>> print( xaug.min()==x.min()*1.5)# should return True