Skip to main content

Toolkit to interface with Duke Injury Biomechanics Laboratory DASHR device data.

Project description

DASHR Tools

pipeline status coverage report Latest Release

This package contains tools and utilities to facilitate work with the Data Acquisition System for Head Response (DASHR) from Duke University's Injury Biomechanics Laboratory.

Installation

dashr_tools can be installed from PyPI:

pip install dashr-tools

Reading DASHR files

The DASHR system produces raw binary (.bin) files. Each file contains a header with metadata, followed by acceleration, angular velocity, and auxiliary sensor data. There are two versions of the DASHR system, which are automatically detected by the included package. One version contains three axes of "high-range" acceleration data ($\pm$ 200g), three axes of angular velocity data ($\pm$ 4000 deg/s), temperature, and ambient light. The other version additionally has three axes of "low-range" acceleration ($\pm$ 32g). The DASHR saves data incrementally in fixed-size files. These must be stitched together to collect the full data trace from long collection sessions.

The DASHRData class can be used to load DASHR data files and folders.

from dashr_tools import DASHRData
dashr_data = DASHRData(folder_path)
dashr_df = dashr_data.to_dataframe()
print(dashr_df.head())
print(dashr_df.columns, dashr_df.shape)

Alternatively, to load DASHR data, either single files can be imported, or an entire folder can be loaded at once.

To view compiled data, individual channels can be accessed from the DASHRData object:

dashr_data.x_acceleration
dashr_data.z_gyro
dashr_data.temperature
from dashr_tools.bin_reader import read_single, read_folder

# Read a single data file
filename = "C:/Some/Path/to/DASHR/Data/L0.bin"
single_file = read_single(filename) # returns a DASHRData object

# Read a full folder
folder_path = "C:/Some/Path/to/DASHR/Data"
dashr_data = read_folder(folder_path) # returns a DASHRData object

Each DASHRData can be operated on as a pandas DataFrame object with either DASHRData.dataframe or DASHRData.to_dataframe(). As well, data can be dumped to disc using DASHRData.to_csv(). The dataframe object can be saved to any desired file format using pandas built-ins.

Device clock management

A commandline utility is provided to ensure DASHR timestamps are properly configured. The DASHR system has a real time clock (RTC) which must be set through a serial connection to a computer. The SerialConnection.py script will run for 30 seconds (configurable in the script) and will open communication with any detected DASHR devices, and will reset the clock to the current time. Accuracy is to within one second. Currently, this only works with one device at a time.

Development

There are two options to running and using the dashr_tools package as a developer. The preferred method is using poetry to install the package locally. Alternatively, you can copy the dashr_tools folder to your local development directory. Packages must be installed manually for this to work.

Poetry installation

These installation instructions assume that you have an appropriate version of python already installed to your machine. dashr_tools requires python >= 3.12, and poetry version 2.0.1 or greater. poetry can be installed with pip, conda or pipx:

pipx install poetry
# conda install poetry
# pip install poetry

With poetry installed...

poetry install

You may run into an issue where your current version of poetry/python conflict with the bundled poetry.lock file. In that case, you may run poetry lock to rebuild that file. Worst case, delete the poetry.lock and run poetry install to rebuild the environment.

After installing, you may run any of the tools locally from this project folder. To use the dashr_tools elsewhere, you must build and install based on the instructions for your desired package manager (e.g. pip)

poetry build 
pip install  dist\dashr_tool-X.X.X-y.whl

Replace "X.X.X" and "y" with the appropriate build labels based on your local configuration. The python wheel should be in the dist folder.

License

Code within this repository may not be used without the permission of a current member of the Duke University Injury Biomechanics Laboratory.

For questions as of February 6, 2025, contact Mitchell Abrams.

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

dashr_tools-1.3.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

dashr_tools-1.3.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file dashr_tools-1.3.0.tar.gz.

File metadata

  • Download URL: dashr_tools-1.3.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.0 Windows/10

File hashes

Hashes for dashr_tools-1.3.0.tar.gz
Algorithm Hash digest
SHA256 8eadf9951e45a8cb07e45ba5258af60074dc9df8f17ebc69e620c82d80113f3d
MD5 aebef7d432820cb509da964eb0a0f72a
BLAKE2b-256 5b9cbd5662c3042501879fc5e000da14017265206b6181af23574459e2494250

See more details on using hashes here.

File details

Details for the file dashr_tools-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: dashr_tools-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.0 Windows/10

File hashes

Hashes for dashr_tools-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60dae3a5031e86189879aefa5b7aaeffe301f9741812b9aa461a873b5d88a0c2
MD5 84b8fbc0daec86fb1f8ad254afa3ad13
BLAKE2b-256 e071851096481ac6bf4eb2c24c4d86eb7405ac37bf75e6a791d7c9533a789e26

See more details on using hashes here.

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