iracema.util.windowing¶
Some useful methods and functions for windowing operations.
-
iracema.util.windowing.
apply_sliding_window
(x, window_size, hop_size, function, window_name)[source]¶ Apply a sliding window with the given parameters to the array x and aggregate the data within each window using the specified function.
- Parameters
x (ndarray) – Array over which the sliding operation must be applied.
window_size (int) – Size of the window.
hop_size (int) – Number of samples to be skipped between two successive windowing operations.
window_name (str) – Name of the window function to be used. Options are: {“boxcar”, “triang”, “blackman”, “hamming”, “hann”, “bartlett”, “flattop”, “parzen”, “bohman”, “blackmanharris”, “nuttall”, “barthann”, “no_window”, None}.
- Returns
y
- Return type
ndarray
-
iracema.util.windowing.
get_sliding_window_view
(x, window_size, hop_size)[source]¶ Generate a view of the input array containing the sliding windows obtained for the given parameters.
This method only creates a view of the sliding windows; it does not apply a window function (apodization function) to them.
- Parameters
x (ndarray) – Array over which the sliding operation must be applied.
window_size (int) – Size of the window.
hop_size (int) – Number of samples to be skipped between two successive windowing operations.
- Returns
view
- Return type
ndarray
-
iracema.util.windowing.
get_window_function
(window_size, window_name, symmetric=True)[source]¶ Get a window function (also known as tapering function or apodization function) according to the specified window_name.
This function will return None if the specified window_name is also None.
- Parameters
window_name (str) – Name of the window function to be used. Options are: {“boxcar”, “triang”, “blackman”, “hamming”, “hann”, “bartlett”, “flattop”, “parzen”, “bohman”, “blackmanharris”, “nuttall”, “barthann”, “no_window”}.
-
iracema.util.windowing.
calculate_sliding_window_parms
(window_size, hop_size, array_size)[source]¶ Calculate some parameters that are necessary for applying the sliding window over a time series.
- Parameters
window_size (int) – Size of the window.
hop_size (int) – Number of samples to be skipped between two successive windowing operations.
array_size (int) – Size of the original array (length of the time series) in which the sliding window operation will be applied.
- Returns
pre_padding_size (int)
post_padding_size (int)
hum_hops (int)