Open lochhh opened 3 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.69%. Comparing base (
a1c91e6
) to head (157684b
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Description
What is this PR
Why is this PR needed? This PR closes #191
What does this PR do?
filtering
module to accept DataArrays (instead of Datasets) as inputs.median_filter
andsavgol_filter
is thewindow_length
(renamed aswindow
to better align with xarray and pandas). Before this PR, the unit of thewindow
is determined based onds.time_unit
. If thetime_unit
is in seconds, thewindow
supplied will be treated as seconds and converted to frames usingwindow = int(window * ds.fps)
. Now that we no longer have access to theds.time_unit
andds.fps
attributes, the definition ofwindow
is changed to "The size of the filter window, representing the fixed number of observations used for each window". This appears to be quite awkward, especially in the examples, where the windows are defined in "seconds". So there is the extra step to convert seconds to frames when supplyingwindow
to the filters.max_gap
argument ofinterpolate_over_time
function, on the other hand, takes care of 'seconds' vs 'frames', as we are directly supplying thetime
dimension toxarray.interpolate_na
. Whilst neat, this behaviour is inconsistent with the aforementioned filters, which only considers number of observations/frames.filter_and_interpolate
andsmooth
examples have been updated. (Note point 2.)valid_poses_dataset
andvalid_poses_dataset_with_nan
in place of thesample_dataset
fixture (now removed).conftest.py
are simplified to calculate NaNs in the entire data array, rather than for a single dimension of a single keypoint from a single individual.report_nan_values
function has also been adapted to report NaN stats for a single DataArray - note that this doesn't yet account for "single" individual or "single" keypoint cases (e.g.ds.position.sel(individuals="ind1")
,ds.position.sel(keypoints="snout")
. Hence, in thefilter_and_interpolate
example,ds.position.sel(individuals="ind1")
is dropped, which also means we need tosqueeze()
before plotting.<module>_wrapper
s have been added to handle forwarding accessor method calls to the respective modules.References
191
How has this PR been tested?
Tests were written (and then removed) to first compare equality of the outputs from the initial
Dataset
filters and the newly addedDataArray
filters. Existing tests for the overwritten filters are then adapted for the new ones.Is this a breaking change?
Yes. See points 1 and 2 above.
Does this PR require an update to the documentation?
Affected examples have been updated. Accessor methods are also added to
api.rst
TO-DO
data_vars
usage in examples (in a separate PR); smaller examples are available in thefiltering_wrapper
docstrings.Checklist: