-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97635a5
commit 37f941f
Showing
3 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 28, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import sleap_io as sio\n", | ||
"import ndx_pose as ndp\n", | ||
"from pynwb import NWBFile, NWBHDF5IO\n", | ||
"import numpy as np\n", | ||
"from pynwb.file import Subject\n", | ||
"from ndx_pose import (\n", | ||
" PoseEstimationSeries,\n", | ||
" PoseEstimation,\n", | ||
")\n", | ||
"from sleap_io.io.nwb import read_nwb" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 41, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/Users/keya/mambaforge3/envs/io_dev/lib/python3.12/site-packages/hdmf/utils.py:668: UserWarning: Ignoring cached namespace 'core' version 2.6.0-alpha because version 2.7.0 is already loaded.\n", | ||
" return func(args[0], **pargs)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"path = \"/Users/keya/salk/io_fork/tests/data/nwb/centered_pair_predictions.nwb\"\n", | ||
"labels = read_nwb(path)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 42, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"No accelerated colorspace conversion found from yuv420p to bgr24.\n" | ||
] | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[Video(filename=\"/Users/keya/salk/io_fork/tests/data/videos/centered_pair_low_quality.mp4\", shape=(1100, 384, 384, 1), backend=MediaVideo)] \n", | ||
" [Skeleton(nodes=[\"head\", \"neck\", \"thorax\", \"abdomen\", \"wingL\", \"wingR\", \"forelegL1\", \"forelegL2\", \"forelegL3\", \"forelegR1\", \"forelegR2\", \"forelegR3\", \"midlegL1\", \"midlegL2\", \"midlegL3\", \"midlegR1\", \"midlegR2\", \"midlegR3\", \"hindlegL1\", \"hindlegL2\", \"hindlegL3\", \"hindlegR1\", \"hindlegR2\", \"hindlegR3\"], edges=[(2, 1), (1, 0), (2, 3), (2, 4), (2, 5), (2, 6), (6, 7), (7, 8), (2, 9), (9, 10), (10, 11), (2, 12), (12, 13), (13, 14), (2, 15), (15, 16), (16, 17), (2, 18), (18, 19), (19, 20), (2, 21), (21, 22), (22, 23)])] \n", | ||
" [Track(name='track0'), Track(name='track1'), Track(name='track2'), Track(name='track3'), Track(name='track4'), Track(name='track5'), Track(name='track6'), Track(name='track7'), Track(name='track8'), Track(name='track9'), Track(name='track10'), Track(name='track11'), Track(name='track12'), Track(name='track13'), Track(name='track14'), Track(name='track15'), Track(name='track16'), Track(name='track17'), Track(name='track18'), Track(name='track19'), Track(name='track20'), Track(name='track21'), Track(name='track22'), Track(name='track23'), Track(name='track24'), Track(name='track25'), Track(name='track26')]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(labels.videos, \"\\n\", labels.skeletons, \"\\n\", labels.tracks)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"path2 = \"/Users/keya/salk/io_fork/tests/data/nwb/centered_pair_predictions.slp\"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 20, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"SLEAP_VIDEO_000_centered_pair_small pynwb.base.ProcessingModule at 0x5866207472\n", | ||
"Fields:\n", | ||
" data_interfaces: {\n", | ||
" untracked000 <class 'ndx_pose.pose.PoseEstimation'>,\n", | ||
" untracked001 <class 'ndx_pose.pose.PoseEstimation'>\n", | ||
" }\n", | ||
" description: Processed SLEAP pose data for centered_pair_small.mp4 with Skeleton-0 skeleton.\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/Users/keya/mambaforge3/envs/io_dev/lib/python3.12/site-packages/hdmf/utils.py:668: UserWarning: Ignoring cached namespace 'core' version 2.6.0-alpha because version 2.7.0 is already loaded.\n", | ||
" return func(args[0], **pargs)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"path = \"/Users/keya/salk/io_fork/tests/data/slp/minimal_instance_w_prediction.nwb\"\n", | ||
"with NWBHDF5IO(path, mode=\"r\") as io:\n", | ||
" read_nwbfile = io.read()\n", | ||
" #print(read_nwbfile)``\n", | ||
" print(read_nwbfile.processing[\"SLEAP_VIDEO_000_centered_pair_small\"])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 23, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/Users/keya/mambaforge3/envs/io_dev/lib/python3.12/site-packages/hdmf/utils.py:668: UserWarning: Ignoring cached namespace 'core' version 2.6.0-alpha because version 2.7.0 is already loaded.\n", | ||
" return func(args[0], **pargs)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"path = \"/Users/keya/salk/io_fork/tests/data/slp/minimal_instance_w_prediction.nwb\"\n", | ||
"with NWBHDF5IO(path, mode=\"r\") as io:\n", | ||
" read_nwbfile = io.read()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "io_dev", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Binary file not shown.
Binary file not shown.