Skip to main content

Store data from human wearables

Project description

ndx-wearables Extension for NWB

Store data from wearable devices in NWB

This extension is designed to help store data collected from a wide variety of wearable devices in a cross-device capable way, and with an eye towards clinical applications. For more details about the extension, see the paper "NDX-Wearables: An NWB Extension for Clinical Neuroscience" (to be presented at NER 2025).

Installation

Create a new Python environment. Python 3.11 works well, python 3.8-3.12 have been tested.

conda create -n <env_name> python=3.11

You should be able to install from pypi using pip install ndx-wearables

If you would like to install and contribute to developing the package, follow the instructions below in Installing in editable mode

Usage

To see how the data stored using this extension looks, visit our example dataset on the EMBER Archive.

You can also generate a local copy of a synthetic datasets by running the relevant examples/ scripts, for instance

python examples/activity_classification.py

Notes on Extension Usage

This extension provides three key classes (WearableTimeSeries, WearableEnumSeries, WearableEvents) to cover:

  • WearableTimeSeries for general time series data sampled from a wearable device, such as blood oxygenation level
  • WearableEnumSeries for categorical variables over time with pre-defined meanings (for example sleep stages over time)
  • WearableEvents for sparse events over long time periods (e.g. exercise events)

In addition to these classes, metadata may be required, including:

  • wearable_device is required for classes that link to a device
  • algorithm is required for many classes to indicate how the data was derived

The PhysiologicalMeasure class is povided to group together similar physiological measurements (e.g. heart rate variability, motion) from different devices/sources. This could include redundant measurements of the same physiological variable, or multiple measurements which will be fused by later processing to estimate an unknown quantity (e.g. multiple accelerometer measurements).

If these arguments are omitted, instantiating the class will raise an error. You can find working examples in the scripts under examples.

Arguments for ndx-wearables Classes

Class Name Required Arguments Optional Arguments
WearableTimeSeries name, description, data, timestamps, wearable_device, algorithm comments, resolution, conversion
WearableEnumSeries name, description, data, timestamps, wearable_device, meanings, algorithm resolution, conversion, comments
WearableEvents name, description, columns, wearable_device, algorithm resolution, conversion, comments

These reflect typical usage in constructors. For full context or updates, refer to the class definitions in src/pynwb/ndx_wearables and usage examples in examples.

Developing the extension

We use a gitflow model for collaborative development. Each feature should be created on a branch that branches off of the develop branch. Draft PRs back into develop should be open for each WIP feature, and marked as ready for review once the feature is complete. Periodic releases will be made from develop into main.

Installing in editable mode

Navigate to the project root cd path/to/ndx-wearables, then install the required dependencies. For developers, use:

pip install -r requirements-dev.txt

Custom extensions are added to the extension spec YAML file by running:

python src/spec/create_extension_spec.py

After running this script, you can verify that the extensions are correctly added to spec/ndx-wearables.extensions.yaml.

Running test code may be done with PyTest using the test files located in src/pynwb/tests.

To use custom extensions outside a PyTest setting, they must be registered by navigating to the directory root and installing the package:

cd path/to/ndx-wearables
pip install -e .

This extension was created using ndx-template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ndx_wearables-0.2.1.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ndx_wearables-0.2.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file ndx_wearables-0.2.1.tar.gz.

File metadata

  • Download URL: ndx_wearables-0.2.1.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ndx_wearables-0.2.1.tar.gz
Algorithm Hash digest
SHA256 61065073c82ae85dd0fbc5380a91ef9c959b238334cdf48c618cc9302e738d27
MD5 d2573259962b1dfc27e280ea7ca93472
BLAKE2b-256 8fec18d605fb0961cb34b3610035ebc987f13e8dc65216d20358492d199b4644

See more details on using hashes here.

Provenance

The following attestation bundles were made for ndx_wearables-0.2.1.tar.gz:

Publisher: publish-release.yaml on BCM-Neurosurgery/ndx-wearables

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ndx_wearables-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ndx_wearables-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ndx_wearables-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63ef71b531ce221c334f63bb4a682f10f6e3633cfda6b962afbe4cd9c25bf194
MD5 c4f6ba1ce560f9175c6c42147224dc0a
BLAKE2b-256 99680404e6dca189f5e2f837e390796cecb829794d7704e03ea766886227af25

See more details on using hashes here.

Provenance

The following attestation bundles were made for ndx_wearables-0.2.1-py3-none-any.whl:

Publisher: publish-release.yaml on BCM-Neurosurgery/ndx-wearables

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page