Skip to main content

A low-level interface for loading binary Harp protocol data

Project description

harp-python

A low-level interface to data collected with the Harp binary protocol.

Data model

The interface makes use of a Pydantic data model generated from Harp device schema definitions. The schema data classes are used to automatically generate binary readers for each device.

All binary data files from a single device need to be stored in the same folder alongside the device meta-schema, named device.yml. Each register file should have the following naming convention <deviceName>_<registerAddress>.bin.

For example, for a dataset collected with a Behavior device, you might have:

📦device.harp
 ┣ 📜Behavior_0.bin
 ┣ 📜Behavior_1.bin
...
 ┗ 📜device.yml

How to use

Create device reader object from schema

import harp
reader = harp.create_reader("device.harp")

Read data from named register

reader.OperationControl.read()

Access register metadata

reader.OperationControl.register.address

Create device reader object with UTC datetime format

reader = harp.create_reader("device.harp", epoch=harp.REFERENCE_EPOCH)

Read data with message type information

reader.OperationControl.read(keep_type=True)

Read data from a specific file

reader.OperationControl.read("data/Behavior_10.bin")

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

harp_python-0.2.0-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

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