etho-python 1.2.6__tar.gz → 1.3__tar.gz
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.
- {etho_python-1.2.6 → etho_python-1.3}/PKG-INFO +2 -2
- {etho_python-1.2.6 → etho_python-1.3}/docs/cli.md +25 -4
- {etho_python-1.2.6 → etho_python-1.3}/docs/configuration/protocol.md +5 -5
- {etho_python-1.2.6 → etho_python-1.3}/docs/extensions.md +14 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/hardware/camera.md +4 -1
- {etho_python-1.2.6 → etho_python-1.3}/docs/hardware/govee.md +4 -4
- {etho_python-1.2.6 → etho_python-1.3}/docs/hardware/hardware.rst +1 -1
- {etho_python-1.2.6 → etho_python-1.3}/docs/hardware/nidaq.md +3 -3
- {etho_python-1.2.6 → etho_python-1.3}/paper/paper.md +5 -3
- {etho_python-1.2.6 → etho_python-1.3}/pyproject.toml +2 -2
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/app.py +60 -2
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/cli.py +33 -16
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/DAQZeroService.py +32 -5
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/DLPZeroService.py +13 -1
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/GCMZeroService.py +67 -22
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/GOVZeroService.py +14 -1
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/ZeroService.py +7 -0
- etho_python-1.3/src/etho/services/__init__.py +63 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/callbacks/_image.py +65 -87
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/__init__.py +2 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/base.py +4 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/basler.py +9 -2
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/dummy.py +5 -13
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/hamamatsu.py +8 -1
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/spinnaker.py +28 -2
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/spinnaker_old.py +13 -15
- etho_python-1.3/src/etho/services/camera/webcam.py +215 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/camera/ximea.py +16 -2
- etho_python-1.3/src/etho/services/hardware.py +46 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/resumable.py +34 -16
- etho_python-1.3/tests/conftest.py +10 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_cli_gui_smoke.py +61 -2
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_daq_playlist.py +5 -0
- etho_python-1.3/tests/test_hardware.py +124 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_service_client_wiring.py +9 -0
- etho_python-1.3/tests/test_spinnaker_old.py +67 -0
- etho_python-1.3/tests/test_webcam.py +162 -0
- etho_python-1.2.6/src/etho/services/__init__.py +0 -52
- {etho_python-1.2.6 → etho_python-1.3}/.github/workflows/draft-pdf.yml +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/.github/workflows/python-package.yml +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/.github/workflows/static.yml +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/.gitignore +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/CITATION.cff +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/CONTRIBUTING.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/LICENSE +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/README.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/Makefile +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/README.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/_static/etho_dark.svg +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/_static/etho_light.svg +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/_templates/api_head.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/_templates/autosummary/module.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.app.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.cli.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.client.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.BLTZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.DAQZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.GCMZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.GOVZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.NICounterZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.TemplateZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.ZeroService.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.base.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.basler.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.dummy.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.hamamatsu.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.spinnaker.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.spinnaker_old.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.camera.ximea.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.dlp.dlp_make_warpfiles.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.utils.concurrent_task.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.services.utils.log_exceptions.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.utils.calibration.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.utils.config.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.utils.runner.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.utils.sound.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.utils.tui.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api/etho.utils.zeroclient.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/api_etho.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/callbacks.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/conf.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/configuration/calibration_led.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/configuration/calibration_speaker.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/configuration/configuration.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/configuration/global.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/configuration/playlist.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/hardware/projector.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/hardware/scanimage.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/index.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/install.rst +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/logging.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/make.bat +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/make_api_doctree.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/docs/tutorial.md +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/paper/bib.bib +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/paper/fig_flow.pdf +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/__init__.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/assets/etho_icon1_pipeline_dark.svg +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/assets/etho_icon1_pipeline_light.svg +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/client.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/res_app.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/resumable.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/BLTZeroService.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/NICounterZeroService.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/ScanImageTriggerZeroService.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/TemplateZeroService.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/callbacks/__init__.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/callbacks/_base.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/callbacks/_trace.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/daq/IOTask.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/dlp/dlp_make_warpfiles.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/dlp/dlp_runners.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/utils/__init__.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/utils/concurrent_task.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/services/utils/log_exceptions.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/__init__.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/calibration.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/config.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/runner.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/sound.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/tui.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/src/etho/utils/zeroclient.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_config.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_config.yaml +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_gov_service.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_import.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_pyav_callback.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_resumable.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_services.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_sound.py +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_sound_playlist_mono.txt +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_sound_playlist_stereo.txt +0 -0
- {etho_python-1.2.6 → etho_python-1.3}/tests/test_zarr_callbacks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: etho-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3
|
|
4
4
|
Summary: etho
|
|
5
5
|
Author-email: Jan Clemens <clemensjan@googlemail.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -12,7 +12,7 @@ Requires-Dist: numpy; python_version >= "3.11"
|
|
|
12
12
|
Requires-Dist: scipy
|
|
13
13
|
Requires-Dist: h5py
|
|
14
14
|
Requires-Dist: opencv-python-headless
|
|
15
|
-
Requires-Dist: av>=
|
|
15
|
+
Requires-Dist: av>=17.0,<18
|
|
16
16
|
Requires-Dist: bleak
|
|
17
17
|
Requires-Dist: pandas
|
|
18
18
|
Requires-Dist: pyzmq
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
# Command-Line Interface
|
|
2
2
|
|
|
3
|
-
The installed console command is `etho`.
|
|
4
|
-
|
|
3
|
+
The installed console command is `etho`. Examples on this page assume a
|
|
4
|
+
Windows rig and PowerShell.
|
|
5
5
|
|
|
6
6
|
```text
|
|
7
|
-
usage: etho [-h] {version,init,run,gui} ...
|
|
7
|
+
usage: etho [-h] {version,init,hardware,run,res-run,gui,res-gui} ...
|
|
8
8
|
|
|
9
9
|
positional arguments:
|
|
10
|
-
{version,init,run,gui}
|
|
10
|
+
{version,init,hardware,run,res-run,gui,res-gui}
|
|
11
11
|
version Displays system, version, and hardware info.
|
|
12
12
|
init Initializes config files and folders.
|
|
13
|
+
hardware Lists hardware detected by local etho services.
|
|
13
14
|
run Starts an experiment from the CLI.
|
|
15
|
+
res-run Starts a resumable DAQ/GCM experiment from the CLI.
|
|
14
16
|
gui Opens the graphical user interface.
|
|
17
|
+
res-gui Opens the resumable graphical user interface.
|
|
15
18
|
|
|
16
19
|
options:
|
|
17
20
|
-h, --help show this help message and exit
|
|
@@ -99,6 +102,24 @@ Use `--preview` for camera alignment. Preview mode disables saving and logging
|
|
|
99
102
|
for the camera run and replaces configured camera callbacks with a display
|
|
100
103
|
callback.
|
|
101
104
|
|
|
105
|
+
## Discover Hardware
|
|
106
|
+
|
|
107
|
+
In either GUI, click **Enumerate hardware** in the lower-left corner. The
|
|
108
|
+
dialog scans the acquisition computer and displays each result as it arrives.
|
|
109
|
+
You can select and copy device identifiers from the results.
|
|
110
|
+
|
|
111
|
+
Run the command on the acquisition computer.
|
|
112
|
+
|
|
113
|
+
```powershell
|
|
114
|
+
etho hardware
|
|
115
|
+
etho hardware --ble-duration 20
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The scan lists cameras, NI-DAQmx devices, USB LightCrafter 4500 projectors,
|
|
119
|
+
and nearby Govee H5075 sensors. It prints the camera settings, DAQ device names,
|
|
120
|
+
and sensor addresses to use in a protocol. The Bluetooth scan lasts 10 seconds
|
|
121
|
+
by default. Each backend reports when it finds no devices or cannot scan.
|
|
122
|
+
|
|
102
123
|
## Display System Support
|
|
103
124
|
|
|
104
125
|
```text
|
|
@@ -84,14 +84,14 @@ cameras, such as `GCM1` and `GCM2`.
|
|
|
84
84
|
|
|
85
85
|
Camera fields:
|
|
86
86
|
|
|
87
|
-
- `cam_type`: One of `Dummy`, `Spinnaker`, `Basler`, `Ximea`, or `
|
|
88
|
-
- `cam_serialnumber`: Camera serial number. The dummy camera accepts arbitrary values.
|
|
87
|
+
- `cam_type`: One of `Dummy`, `Spinnaker`, `Basler`, `Ximea`, `Hamamatsu`, or `Webcam`.
|
|
88
|
+
- `cam_serialnumber`: Camera serial number or device number, as reported by `etho hardware`. The `Webcam` and `Hamamatsu` backends use zero-based device numbers. The dummy camera accepts arbitrary values.
|
|
89
89
|
- `frame_rate`: Requested frame rate in frames per second.
|
|
90
90
|
- `frame_width`: ROI width in pixels.
|
|
91
91
|
- `frame_height`: ROI height in pixels.
|
|
92
|
-
- `shutter_speed`: Exposure time in microseconds
|
|
93
|
-
- `frame_offx`: ROI x
|
|
94
|
-
|
|
92
|
+
- `shutter_speed`: Exposure time in microseconds. Webcam uses device-managed exposure and warns if this is set.
|
|
93
|
+
- `frame_offx`, `frame_offy`: ROI x and y offsets in pixels. Both default to `0`.
|
|
94
|
+
Webcam ignores nonzero offsets and logs a warning.
|
|
95
95
|
- `binning`: Horizontal and vertical binning factor. Defaults to `1`.
|
|
96
96
|
- `brightness`: Camera brightness or black level. Defaults to `0`.
|
|
97
97
|
- `gamma`: Gamma value. Defaults to `1`.
|
|
@@ -140,6 +140,20 @@ Services that run continuously should do the work in a thread or hardware task
|
|
|
140
140
|
created during `setup()` and started during `start()`. Use a `threading.Event`
|
|
141
141
|
or equivalent stop signal so `finish()` can stop the worker cleanly.
|
|
142
142
|
|
|
143
|
+
## Hardware Discovery
|
|
144
|
+
|
|
145
|
+
A service can implement the class method `hardware_probes(*, ble_duration)`
|
|
146
|
+
to participate in `etho hardware`. Return a mapping from display labels to
|
|
147
|
+
zero-argument probe functions. Each probe returns an iterable of
|
|
148
|
+
`HardwareDevice` records from `etho.services.hardware`. Include the device name
|
|
149
|
+
and any protocol fields that identify it. An empty iterable means the scan
|
|
150
|
+
found no devices. Raise an exception when the scan cannot run.
|
|
151
|
+
|
|
152
|
+
Probes use the SDK's device-listing functions and release SDK resources before
|
|
153
|
+
returning. They run locally without creating a service instance or starting
|
|
154
|
+
acquisition. GCM discovers backends from `camera.make` that implement
|
|
155
|
+
`enumerate_devices()`, which returns `(identifier, name)` pairs.
|
|
156
|
+
|
|
143
157
|
## Wiring A Service Into Experiments
|
|
144
158
|
|
|
145
159
|
`etho run` looks up services in `etho.services.SERVICE_REGISTRY` by their
|
|
@@ -10,12 +10,14 @@ camera block or multiple suffixed blocks such as `GCM1` and `GCM2`.
|
|
|
10
10
|
| `cam_type` | Dependency |
|
|
11
11
|
|------------|------------|
|
|
12
12
|
| `Dummy` | Built in; useful for smoke tests. |
|
|
13
|
+
| `Webcam` | PyAV 17 or later, installed with Etho. |
|
|
13
14
|
| `Spinnaker` | FLIR Spinnaker SDK and Python bindings. |
|
|
14
15
|
| `Basler` | Basler pylon and `pypylon`. |
|
|
15
16
|
| `Ximea` | Ximea driver and Python package. |
|
|
16
17
|
| `Hamamatsu` | DCAM driver and `pylablib`. |
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
Run `etho hardware` on the computer to list all installed camera backends and enumerate the associated cameras with their serial numbers.
|
|
19
21
|
|
|
20
22
|
## Protocol Fields
|
|
21
23
|
|
|
@@ -39,6 +41,7 @@ The service acquires one test image during setup, then applies
|
|
|
39
41
|
`external_trigger` before the experiment starts. If triggering is enabled,
|
|
40
42
|
confirm that the camera is armed before the DAQ or counter trigger starts.
|
|
41
43
|
|
|
44
|
+
|
|
42
45
|
## Operator Checklist
|
|
43
46
|
|
|
44
47
|
- Confirm the camera appears in the vendor tool before starting Etho.
|
|
@@ -9,13 +9,13 @@ nearby sensors:
|
|
|
9
9
|
|
|
10
10
|
```powershell
|
|
11
11
|
conda activate etho
|
|
12
|
-
etho
|
|
12
|
+
etho hardware
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
After scanning for 10 seconds, the
|
|
16
|
-
temperature, and humidity. Match the temperature and humidity pair in a row to
|
|
15
|
+
After scanning for 10 seconds, the `GOV` section lists each sensor's address,
|
|
16
|
+
name, temperature, and humidity. Match the temperature and humidity pair in a row to
|
|
17
17
|
the values shown on the physical sensor's display. If multiple sensors show
|
|
18
|
-
similar values, temporarily move or warm one sensor, run `etho
|
|
18
|
+
similar values, temporarily move or warm one sensor, run `etho hardware` again,
|
|
19
19
|
and match the changed readings.
|
|
20
20
|
|
|
21
21
|
Copy the address from the matching row into the sensor's protocol block:
|
|
@@ -15,7 +15,7 @@ operated from protocols:
|
|
|
15
15
|
- :doc:`Govee H5075 temperature/humidity sensors <govee>`
|
|
16
16
|
|
|
17
17
|
You can add support for new hardware by implementing the appropriate service interface. See :ref:`extensions`.
|
|
18
|
-
|
|
18
|
+
Existing hardware can be enumerated with `etho hardware`.
|
|
19
19
|
|
|
20
20
|
.. toctree::
|
|
21
21
|
:maxdepth: 1
|
|
@@ -10,14 +10,14 @@ conda environment:
|
|
|
10
10
|
|
|
11
11
|
```powershell
|
|
12
12
|
conda activate etho
|
|
13
|
-
etho version
|
|
13
|
+
etho version
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
On machines without NI-DAQmx, DAQ API imports and DAQ runs are expected to fail.
|
|
17
16
|
|
|
18
17
|
## Channel Naming
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Run `etho hardware` to list the NI-DAQmx device names. Use the reported
|
|
20
|
+
`device` value in the `DAQ` block. You can enumerate NI-DAQmx devices via `etho hardware`. The `NIC` and `SIT` services use the same device names in their channel paths. Use NI-MAX to check available channels.
|
|
21
21
|
|
|
22
22
|
Example protocol fields:
|
|
23
23
|
|
|
@@ -45,7 +45,7 @@ In `etho`, protocols define hardware configurations and acquisition settings, wh
|
|
|
45
45
|
|
|
46
46
|
Several open-source systems address parts of the experimental control problem, but they differ substantially in scope and design goals. Bonsai provides a powerful visual programming environment for asynchronous acquisition, online processing, and closed-loop control of data streams [@Lopes_2015_bonsai]. However, its workflow-centric design can make large experimental protocols difficult to standardize, version, and reuse across users and rigs, particularly when experiments require structured management of hardware configurations, stimulus playlists, and metadata. pyControl focuses on specifying behavioral tasks as microcontroller-based state machines together with tools for managing parallel setups [@Akam_2022_opensource], but is optimized for discrete trial logic rather than coordinated acquisition across heterogeneous devices such as cameras, audio interfaces, environmental sensors, and external imaging systems. Autopilot emphasizes distributed behavioral experiments using networked Raspberry Pis [@Saunders_2019_autopilot], but is less suited for experiments requiring high-bandwidth synchronized acquisition or integration with specialized laboratory hardware. Bpod provides temporally precise control for trial-based rodent experiments through microcontroller-driven state machines [@Solari_2018_open], but does not aim to provide a general framework for multimodal acquisition and hardware orchestration. PsychoPy is widely used for visual and auditory stimulus presentation in psychophysics and human behavioral experiments [@Peirce_2019_psychopy2], but focuses primarily on stimulus delivery rather than coordinated control of diverse experimental hardware and multimodal data streams.
|
|
47
47
|
|
|
48
|
-
`Etho`complements these tools by focusing on reproducible coordination of heterogeneous laboratory hardware within a pragmatic Python framework. Rather than replacing existing acquisition or stimulus-generation software, it provides an architectural layer that organizes experiments around structured protocol, playlist, calibration, and log files. This design enables experiments to combine stimulus generation, analog and digital acquisition, camera recording, environmental monitoring, and external triggers while retaining direct Python-level control and support for lab-specific hardware extensions. Existing tools can therefore be integrated into `etho`workflows when appropriate, for example by using PsychoPy for calibrated visual stimulus generation. The primary contribution of `etho`is thus not a new standalone device-control system, but a flexible framework for coordinating multimodal experiments in a reproducible and extensible manner.
|
|
48
|
+
`Etho`complements these tools by focusing on reproducible coordination of heterogeneous laboratory hardware within a pragmatic Python framework. Rather than replacing existing acquisition or stimulus-generation software, it provides an architectural layer that organizes experiments around structured protocol, playlist, calibration, and log files. This design enables experiments to combine stimulus generation, analog and digital acquisition, camera recording, environmental monitoring, and external triggers while retaining direct Python-level control and support for lab-specific hardware extensions. Existing tools can therefore be integrated into `etho` workflows when appropriate, for example by using PsychoPy for calibrated visual stimulus generation. The primary contribution of `etho`is thus not a new standalone device-control system, but a flexible framework for coordinating multimodal experiments in a reproducible and extensible manner.
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
# Software design
|
|
@@ -53,7 +53,7 @@ Several open-source systems address parts of the experimental control problem, b
|
|
|
53
53
|
`etho` is organized modularly around __services__, __protocols__, __playlists__, and __callbacks__ (\autoref{fig:flow}).
|
|
54
54
|
Services define hardware interfaces. An experiment is defined by a protocol and a playlist. Protocols list and parameterize services and callbacks for processing and saving acquired data. Playlists specify trial structure and stimuli.
|
|
55
55
|
|
|
56
|
-
__Services__ encapsulate hardware-specific functionality. Current service classes include support for multiple camera backends, National Instruments data-acquisition boards, sound playback, optogenetic LED control, environmental monitoring, DLP-projector stimulation, and remote control of ScanImage calcium imaging rigs.
|
|
56
|
+
__Services__ encapsulate hardware-specific functionality. Current service classes include support for multiple camera backends, National Instruments data-acquisition boards, sound playback, optogenetic LED control, environmental monitoring, DLP-projector stimulation, and remote control of ScanImage calcium imaging rigs. To help configure a rig, the `etho hardware` CLI command and the GUI list detected devices such as cameras and National Instruments data-acquisition boards.
|
|
57
57
|
|
|
58
58
|

|
|
59
59
|
|
|
@@ -76,7 +76,9 @@ The modular service-process architecture makes the system reusable across rigs a
|
|
|
76
76
|
|
|
77
77
|
`Etho` is currently used in the Roemschied, Deutsch, and Clemens laboratories to run behavioral and neuroscience experiments on acoustic communication, sensory and motor processing, and social behavior [@Vijendravarma_2022_drosophila; @Steinfath_2025_neural; @Palacios_2025_drosophila; @RavindranNair_2026_sexspecific]. Its documentation includes installation instructions, protocol and playlist formats, GUI and command-line usage, and API references, making the software accessible and broadly usable.
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Testing `etho` on experimental rigs in other laboratories exposed assumptions about hardware and configuration that reflected the setup in the lab where the software was developed. Based on feedback from these deployments, we made `etho` easier to configure on different rigs, improved the setup documentation, and added support for Basler cameras. Community contributions also improved the software’s reliability.
|
|
80
|
+
|
|
81
|
+
The value of `etho` lies in making complex experiments easier to run, maintain, and reproduce. By organizing experimental configuration, acquired data, calibration information, and log files into structured, versionable formats within a reusable Python package, `etho` reduces dependence on one-off scripts and ad-hoc hardware integration. This organization enforces best practices, improves reproducibility, facilitates reuse across rigs and users, and supports more transparent reporting of experimental methods and acquisition parameters.
|
|
80
82
|
|
|
81
83
|
|
|
82
84
|
# AI usage disclosure
|
|
@@ -11,13 +11,13 @@ classifiers = ["License :: OSI Approved :: MIT License"]
|
|
|
11
11
|
dynamic = ["description"]
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
13
|
dependencies = [
|
|
14
|
-
'numpy<2; python_version < "3.11"', 'numpy; python_version >= "3.11"', 'scipy', 'h5py', 'opencv-python-headless', 'av>=
|
|
14
|
+
'numpy<2; python_version < "3.11"', 'numpy; python_version >= "3.11"', 'scipy', 'h5py', 'opencv-python-headless', 'av>=17.0,<18', 'bleak',
|
|
15
15
|
'pandas', 'pyzmq', 'gevent', 'future', 'pillow', 'msgpack-python',
|
|
16
16
|
'pyyaml', 'ipython', 'defopt', 'msgpack-numpy', 'rich', 'psutil', 'tables',
|
|
17
17
|
'pydaqmx', 'pyqtgraph', 'qtpy', 'PySide6-Essentials', 'zarr>=2,<3; python_version < "3.11"', 'zarr>=3,<4; python_version >= "3.11"', 'zerorpc-numpy'
|
|
18
18
|
]
|
|
19
19
|
readme= "README.md"
|
|
20
|
-
version="1.
|
|
20
|
+
version="1.3"
|
|
21
21
|
|
|
22
22
|
[project.scripts]
|
|
23
23
|
etho = "etho.cli:main"
|
|
@@ -10,9 +10,10 @@ import time
|
|
|
10
10
|
import psutil
|
|
11
11
|
import threading
|
|
12
12
|
import queue
|
|
13
|
+
from codecs import getincrementaldecoder
|
|
13
14
|
|
|
14
15
|
from qtpy import QtWidgets
|
|
15
|
-
from qtpy.QtGui import QIcon, QPalette
|
|
16
|
+
from qtpy.QtGui import QIcon, QPalette, QTextCursor
|
|
16
17
|
from qtpy.QtWidgets import (
|
|
17
18
|
QApplication,
|
|
18
19
|
QTableView,
|
|
@@ -28,9 +29,10 @@ from qtpy.QtWidgets import (
|
|
|
28
29
|
QLabel,
|
|
29
30
|
QSplitter,
|
|
30
31
|
QProgressBar,
|
|
32
|
+
QPlainTextEdit,
|
|
31
33
|
)
|
|
32
34
|
|
|
33
|
-
from qtpy.QtCore import QAbstractTableModel, Qt, QTimer
|
|
35
|
+
from qtpy.QtCore import QAbstractTableModel, QProcess, Qt, QTimer
|
|
34
36
|
|
|
35
37
|
from pyqtgraph.parametertree import Parameter, ParameterTree
|
|
36
38
|
|
|
@@ -221,6 +223,54 @@ def kill_child_processes():
|
|
|
221
223
|
# os.kill(child.pid, signal.SIGKILL)
|
|
222
224
|
|
|
223
225
|
|
|
226
|
+
class HardwareDialog(QDialog):
|
|
227
|
+
def __init__(self, parent):
|
|
228
|
+
super().__init__(parent)
|
|
229
|
+
self.setWindowTitle("Hardware")
|
|
230
|
+
self.resize(640, 400)
|
|
231
|
+
|
|
232
|
+
self.status = QLabel("Scanning local hardware…")
|
|
233
|
+
self.results = QPlainTextEdit()
|
|
234
|
+
self.results.setReadOnly(True)
|
|
235
|
+
buttons = QDialogButtonBox(QDialogButtonBox.Close)
|
|
236
|
+
buttons.rejected.connect(self.reject)
|
|
237
|
+
|
|
238
|
+
layout = QVBoxLayout(self)
|
|
239
|
+
layout.addWidget(self.status)
|
|
240
|
+
layout.addWidget(self.results)
|
|
241
|
+
layout.addWidget(buttons)
|
|
242
|
+
|
|
243
|
+
self._decoder = getincrementaldecoder("utf-8")(errors="replace")
|
|
244
|
+
self._scan = QProcess(self)
|
|
245
|
+
self._scan.setProcessChannelMode(QProcess.MergedChannels)
|
|
246
|
+
self._scan.readyReadStandardOutput.connect(self._read_scan_output)
|
|
247
|
+
self._scan.finished.connect(self._scan_finished)
|
|
248
|
+
self._scan.errorOccurred.connect(self._scan_error)
|
|
249
|
+
self._scan.start(sys.executable, ["-X", "utf8", "-u", "-m", "etho.cli", "hardware"])
|
|
250
|
+
|
|
251
|
+
def _read_scan_output(self, *, final=False):
|
|
252
|
+
output = self._decoder.decode(bytes(self._scan.readAllStandardOutput()), final=final)
|
|
253
|
+
cursor = QTextCursor(self.results.document())
|
|
254
|
+
cursor.movePosition(QTextCursor.End)
|
|
255
|
+
cursor.insertText(output)
|
|
256
|
+
|
|
257
|
+
def _scan_finished(self, exit_code, exit_status):
|
|
258
|
+
self._read_scan_output(final=True)
|
|
259
|
+
complete = exit_status == QProcess.NormalExit and exit_code == 0
|
|
260
|
+
self.status.setText("Scan complete." if complete else "Hardware scan failed.")
|
|
261
|
+
|
|
262
|
+
def _scan_error(self, error):
|
|
263
|
+
if error == QProcess.FailedToStart:
|
|
264
|
+
self.status.setText("Could not start the hardware scan.")
|
|
265
|
+
self.results.appendPlainText(self._scan.errorString())
|
|
266
|
+
|
|
267
|
+
def done(self, result):
|
|
268
|
+
if self._scan.state() != QProcess.NotRunning:
|
|
269
|
+
self._scan.kill()
|
|
270
|
+
self._scan.waitForFinished(250)
|
|
271
|
+
super().done(result)
|
|
272
|
+
|
|
273
|
+
|
|
224
274
|
class RunDialog(QDialog):
|
|
225
275
|
def __init__(self, stop_event, done_event, queue_total):
|
|
226
276
|
super().__init__()
|
|
@@ -343,6 +393,9 @@ class MainWindow(QMainWindow):
|
|
|
343
393
|
# Layout
|
|
344
394
|
self.layout = QGridLayout()
|
|
345
395
|
self.layout.addLayout(buttons, 0, 0)
|
|
396
|
+
self.button["Hardware"] = QPushButton("Enumerate hardware")
|
|
397
|
+
self.button["Hardware"].clicked.connect(self.show_hardware)
|
|
398
|
+
self.layout.addWidget(self.button["Hardware"], 1, 0, Qt.AlignBottom)
|
|
346
399
|
self.refresh_lists(init=True)
|
|
347
400
|
|
|
348
401
|
self.layout.setColumnMinimumWidth(1, 200)
|
|
@@ -358,6 +411,11 @@ class MainWindow(QMainWindow):
|
|
|
358
411
|
def on_protocol_changed(self, param, changes):
|
|
359
412
|
self.current_protocol = to_yaml(param)
|
|
360
413
|
|
|
414
|
+
def show_hardware(self):
|
|
415
|
+
dialog = HardwareDialog(self)
|
|
416
|
+
dialog.setAttribute(Qt.WA_DeleteOnClose)
|
|
417
|
+
dialog.open()
|
|
418
|
+
|
|
361
419
|
def refresh_lists(self, init: bool = False):
|
|
362
420
|
playlist_files = sorted(self.playlist_folder.glob("*.txt"))
|
|
363
421
|
if len(playlist_files) == 0:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import defopt
|
|
2
2
|
import logging
|
|
3
|
+
import math
|
|
3
4
|
import platform
|
|
4
5
|
import importlib
|
|
5
6
|
import yaml
|
|
@@ -67,23 +68,35 @@ def res_gui(protocol_folder: Optional[str] = None, playlist_folder: Optional[str
|
|
|
67
68
|
return res_app.main(protocol_folder=protocol_folder, playlist_folder=playlist_folder)
|
|
68
69
|
|
|
69
70
|
|
|
70
|
-
def
|
|
71
|
-
"""Lists
|
|
72
|
-
import asyncio
|
|
71
|
+
def hardware(*, ble_duration: float = 10.0):
|
|
72
|
+
"""Lists hardware detected by local etho services.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Args:
|
|
75
|
+
ble_duration: Time in seconds to listen for Bluetooth advertisements.
|
|
76
|
+
"""
|
|
77
|
+
from .services.hardware import discover_hardware
|
|
78
|
+
|
|
79
|
+
if not math.isfinite(ble_duration) or ble_duration <= 0:
|
|
80
|
+
raise SystemExit("--ble-duration must be a finite number greater than zero.")
|
|
81
|
+
|
|
82
|
+
print(f"Scanning local hardware (Bluetooth scan: {ble_duration:g} seconds)...", flush=True)
|
|
83
|
+
for result in discover_hardware(ble_duration=ble_duration):
|
|
84
|
+
label = f"{result.service} / {result.probe}" if result.probe else result.service
|
|
85
|
+
if result.error is not None:
|
|
86
|
+
message = str(result.error).strip() or type(result.error).__name__
|
|
87
|
+
print(f"{label}: unavailable ({message})", flush=True)
|
|
88
|
+
elif not result.devices:
|
|
89
|
+
print(f"{label}: no devices found", flush=True)
|
|
90
|
+
else:
|
|
91
|
+
print(label)
|
|
92
|
+
for device in result.devices:
|
|
93
|
+
fields = [f"{key}={value}" for key, value in device.protocol.items()]
|
|
94
|
+
if device.details:
|
|
95
|
+
fields.append(device.details)
|
|
96
|
+
suffix = f" ({', '.join(fields)})" if fields else ""
|
|
97
|
+
print(f" {device.name}{suffix}", flush=True)
|
|
75
98
|
|
|
76
|
-
print(f"Scanning for Govee sensors for {duration:g} seconds...", flush=True)
|
|
77
|
-
sensors = asyncio.run(discover_h5075_sensors(duration))
|
|
78
|
-
if not sensors:
|
|
79
|
-
print("No Govee H5075 sensors found.")
|
|
80
|
-
return
|
|
81
99
|
|
|
82
|
-
print(f"{'Address (use as GOV.address)':<38} {'Name':<16} {'Temperature':>11} {'Humidity':>9}")
|
|
83
|
-
for address, name, measurement in sensors:
|
|
84
|
-
print(f"{address:<38} {(name or '-'):<16} {measurement.temperature_c:>10.1f}°C {measurement.humidity:>8.1f}%")
|
|
85
|
-
|
|
86
|
-
|
|
87
100
|
def version(*, debug: bool = False):
|
|
88
101
|
"""Displays system, version, and hardware info.
|
|
89
102
|
|
|
@@ -238,11 +251,11 @@ def init():
|
|
|
238
251
|
|
|
239
252
|
|
|
240
253
|
def main():
|
|
241
|
-
"""Command line interface for
|
|
254
|
+
"""Command line interface for etho."""
|
|
242
255
|
subcommands = {
|
|
243
256
|
"version": version,
|
|
244
257
|
"init": init,
|
|
245
|
-
"
|
|
258
|
+
"hardware": hardware,
|
|
246
259
|
}
|
|
247
260
|
|
|
248
261
|
if client is not None:
|
|
@@ -266,3 +279,7 @@ def main():
|
|
|
266
279
|
|
|
267
280
|
logging.basicConfig(level=logging.INFO, force=True)
|
|
268
281
|
defopt.run(subcommands, show_defaults=False)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
if __name__ == "__main__":
|
|
285
|
+
main()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from ctypes import create_string_buffer
|
|
2
|
+
|
|
1
3
|
from .ZeroService import BaseZeroService
|
|
2
4
|
import time
|
|
3
5
|
import threading
|
|
@@ -8,7 +10,8 @@ from .. import config as global_config
|
|
|
8
10
|
from ..utils.config import undefaultify
|
|
9
11
|
from ..utils.sound import parse_table, load_sounds, build_playlist
|
|
10
12
|
from .utils.log_exceptions import for_all_methods, log_exceptions
|
|
11
|
-
from .callbacks import callbacks
|
|
13
|
+
from .callbacks import callbacks
|
|
14
|
+
from .hardware import HardwareDevice, HardwareProbe
|
|
12
15
|
import logging
|
|
13
16
|
import numpy as np
|
|
14
17
|
|
|
@@ -21,6 +24,27 @@ except (ImportError, NameError, NotImplementedError) as daqmx_import_error:
|
|
|
21
24
|
pass
|
|
22
25
|
|
|
23
26
|
|
|
27
|
+
def _daqmx_text(getter, *args):
|
|
28
|
+
size = getter(*args, None, 0)
|
|
29
|
+
if size < 0:
|
|
30
|
+
raise RuntimeError(f"NI-DAQmx device query failed with status {size}.")
|
|
31
|
+
if size == 0:
|
|
32
|
+
return ""
|
|
33
|
+
|
|
34
|
+
buffer = create_string_buffer(size)
|
|
35
|
+
getter(*args, buffer, size)
|
|
36
|
+
return buffer.value.decode("utf-8", errors="replace")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _discover_nidaq():
|
|
40
|
+
from PyDAQmx.DAQmxFunctions import DAQmxGetDevProductType, DAQmxGetSysDevNames
|
|
41
|
+
|
|
42
|
+
devices = [name.strip() for name in _daqmx_text(DAQmxGetSysDevNames).split(",")]
|
|
43
|
+
for device in filter(None, devices):
|
|
44
|
+
model = _daqmx_text(DAQmxGetDevProductType, device.encode())
|
|
45
|
+
yield HardwareDevice(model or "NI-DAQ device", {"device": device})
|
|
46
|
+
|
|
47
|
+
|
|
24
48
|
@for_all_methods(log_exceptions(logging.getLogger(__name__)))
|
|
25
49
|
@register_service
|
|
26
50
|
class DAQ(BaseZeroService):
|
|
@@ -31,6 +55,10 @@ class DAQ(BaseZeroService):
|
|
|
31
55
|
SERVICE_NAME = "DAQ" # short, uppercase, 3-letter ID of the service (equals class name)
|
|
32
56
|
CLIENT_START_GROUP = "daq"
|
|
33
57
|
|
|
58
|
+
@classmethod
|
|
59
|
+
def hardware_probes(cls, *, ble_duration: float) -> dict[str, HardwareProbe]:
|
|
60
|
+
return {"NI-DAQmx": _discover_nidaq}
|
|
61
|
+
|
|
34
62
|
@classmethod
|
|
35
63
|
def setup_client(cls, service_key, service_index, prot, defaults, playlistfile, save_prefix, preview, new_console):
|
|
36
64
|
if preview:
|
|
@@ -45,11 +73,10 @@ class DAQ(BaseZeroService):
|
|
|
45
73
|
if prot[service_key].get("port") is None:
|
|
46
74
|
prot[service_key]["port"] = cls.SERVICE_PORT + service_index
|
|
47
75
|
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
attenuation = global_config.get("ATTENUATION")
|
|
77
|
+
if attenuation and this["host"] in attenuation:
|
|
78
|
+
attenuation = attenuation[this["host"]]
|
|
50
79
|
logging.info(f"Using attenuation data specific to {this['host']}.")
|
|
51
|
-
else:
|
|
52
|
-
attenuation = global_config["ATTENUATION"]
|
|
53
80
|
|
|
54
81
|
fs = prot[service_key]["samplingrate"]
|
|
55
82
|
playlist = parse_table(playlistfile)
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
from .ZeroService import BaseZeroService # import super class
|
|
3
3
|
import time # for timer
|
|
4
4
|
import threading
|
|
5
|
-
from . import register_service
|
|
5
|
+
from . import register_service
|
|
6
|
+
from .hardware import HardwareDevice, HardwareProbe
|
|
6
7
|
from .utils.log_exceptions import for_all_methods, log_exceptions
|
|
7
8
|
from .dlp import dlp_runners
|
|
8
9
|
from ..utils.config import undefaultify
|
|
@@ -22,6 +23,13 @@ except ImportError as dlp_import_error:
|
|
|
22
23
|
pass
|
|
23
24
|
|
|
24
25
|
|
|
26
|
+
def _discover_projectors():
|
|
27
|
+
from usb.core import find
|
|
28
|
+
|
|
29
|
+
for device in find(find_all=True, idVendor=0x0451, idProduct=0x6401):
|
|
30
|
+
yield HardwareDevice("TI LightCrafter 4500", details=f"USB bus {device.bus}, address {device.address}")
|
|
31
|
+
|
|
32
|
+
|
|
25
33
|
# decorate all methods in the class so that exceptions are properly logged
|
|
26
34
|
@for_all_methods(log_exceptions(logging.getLogger(__name__)))
|
|
27
35
|
@register_service
|
|
@@ -32,6 +40,10 @@ class DLP(BaseZeroService):
|
|
|
32
40
|
SERVICE_NAME = "DLP" # short, uppercase, 3-letter ID of the service (must equal class name)
|
|
33
41
|
CLIENT_START_GROUP = "pre"
|
|
34
42
|
|
|
43
|
+
@classmethod
|
|
44
|
+
def hardware_probes(cls, *, ble_duration: float) -> dict[str, HardwareProbe]:
|
|
45
|
+
return {"LightCrafter 4500": _discover_projectors}
|
|
46
|
+
|
|
35
47
|
@classmethod
|
|
36
48
|
def setup_client(cls, service_key, service_index, prot, defaults, playlistfile, save_prefix, preview, new_console):
|
|
37
49
|
this = defaults.copy()
|