tsfel icon indicating copy to clipboard operation
tsfel copied to clipboard

`signal_window_splitter` should have an option to keep the remaining data as a smaller window

Open GniLudio opened this issue 4 months ago • 1 comments

Currently the signal_window_splitter only creates windows of full length and discards the rest of the signal. It would be nice to have an option to create an additional window (of shorter length) with the remaining data.

Example

I have 8 data points and want to create windows of size 3 with 0 overlap.

import tsfel.utils.signal_processing

windows = tsfel.utils.signal_processing.signal_window_splitter(
    signal = [1, 2, 3, 4, 5, 6, 7, 8],
    window_size = 3, 
    overlap = 0
)

Currently this returns 2 windows of size 3 and discards the remaining data: [[1, 2, 3], [4, 5, 6]]

But it would be nice to have an option to use the remaining data for a window of smaller size: [[1, 2, 3], [4, 5, 6], [7, 8]]

Feature Request

This could be realized with different one of these parameters:

  • retain_remaining_data: Always uses the remaining data for a window of smaller size.
  • retain_minimum_size: Creates a window of smaller size if the remaining data is more than the retain_minimum_size.

Instead of creating a window of smaller size with the remaining data, it would also be possible to append the remaining data to the last window.

  • retain_append_maximum_size: Append remaining data of smaller size to the last window.

Of course, it would also be nice to have this for functions that use the window splitter. (e.g. the time_series_features_extractor)

GniLudio avatar Oct 16 '24 09:10 GniLudio