Metadata-Version: 2.4
Name: harp-behavior
Version: 3.4.0
Summary: Interface for data acquisition and control of Harp Behavior devices.
Author-email: harp-tech <contact@harp-tech.org>
License-Expression: MIT
Project-URL: Homepage, https://harp-tech.org/device.behavior
Project-URL: Repository, https://github.com/harp-tech/device.behavior
Project-URL: Bug Tracker, https://github.com/harp-tech/device.behavior/issues
Project-URL: Changelog, https://github.com/harp-tech/device.behavior/releases
Keywords: harp,behavior,data-acquisition,hardware,device-control
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: harp-protocol>=0.5
Requires-Dist: harp-device>=0.5
Requires-Dist: numpy>=1.24
Dynamic: license-file

# harp-behavior

The Python interface for the [Harp Behavior](https://harp-tech.org/device.behavior) device. It carries the register classes for the device, the payload and enumeration types those registers use, and a `REGISTER_MAP` pairing every address with its register.

## Installation

```text
pip install harp-behavior
```

## Reading and writing registers

Register classes are passed to `read` and `write` on an open device transport, such as the serial transport in [Harp Python](https://harp-tech.org/python/).

```python
from harp import serial
from harp.device import behavior, client

SERIAL_PORT = "/dev/ttyUSB0"  # or "COMx" in Windows, where "x" is the serial port number

with serial.open_device(client.Device, port=SERIAL_PORT) as device:
    print("device:", behavior.DEVICE_NAME, "WhoAmI:", behavior.WHO_AM_I)
    print("analog data:", device.read(behavior.AnalogData).payload)
```

`open_dataset` in `harp.data` takes this module as its second argument, and decodes recorded data through the same register classes.

## Feedback and contributing

`harp-behavior` is released as open source under the MIT license. Bug reports and contributions are welcome at [the GitHub repository](https://github.com/harp-tech/device.behavior).
