aeye-lab / pymovements

A python package for processing eye movement data
https://pymovements.readthedocs.io
MIT License
61 stars 11 forks source link

Add transforms.smooth() #301

Closed dkrako closed 11 months ago

dkrako commented 1 year ago

Description of the problem

Having a way to smooth data would be nice to have.

Description of a solution

The first iteration should at least use the savgol_filter from scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.savgol_filter.html#scipy.signal.savgol_filter

Minimum acceptance criteria

Sample Code

This could be the signature:

def smooth(
        arr: list[float] | list[list[float]] | np.ndarray,
        window_length: int = 7,
        polyorder:int = 2,
        delta: float = 1.0,
) -> np.ndarray:
jakobchwastek commented 1 year ago

Here are some more suggestions for methods to start with

dkrako commented 1 year ago

excellent! you can implement any additional method you like.