nenupy.io.tf_utils.remove_channels_per_subband

nenupy.io.tf_utils.remove_channels_per_subband(data, n_channels, channels_to_remove)[source]

Set channel indices of a time-frequency dataset to NaN values. Each subband of data is determined thanks to n_channels (and the function reshape_to_subbands()).

Parameters:
  • data (ndarray) – Data to be corrected, must be at least two-dimensional, the first two dimensions being respectively the time and the frequency

  • n_channels (int) – Number of channels per subband

  • channels_to_remove (Union[list, ndarray]) – Array of channel indices to set at NaN values, if None nothing is done and data is returned

Returns:

Time-frequency correlations array, shaped as the original input, except that some channels are set to NaN.

Return type:

ndarray

Raises:
  • TypeError – Raised if channels_to_remove is not of the correct type or cannot be converted to a ndarray.

  • IndexError – Raised if any of the indices listed in channels_to_remove does not correspond to the n_channels argument.

Examples

>>> from nenupy.io.tf_utils import remove_channels_per_subband
>>> import numpy as np

>>> result = remove_channels_per_subband(
        data=np.ones((2, 10)),
        n_channels=5,
        channels_to_remove=[1, 3]
    )
>>> print(result)
[[ 1. nan  1. nan  1.  1. nan  1. nan  1.]
[ 1. nan  1. nan  1.  1. nan  1. nan  1.]]