Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pose tracks io #33

Merged
merged 80 commits into from
Sep 18, 2023
Merged
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
855bc15
added sleap-io as dependency
niksirbi Jul 4, 2023
e69862b
added function for converting SLEAP poses into DLC-style df
niksirbi Jul 4, 2023
044cff4
added functions for loading SLEAP pose tracks
niksirbi Jul 4, 2023
6b8fdbb
renamed converters module to convert
niksirbi Jul 17, 2023
e8de770
renamed converters module to convert
niksirbi Jul 17, 2023
ce28d1d
add attrs as dependency
niksirbi Jul 17, 2023
5cdd989
Implemented PoseTracks class with import functions from SLEAP
niksirbi Jul 18, 2023
3e86805
modified docstrings in PoseTracks
niksirbi Jul 19, 2023
6aa9df4
refactored from_sleap() classmethod
niksirbi Jul 19, 2023
633a9eb
Ensure that PoseTracks class is imported with the io module
niksirbi Jul 19, 2023
1fbc713
added method to import pose tracks from DeepLabCut
niksirbi Jul 19, 2023
e7a3ee8
transferred functionality of from_dict method to __init__
niksirbi Jul 19, 2023
d533989
shortened some docstrings
niksirbi Jul 20, 2023
c7075f1
deleted superceded load_poses module
niksirbi Jul 20, 2023
846527c
renamed numpy arrays for pose tracks and and scores to avoid clashiin…
niksirbi Jul 20, 2023
04ef737
implemented existing converter function as a PoseTracks.to_dlc_df() m…
niksirbi Jul 20, 2023
7ddab36
renamed from_dlc and from_sleap methods to from_dlc_file and from_sle…
niksirbi Jul 20, 2023
8ea6e70
change "frames" dim to "time"
niksirbi Jul 20, 2023
191eed8
started adapting unit tests for PoseTracks object
niksirbi Jul 20, 2023
2248a6c
added tests for PoseTracks initialisation
niksirbi Jul 21, 2023
c8444c8
removed attrs dependency for now
niksirbi Jul 21, 2023
64fe008
using pydantic 2.0 or greater
niksirbi Jul 21, 2023
49932db
make _parse_dlc_csv_to_dataframe a static method
niksirbi Jul 21, 2023
2d56a11
added test for loading a variety of valid pose files
niksirbi Jul 21, 2023
d210229
remove unnecessary variable assignments
niksirbi Jul 21, 2023
2d49657
use typing.List in type hints to make py3.8 happy
niksirbi Jul 21, 2023
719742e
make mypy happy
niksirbi Jul 21, 2023
fa57120
added file validators using pydantic 2.0
niksirbi Jul 31, 2023
92123c7
Replaced pydantic with attrs for validation
niksirbi Aug 7, 2023
1136a3b
expanded tests for file validators
niksirbi Aug 7, 2023
3c07c3a
fix code smells
niksirbi Aug 7, 2023
25732ee
use Iterable from typing
niksirbi Aug 7, 2023
95ab24f
increase test coverage
niksirbi Aug 8, 2023
962caa6
correct type hints in function signatures
niksirbi Aug 8, 2023
34138a6
refactored io module to use xarray accessor instead of subclassing
niksirbi Aug 8, 2023
31a1ed2
use isinstance instead of type
niksirbi Aug 8, 2023
01fe34c
test saving without write permissions
niksirbi Aug 11, 2023
d5f5a80
test dlc csv validator
niksirbi Aug 11, 2023
094ebba
refactored logging and add log utils
niksirbi Aug 11, 2023
28060fa
use stat to change permissions
niksirbi Aug 11, 2023
f374e4e
added sphinx design to docs requirements
niksirbi Aug 11, 2023
f92b48f
docs add home page and gettings started guide
niksirbi Aug 11, 2023
93d1e9f
remove git hash from version shown in docs
niksirbi Aug 15, 2023
bc02937
temporarily allow doc deployment from pose-tracks-io branch
niksirbi Aug 15, 2023
68de09f
fix syntac error in workflow file
niksirbi Aug 15, 2023
ed00ff7
added sphinx example gallery
niksirbi Aug 15, 2023
e48b21f
modify docs workflow file to allow deployment from this PR
niksirbi Aug 15, 2023
04ca5a5
addad matplotlib dependency to docs
niksirbi Aug 15, 2023
e77fe17
add function for listing available sample data
niksirbi Aug 15, 2023
b0ff613
renamed and expanded gallery example
niksirbi Aug 15, 2023
7434806
added movement to docs dependencies
niksirbi Aug 15, 2023
254b9b0
make movement docs requirement a local editable install
niksirbi Aug 15, 2023
210280a
fix matrix transpose when importing from sleap analysis files
niksirbi Aug 15, 2023
4285ef7
set xarray.keep_attrs True globally
niksirbi Aug 15, 2023
705e7d5
emphasise analysis files as the primary choice when loading from SLEAP
niksirbi Aug 15, 2023
4b50c4e
update sphinx example
niksirbi Aug 15, 2023
1f77af3
Added API reference to docs
niksirbi Aug 16, 2023
3925f84
harmonised docs homepage and repo README
niksirbi Aug 16, 2023
2fb1a59
added contributing guide
niksirbi Aug 16, 2023
3572b47
expanded getting started guide
niksirbi Aug 16, 2023
e848833
added info about fetching sample data to the getting started section
niksirbi Aug 16, 2023
64b4c3d
some fancier formatting for the contributing guide in docs
niksirbi Aug 16, 2023
f56b740
add style to dropdown
niksirbi Aug 17, 2023
cbade14
fixed docstirngs and API reference
niksirbi Aug 17, 2023
5c6a837
fixed issue with duplicate source files generated by sphinx-gallery
niksirbi Aug 17, 2023
95827b4
limit sphinx version to <7.2
niksirbi Aug 17, 2023
72608df
replaced type with isinstance
niksirbi Aug 17, 2023
1bae840
Merge branch 'main' into pose-tracks-io
niksirbi Aug 17, 2023
647af1f
added ValidPoseTracks to API reference
niksirbi Aug 17, 2023
0eac658
Fix typos from code review
niksirbi Sep 11, 2023
f7c2726
added check-manifest as dev dependency
niksirbi Sep 14, 2023
90778a0
removed duplicate word in manifest
niksirbi Sep 14, 2023
79acf0d
edit code examples in getting started guide to avoid key errors
niksirbi Sep 14, 2023
636f98f
fix fps value in example
niksirbi Sep 14, 2023
49f7d33
renamed find_pose_data to list_pose_data
niksirbi Sep 14, 2023
35c80ff
use assert_allclose from numpy.testing
niksirbi Sep 14, 2023
9d5af00
modify function fo logging errors
niksirbi Sep 14, 2023
839ec0f
improved DLC pose CSV file validator
niksirbi Sep 18, 2023
3164e44
write resuable list length validator
niksirbi Sep 18, 2023
58cfa33
reset docs deployment workflow
niksirbi Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
edit code examples in getting started guide to avoid key errors
niksirbi committed Sep 14, 2023
commit 79acf0d2380003e117089576ceaafbed53a1fc41
9 changes: 5 additions & 4 deletions docs/source/getting_started.md
Original file line number Diff line number Diff line change
@@ -98,6 +98,7 @@ ds = load_poses.from_dlc_df(df, fps=30)
::::

You can also try movement out on some sample data included in the package.

:::{dropdown} Fetching sample data
:color: primary
:icon: unlock
@@ -118,7 +119,7 @@ To get the path to one of the sample files,
you can use the `fetch_pose_data_path` function:

```python
file_path = datasets.fetch_pose_data_path("DLC_single-wasp.predictions.h5")
file_path = datasets.fetch_pose_data_path("DLC_two-mice.predictions.csv")
```
The first time you call this function, it will download the corresponding file
to your local machine and save it in the `~/.movement/data` directory. On
@@ -184,17 +185,17 @@ You can select subsets of the data using the `sel` method:
ds_sel = ds.sel(time=slice(0, 100))

# select specific individuals or keypoints
ds_sel = ds.sel(individuals=["mouse1", "mouse2"])
ds_sel = ds.sel(individuals=["individual1", "individual2"])
ds_sel = ds.sel(keypoints="snout")

# combine selections
ds_sel = ds.sel(time=slice(0, 100), individuals"mouse1", keypoints="snout")
ds_sel = ds.sel(time=slice(0, 100), individuals=["individual1", "individual2"], keypoints="snout")
```
All of the above selections can also be applied to the data variables,
resulting in a `DataArray` rather than a `Dataset`:

```python
pose_tracks = ds.pose_tracks.sel(individuals="mouse1", keypoints="snout")
pose_tracks = ds.pose_tracks.sel(individuals="individual1", keypoints="snout")
```
You may also use all the other powerful [indexing and selection](https://docs.xarray.dev/en/latest/user-guide/indexing.html) methods provided by `xarray`.