Skip to main content

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.

Release files for dashr-tools 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dashr-tools 1.3.0
File Size Uploaded
dashr_tools-1.3.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dashr-tools 1.3.0
File Interpreter ABI Platform
dashr_tools-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / dashr_tools-1.3.0.tar.gz

Download URL dashr_tools-1.3.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8eadf9951e45a8cb07e45ba5258af60074dc9df8f17ebc69e620c82d80113f3d
BLAKE2b-256 checksum
How to use checksums
5b9cbd5662c3042501879fc5e000da14017265206b6181af23574459e2494250
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.12.0 Windows/10

Release files / dashr_tools-1.3.0-py3-none-any.whl

Download URL dashr_tools-1.3.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60dae3a5031e86189879aefa5b7aaeffe301f9741812b9aa461a873b5d88a0c2
BLAKE2b-256 checksum
How to use checksums
e071851096481ac6bf4eb2c24c4d86eb7405ac37bf75e6a791d7c9533a789e26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.12.0 Windows/10

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page