harp-protocol 0.2.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: harp-protocol
3
+ Version: 0.2.0a1
4
+ Summary: Library for data acquisition and control of devices implementing the Harp protocol.
5
+ Project-URL: Repository, https://github.com/fchampalimaud/pyharp/
6
+ Project-URL: Bug Tracker, https://github.com/fchampalimaud/pyharp/issues
7
+ Project-URL: Documentation, https://fchampalimaud.github.io/pyharp/
8
+ Author-email: "Hardware and Software Platform, Champalimaud Foundation" <software@research.fchampalimaud.org>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: harp,python
12
+ Requires-Python: <4.0,>=3.9
13
+ Requires-Dist: pyserial>=3.5
14
+ Description-Content-Type: text/markdown
15
+
16
+ # pyharp
17
+
18
+ Python implementation of the Harp protocol for hardware control and data acquisition.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ uv add pyharp
24
+ # or
25
+ pip install pyharp
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ```python
31
+ from pyharp import MessageType, PayloadType
32
+ from pyharp.device import Device
33
+ from pyharp.messages import HarpMessage
34
+
35
+ # Connect to a device
36
+ device = Device("/dev/ttyUSB0")
37
+ #device = Device("COM3") # for Windows
38
+
39
+ # Get device information
40
+ device.info()
41
+
42
+ # define register_address
43
+ register_address = 32
44
+
45
+ # Read from register
46
+ value = device.send(HarpMessage.create(MessageType.READ, register_address, PayloadType.U8))
47
+
48
+ # Write to register
49
+ device.send(HarpMessage.create(MessageType.WRITE, register_address, PayloadType.U8, value))
50
+
51
+ # Disconnect when done
52
+ device.disconnect()
53
+ ```
54
+
55
+ or using the `with` statement:
56
+
57
+ ```python
58
+ from pyharp import MessageType, PayloadType
59
+ from pyharp.device import Device
60
+ from pyharp.messages import HarpMessage
61
+
62
+ with Device("/dev/ttyUSB0") as device:
63
+ # Get device information
64
+ device.info()
65
+
66
+ # define register_address
67
+ register_address = 32
68
+
69
+ # Read from register
70
+ value = device.send(HarpMessage.create(MessageType.READ, register_address, PayloadType.U8))
71
+
72
+ # Write to register
73
+ device.send(HarpMessage.create(MessageType.WRITE, register_address, PayloadType.U8, value))
74
+ ```
75
+
76
+ ## for Linux
77
+
78
+ ### Install UDEV Rules
79
+
80
+ Install by either copying `10-harp.rules` over to your `/etc/udev/rules.d` folder or by symlinking it with:
81
+ ````
82
+ sudo ln -s /absolute/path/to/10-harp.rules /etc/udev/rules.d/10-harp.rules
83
+ ````
84
+
85
+ Then reload udev rules with
86
+ ````
87
+ sudo udevadm control --reload-rules
88
+ ````
@@ -0,0 +1,19 @@
1
+ pyharp/communication/__init__.py,sha256=jsBSxOBlwyjPy5O5ntmCuUE1coo0XSE0BHia7qKQS_I,87
2
+ pyharp/communication/device.py,sha256=x-LjC7ArC9LEGCPlj9rhflI3ic7ZFW_sD9OUFeAkD-M,34573
3
+ pyharp/communication/harp_serial.py,sha256=vZKiI5oP9w2X7zUq8jc5B6BzMeWOh9oKQYODGGOs_dA,4725
4
+ pyharp/devices/.gitignore,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ pyharp/protocol/__init__.py,sha256=5ryzj5RZctLnvyCcgypVDq5N1obwhds-Vir7Q4Vmg10,35
6
+ pyharp/protocol/base.py,sha256=PTgHrq3vydDckaoltURqMCDRaZU-yW8s1QOg8ZiuyXY,11600
7
+ pyharp/protocol/device_names.py,sha256=9r3ZBVgeeT9vglepiufSuXbmVH3kTq2CowVoI_dAGeY,1500
8
+ pyharp/protocol/exceptions.py,sha256=yC-Qs_Uf72pH6tfPqKRcUZGaVnBIm9QKIa1Be3DDwzo,104
9
+ pyharp/protocol/messages.py,sha256=2Z061uacrukmvQrc6TrrNXG3EV14ccelL28bmj20JVc,18894
10
+ pyharp.devices/pyharp.behavior/pyharp/devices/behavior/__init__.py,sha256=lpQO5qMQE8xWnP6ylitRh94HaC2tKbkQvDKPKWBKBlk,28
11
+ pyharp.devices/pyharp.behavior/pyharp/devices/behavior/pyharpdevice.py,sha256=WDOoEB0FYTiKx8iwRguG31-Y-sjMzOlNMlqsB5P-jvw,66089
12
+ pyharp.devices/pyharp.loadcells/pyharp/devices/loadcells/__init__.py,sha256=lpQO5qMQE8xWnP6ylitRh94HaC2tKbkQvDKPKWBKBlk,28
13
+ pyharp.devices/pyharp.loadcells/pyharp/devices/loadcells/pyharpdevice.py,sha256=K1BccxC7imVhpKz71gkoEpciSKhYxHyV_wwbDYoEPNo,52030
14
+ pyharp.devices/pyharp.olfactometer/pyharp/devices/olfactometer/__init__.py,sha256=lpQO5qMQE8xWnP6ylitRh94HaC2tKbkQvDKPKWBKBlk,28
15
+ pyharp.devices/pyharp.olfactometer/pyharp/devices/olfactometer/pyharpdevice.py,sha256=oU6IyxRS-rVqQgp10UjG7twCoZCsgmsyJ8Ju0qa4V9I,55172
16
+ harp_protocol-0.2.0a1.dist-info/METADATA,sha256=neQnXtaJE_0hHuLe93XWBEzOhJfAsnmssne7zrMfuo8,2260
17
+ harp_protocol-0.2.0a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ harp_protocol-0.2.0a1.dist-info/licenses/LICENSE,sha256=ish_WawV1WE7CaRCoiyvgwKWbPNtX1-q0cQOShnlSdE,1133
19
+ harp_protocol-0.2.0a1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hardware and Software Platform, Champalimaud Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ from .device import Device as Device
2
+ from .harp_serial import HarpSerial as HarpSerial