fraunhoferportugal / tsfel

An intuitive library to extract features from time series.
https://tsfel.readthedocs.io
BSD 3-Clause "New" or "Revised" License
925 stars 143 forks source link

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

Open GniLudio opened 3 days ago

GniLudio commented 3 days ago

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:

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.

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

dmfolgado commented 2 days ago

Hey! I appreciate your suggestion. We haven’t considered that option yet because some features depend on the window size (e.g., peak-related features, signal distance, etc.). We’ll consider integrating it in future versions as long as users are aware of the need to carefully evaluate the results when comparing windows of different lengths.