nenupy.io.tf_utils.crop_subband_edges
- nenupy.io.tf_utils.crop_subband_edges(data, n_channels, lower_edge_channels=0, higher_edge_channels=0)[source]
Set edge channels of each subband to
NaN. Each subband ofdatais determined thanks ton_channels(and the functionreshape_to_subbands()). This method is a bit faster thanremove_channels_per_subband()but it is restricted to edge channels. The other method is prefered for its polyvalence.- Parameters:
data (
ndarray) – Data to be corrected, must be at least two-dimensional, the first two dimensions being respectively the time and the frequencyn_channels (
int) – Number of channels per subbandlower_edge_channels (
int) – Number of channels to set toNaNfor the lowest part of each subband, by default 0higher_edge_channels (
int) – Number of channels to set toNaNfor the highest part of each subband, by default 0
- Returns:
Corrected data, same shape as input array
- Return type:
- Raises:
ValueError – Raised if the cropped channels are greater than
n_channels.
Examples
>>> from nenupy.io.tf_utils import crop_subband_edges >>> import numpy as np >>> result = crop_subband_edges( data=np.ones((2, 10)), n_channels=5, lower_edge_channels=1, # set to NaN the first channel of each subband higher_edge_channels=0 ) >>> print(result) [[nan 1. 1. 1. 1. nan 1. 1. 1. 1.] [nan 1. 1. 1. 1. nan 1. 1. 1. 1.]] >>> result = crop_subband_edges( data=np.ones((2, 10)), n_channels=5, lower_edge_channels=0, higher_edge_channels=2 # set to NaN the last 2 channels of each subband ) >>> print(result) [[ 1. 1. 1. nan nan 1. 1. 1. nan nan] [ 1. 1. 1. nan nan 1. 1. 1. nan nan]]
See also