✨ Highlight ✨ netCDF is the file format 🗃️ of choice for saving movement
datasets 💾
Saving to netCDF is the recommended way to preserve the complete state of your analysis, including all variables, coordinates, and attributes. Below is an example of how you may integrate netCDF into you movement-powered workflows:
from movement.io import load_poses
from movement.filtering import rolling_filter
from movement.kinematics import compute_speed
ds = load_poses.from_file(
"path/to/my_data.h5", source_software="DeepLabCut", fps=30
)
# Apply a rolling median filter to smooth the position data
ds["position_smooth"] = rolling_filter(
ds["position"], window=5, statistic="median"
)
# Compute speed based on the smoothed position data
ds["speed"] = compute_speed(ds["position_smooth"])
# Save the dataset to a netCDF file
# This includes the original position and confidence data,
# the smoothed position, and the computed speed
ds.to_netcdf("my_data_processed.nc")
To later load the dataset back from disk:
import xarray as xr
ds = xr.open_dataset("my_data_processed.nc")
Miscellaneous
- Completely remove deprecated median_filter function by @niksirbi in #611
- Add log_to_attrs decorator to scale function by @niksirbi in #604
Warning
The deprecated movement.filtering.median_filter()
function has been completely removed. Use movement.filtering.median_filter()
instead, with statistic="median"
.
Housekeeping
- Change path to match GIN repo current status by @sfmig in #603
- Add note for Apple silicon users with macOS <=13 by @niksirbi in #605
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #607
- chore: run codespell throughout fixing a typo by @yarikoptic in #608
- Remove announcement banner for Open Software Week by @niksirbi in #610
- Remove "easily" from some longer examples by @adamltyson in #612
New Contributors
- @yarikoptic made their first contribution in #608
Full Changelog: v0.7.0...v0.7.1