The goal is to write a function that will calculate a rolling median on our acceleration data. Calculating a rolling median is an important data processing step. The rolling median helps to stabilize the raw actigraphy data and limit the distorting effects of outliers. The improved quality of the data will then benefit our angle-z calculations, as they will be based on more representative data.
Tasks
[x] The function will take an instance of the Measurement class, containing the acceleration data in the form of a numpy 2D array, with sample number of rows and 3 (xyz)columns. The time attribute will be a polars Series of datetime.datetime. objects.
[x] The function will take as an optional input an int for the window_size. The default value will be 51.
[ ] The sliding window must be centered, meaning logic to handle edge cases where the window will partly extend beyond the data range will be required. We will use a nan-mean i.e. the window gets smaller at the edges.
[x] The function will output an instance of the Measurement class containing the rolling_median_acceleration data, and the unmodified time data from the input.
[ ] The shape of rolling_median_acceleration output and the acceleration data input should be the same.
Description
The goal is to write a function that will calculate a rolling median on our acceleration data. Calculating a rolling median is an important data processing step. The rolling median helps to stabilize the raw actigraphy data and limit the distorting effects of outliers. The improved quality of the data will then benefit our angle-z calculations, as they will be based on more representative data.
Tasks
Freeform Notes
No response