Closed glopesdev closed 2 months ago
CodeRabbit
The proposed changes introduce a new feature to the Encoder
class in the aeon/io/reader.py
file, allowing for optional downsampling of encoder data to 50Hz. This is achieved by adding a new read
method that performs this operation. The default behavior is to downsample, but this can be overridden. Corresponding updates have been made to the test suite in tests/io/test_api.py
, including the addition of two new tests specifically designed to verify the correct functioning of the downsampling feature.
File | Summary |
---|---|
aeon/io/reader.py |
Introduced a new read method in the Encoder class to support downsampling of encoder data to 50Hz. The downsample parameter defaults to True . This change may impact the behavior of the code and needs review. |
tests/io/test_api.py |
Updated function calls to include a new downsample parameter with a default value of None . Added support for testing the downsampling feature by introducing a new parameter downsample to the aeon.load function calls in the test cases. Two new test functions test_load_encoder_with_downsampling and test_load_encoder_without_downsampling were added to verify the downsampling functionality. |
I would also prefer the default downsample=True
in the Encoder
reader. Users can overwrite the default when they call the api.load()
(passing in downsample=False
)
As described in #396, we introduce support for downsampling raw encoder data to 50Hz. Because the magnetic encoder reports absolute angular position, it is sufficient to decimate the data by resampling periodically in bins of 20ms and taking the first value.
In this version I have set the
downsample
parameter toTrue
. This change may break old data analysis scripts so we should consider whether this is the right choice.If ensuring backwards compatibility is important, we couls also set
downsample=None
as the default, and setdownsample=True
in the ingestion scripts.Summary by CodeRabbit
Encoder
class inaeon/io/reader.py
. This allows users to downsample encoder data to 50Hz, improving performance and reducing memory usage for large datasets.tests/io/test_api.py
to include the new downsampling functionality. This ensures the feature works as expected and maintains the integrity of the data.downsample
parameter, enhancing the flexibility and usability of the testing suite.