nenupy.io.tf_utils.reshape_to_subbands

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

Reshape a time-frequency data array by the sub-band dimension. Given a data array with one frequency axis of size n_frequencies, this functions split this axis in two axes of size n_subbands and n_channels.

Parameters:
  • data (ndarray) – Time-frequency correlations array, its second dimension must be the frequencies.

  • n_channels (int) – Number of channels per subband.

Returns:

Data array, reshaped so that its frequency axis is split in subbands.

Return type:

ndarray

Raises:

ValueError – Raised if n_channels does not notch the frequency dimension of data.

Examples

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

>>> data = np.arange(3*10).reshape((3, 10))
>>> result = reshape_to_subbands(data, 5)
>>> result.shape
(3, 2, 5)