ndx-pose


Namendx-pose JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryNWB extension to store pose estimation data
upload_time2022-01-26 21:28:42
maintainer
docs_urlNone
authorRyan Ly, Ben Dichter, Alexander Mathis
requires_python
licenseBSD 3-Clause
keywords neurodatawithoutborders nwb nwb-extension ndx-extension
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ndx-pose Extension for NWB

This is a work in progress and not yet ready for public usage.

## Installation

TBD

## Usage
```python
import datetime
import numpy as np
from pynwb import NWBFile, NWBHDF5IO
from ndx_pose import PoseEstimationSeries, PoseEstimation

nwbfile = NWBFile(
    session_description='session_description',
    identifier='identifier',
    session_start_time=datetime.datetime.now(datetime.timezone.utc)
)

camera1 = nwbfile.create_device(
    name='camera1',
    description='left camera',
    manufacturer='my manufacturer'
)
camera2 = nwbfile.create_device(
    name='camera2',
    description='right camera',
    manufacturer='my manufacturer'
)

data = np.random.rand(100, 3)  # num_frames x (x, y, z)
timestamps = np.linspace(0, 10, num=100)  # a timestamp for every frame
confidence = np.random.rand(100)  # a confidence value for every frame
front_left_paw = PoseEstimationSeries(
    name='front_left_paw',
    description='Marker placed around fingers of front left paw.',
    data=data,
    unit='pixels',
    reference_frame='(0,0,0) corresponds to ...',
    timestamps=timestamps,
    confidence=confidence,
    confidence_definition='Softmax output of the deep neural network.',
)

data = np.random.rand(100, 2)  # num_frames x (x, y)
timestamps = np.linspace(0, 10, num=100)  # a timestamp for every frame
confidence = np.random.rand(100)  # a confidence value for every frame
front_right_paw = PoseEstimationSeries(
    name='front_right_paw',
    description='Marker placed around fingers of front right paw.',
    data=data,
    unit='pixels',
    reference_frame='(0,0,0) corresponds to ...',
    timestamps=front_left_paw,  # link to timestamps of front_left_paw
    confidence=confidence,
    confidence_definition='Softmax output of the deep neural network.',
)

pose_estimation_series = [front_left_paw, front_right_paw]

pe = PoseEstimation(
    pose_estimation_series=pose_estimation_series,
    description='Estimated positions of front paws using DeepLabCut.',
    original_videos=['camera1.mp4', 'camera2.mp4'],
    labeled_videos=['camera1_labeled.mp4', 'camera2_labeled.mp4'],
    dimensions=np.array([[640, 480], [1024, 768]], dtype='uint8'),
    scorer='DLC_resnet50_openfieldOct30shuffle1_1600',
    source_software='DeepLabCut',
    source_software_version='2.2b8',
    nodes=['front_left_paw', 'front_right_paw'],
    edges=np.array([[0, 1]], dtype='uint8'),
    # devices=[camera1, camera2],  # this is not yet supported
)

behavior_pm = nwbfile.create_processing_module(
    name='behavior',
    description='processed behavioral data'
)
behavior_pm.add(pe)

path = 'test_pose.nwb'
with NWBHDF5IO(path, mode='w') as io:
    io.write(nwbfile)

with NWBHDF5IO(path, mode='r', load_namespaces=True) as io:
    read_nwbfile = io.read()
    read_pe = read_nwbfile.processing['behavior']['PoseEstimation']
    print(read_pe)
```


## Contributors
- @rly
- @bendichter
- @AlexEMG

This extension was created using [ndx-template](https://github.com/nwb-extensions/ndx-template).



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ndx-pose",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "NeurodataWithoutBorders,NWB,nwb-extension,ndx-extension",
    "author": "Ryan Ly, Ben Dichter, Alexander Mathis",
    "author_email": "rly@lbl.gov, bdichter@lbl.gov, alexander.mathis@epfl.ch",
    "download_url": "https://files.pythonhosted.org/packages/19/24/c9791f28d2cef4198a3bfb714e0c98421361894e5c3fd7b00d401a0270d4/ndx-pose-0.1.1.tar.gz",
    "platform": "",
    "description": "# ndx-pose Extension for NWB\n\nThis is a work in progress and not yet ready for public usage.\n\n## Installation\n\nTBD\n\n## Usage\n```python\nimport datetime\nimport numpy as np\nfrom pynwb import NWBFile, NWBHDF5IO\nfrom ndx_pose import PoseEstimationSeries, PoseEstimation\n\nnwbfile = NWBFile(\n    session_description='session_description',\n    identifier='identifier',\n    session_start_time=datetime.datetime.now(datetime.timezone.utc)\n)\n\ncamera1 = nwbfile.create_device(\n    name='camera1',\n    description='left camera',\n    manufacturer='my manufacturer'\n)\ncamera2 = nwbfile.create_device(\n    name='camera2',\n    description='right camera',\n    manufacturer='my manufacturer'\n)\n\ndata = np.random.rand(100, 3)  # num_frames x (x, y, z)\ntimestamps = np.linspace(0, 10, num=100)  # a timestamp for every frame\nconfidence = np.random.rand(100)  # a confidence value for every frame\nfront_left_paw = PoseEstimationSeries(\n    name='front_left_paw',\n    description='Marker placed around fingers of front left paw.',\n    data=data,\n    unit='pixels',\n    reference_frame='(0,0,0) corresponds to ...',\n    timestamps=timestamps,\n    confidence=confidence,\n    confidence_definition='Softmax output of the deep neural network.',\n)\n\ndata = np.random.rand(100, 2)  # num_frames x (x, y)\ntimestamps = np.linspace(0, 10, num=100)  # a timestamp for every frame\nconfidence = np.random.rand(100)  # a confidence value for every frame\nfront_right_paw = PoseEstimationSeries(\n    name='front_right_paw',\n    description='Marker placed around fingers of front right paw.',\n    data=data,\n    unit='pixels',\n    reference_frame='(0,0,0) corresponds to ...',\n    timestamps=front_left_paw,  # link to timestamps of front_left_paw\n    confidence=confidence,\n    confidence_definition='Softmax output of the deep neural network.',\n)\n\npose_estimation_series = [front_left_paw, front_right_paw]\n\npe = PoseEstimation(\n    pose_estimation_series=pose_estimation_series,\n    description='Estimated positions of front paws using DeepLabCut.',\n    original_videos=['camera1.mp4', 'camera2.mp4'],\n    labeled_videos=['camera1_labeled.mp4', 'camera2_labeled.mp4'],\n    dimensions=np.array([[640, 480], [1024, 768]], dtype='uint8'),\n    scorer='DLC_resnet50_openfieldOct30shuffle1_1600',\n    source_software='DeepLabCut',\n    source_software_version='2.2b8',\n    nodes=['front_left_paw', 'front_right_paw'],\n    edges=np.array([[0, 1]], dtype='uint8'),\n    # devices=[camera1, camera2],  # this is not yet supported\n)\n\nbehavior_pm = nwbfile.create_processing_module(\n    name='behavior',\n    description='processed behavioral data'\n)\nbehavior_pm.add(pe)\n\npath = 'test_pose.nwb'\nwith NWBHDF5IO(path, mode='w') as io:\n    io.write(nwbfile)\n\nwith NWBHDF5IO(path, mode='r', load_namespaces=True) as io:\n    read_nwbfile = io.read()\n    read_pe = read_nwbfile.processing['behavior']['PoseEstimation']\n    print(read_pe)\n```\n\n\n## Contributors\n- @rly\n- @bendichter\n- @AlexEMG\n\nThis extension was created using [ndx-template](https://github.com/nwb-extensions/ndx-template).\n\n\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause",
    "summary": "NWB extension to store pose estimation data",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [
        "neurodatawithoutborders",
        "nwb",
        "nwb-extension",
        "ndx-extension"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c201645f8636563338ca948e5a9281644c257f113f8ca1bd12ddd86c008c3f5",
                "md5": "56128dcc1831a5c4ca20b98d89765bdf",
                "sha256": "229718b494bf34f2e7f73d6e185b074a46169420b57e8573944a14b280b0a472"
            },
            "downloads": -1,
            "filename": "ndx_pose-0.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "56128dcc1831a5c4ca20b98d89765bdf",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8334,
            "upload_time": "2022-01-26T21:28:40",
            "upload_time_iso_8601": "2022-01-26T21:28:40.279896Z",
            "url": "https://files.pythonhosted.org/packages/2c/20/1645f8636563338ca948e5a9281644c257f113f8ca1bd12ddd86c008c3f5/ndx_pose-0.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1924c9791f28d2cef4198a3bfb714e0c98421361894e5c3fd7b00d401a0270d4",
                "md5": "c14c71de51eca72cc99b4aa5f4edb6e0",
                "sha256": "167dc25f13ba1abc924543cbe44123703303b3f61e5baf6108334a3fe6def11c"
            },
            "downloads": -1,
            "filename": "ndx-pose-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c14c71de51eca72cc99b4aa5f4edb6e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16510,
            "upload_time": "2022-01-26T21:28:42",
            "upload_time_iso_8601": "2022-01-26T21:28:42.440491Z",
            "url": "https://files.pythonhosted.org/packages/19/24/c9791f28d2cef4198a3bfb714e0c98421361894e5c3fd7b00d401a0270d4/ndx-pose-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-01-26 21:28:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ndx-pose"
}
        
Elapsed time: 0.34710s