Skip to content

Commit 4320154

Browse files
authored
406 add back emergency stop button (#425)
* Use keyboard emergency stop * Use a keyboard shortcut that will work anywhere * Run type checker * Update documentation * Update links * Added mdformat again * Removed because it does too much * Fixed link * Install Python in Ci * Run type check in non-installed env
1 parent e737215 commit 4320154

File tree

12 files changed

+65
-31
lines changed

12 files changed

+65
-31
lines changed

.github/workflows/autoformat-and-lint.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ jobs:
2222
ref: ${{ github.head_ref }}
2323
token: ${{ secrets.WORKFLOW_COMMIT }}
2424

25+
- name: 🐍 Setup Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.13"
29+
cache: "pip"
30+
2531
- name: 📦 Install Hatch
2632
uses: pypa/hatch@install
2733

@@ -37,6 +43,6 @@ jobs:
3743

3844
- name: 🧶 Lint
3945
run: hatch fmt --check
40-
41-
# - name: 🔍 Type Check
42-
# run: hatch -e types run check
46+
47+
- name: 🔍 Type Check
48+
run: hatch run check

docs/development/socketio_api.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Socket.IO API
22

3-
This section documents the Socket.IO API. The document is intended for developers building client applications
4-
communicating with the server. If you are looking for information on how to set up and run the server, see the
5-
[installation guide](../home/installation.md)!
3+
This section documents the [Socket.IO](https://socket.io/) API. The document is intended for developers building client
4+
applications communicating with the server. If you are looking for information on how to set up and run the server, see
5+
the [installation guide](../home/installation.md)!
66

77
## Data Types
88

99
All messages on Socket.IO are passed as strings. Complex data structures are JSON encoded, converted to strings, and
10-
then
11-
sent. These structures have their JSON schemas documented
10+
then sent. These structures have their JSON schemas documented
1211
on [VBL Aquarium](https://github.com/VirtualBrainLab/vbl-aquarium/tree/main/models/schemas/ephys_link).
1312

1413
This documentation will reference the Pydantic versions of these models as they are extensively documented. For most
@@ -19,7 +18,7 @@ object to a string that can be sent over Socket.IO.
1918
## Events
2019

2120
Client applications should send messages to these events to interact with the server. The server will respond using
22-
Socket.IO acknowledgments.
21+
[Socket.IO acknowledgments](https://socket.io/docs/v4/#acknowledgements).
2322

2423
### Get Ephys Link Version
2524

docs/home/installation.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
cable and powered. A USB-to-ethernet adapter is acceptable. For New Scale manipulators,
88
the controller unit must be connected via USB and be powered by a 6V power
99
supply.
10-
3. To use the emergency stop feature, ensure an Arduino with
11-
the [StopSignal](https://github.com/VirtualBrainLab/StopSignal) sketch is
12-
connected to the computer. Follow the instructions on that repo for how to
13-
set up the Arduino.
10+
3. To use the emergency stop feature, ensure a keyboard is attached.
1411

1512
## Pinpoint (Recommended Method)
1613

1714
Pinpoint comes bundled with the correct version of Ephys Link. If you are using Pinpoint on the same computer your
1815
manipulators are connected to, you can launch the server from within Pinpoint. See the documentation
19-
on [connecting from Pinpoint](../usage/connecting_to_pinpoint.md).
16+
on [connecting from Pinpoint](../usage/using_ephys_link.md#connecting-to-pinpoint).
2017

2118
## Install as a Standalone Executable
2219

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ to communicate with manipulators used in electrophysiology experiments.
3232

3333
Learn how to use Ephys Link to control your manipulators.
3434

35-
[:octicons-arrow-right-24: Usage](usage/index.md)
35+
[:octicons-arrow-right-24: Usage](usage/starting_ephys_link.md)
3636

3737
- __:fontawesome-regular-square-plus: Add a Manipulator Platform__
3838

docs/usage/connecting_to_pinpoint.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/usage/starting_ephys_link.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Ephys Link is a server that runs in the background.
55
!!! info
66

77
Most people should use Ephys Link through Pinpoint. See documentation
8-
on [connecting from Pinpoint](connecting_to_pinpoint.md) and using Ephys Link
9-
for [experiment automation](experiment_automation.md).
8+
on [connecting from Pinpoint](using_ephys_link.md#connecting-to-pinpoint) and using Ephys Link
9+
for [experiment automation](using_ephys_link.md#experiment-automation).
1010

1111
If you are building a client application that will talk to Ephys Link, see
1212
the [Socket.IO API reference](../development/socketio_api.md).

docs/usage/using_ephys_link.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Using Ephys Link
2+
3+
Ephys Link is designed to interact with other software. Any [Socket.IO](https://socket.io/) client application can talk
4+
to Ephys Link and access connected manipulators. [Pinpoint](https://github.com/VirtualBrainLab/Pinpoint) is a first-party application that does just that!
5+
6+
!!! info "Stop All Movement"
7+
8+
As you start using Ephys Link with other software you may want to stop all manipulators in case of an emergency.
9+
<br/><br/>
10+
Press the keyboard shortcut <kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>alt</kbd> + <kbd>q</kbd> to "quit" all
11+
movement.
12+
13+
## Connecting to Pinpoint
14+
15+
[Pinpoint](https://github.com/VirtualBrainLab/Pinpoint) is a tool for planning electrophysiology recordings and other
16+
_in vivo_ insertions, as well as tracking the position of probes in real-time inside the brain.
17+
18+
Ephys Link was developed alongside Pinpoint to facilitate tracking and positioning of manipulators. Follow the
19+
[instructions on Pinpoint's documentation](https://virtualbrainlab.org//pinpoint/tutorials/tutorial_ephys_link.html) to
20+
use Ephys Link inside Pinpoint!
21+
22+
## Experiment Automation
23+
24+
Pinpoint and Ephys Link can work together to automate manual procedures in electrophysiology experiments. Follow the
25+
[instructions on Pinpoint's documentation](https://virtualbrainlab.org//pinpoint/tutorials/tutorial_ephys_copilot.html)
26+
to use automation in your next experiment!
27+
28+
!!! note
29+
30+
Automation is still in early development. We recommend [contacting](https://virtualbrainlab.org/about/overview.html)
31+
Dan Birman and Kenneth Yang if you would like to try it out!

mkdocs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ nav:
102102
- home/citing.md
103103
- Usage:
104104
- usage/starting_ephys_link.md
105-
- usage/connecting_to_pinpoint.md
106-
- usage/experiment_automation.md
105+
- usage/using_ephys_link.md
107106
- Development:
108107
- development/index.md
109108
- development/socketio_api.md

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ classifiers = [
3131
dependencies = [
3232
"aiohttp==3.11.11",
3333
"colorama==0.4.6",
34+
"keyboard==0.13.5",
3435
"packaging==24.2",
3536
"platformdirs==4.3.6",
3637
"pyserial==3.5",
@@ -61,7 +62,7 @@ exclude = ["/.github", "/.idea"]
6162
python = "3.13.1"
6263
dependencies = [
6364
"pyinstaller==6.11.1",
64-
"basedpyright==1.23.1"
65+
"basedpyright==1.23.1",
6566
]
6667
[tool.hatch.envs.default.scripts]
6768
exe = "pyinstaller.exe ephys_link.spec -y -- -d && pyinstaller.exe ephys_link.spec -y"

src/ephys_link/__main__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
```
99
"""
1010

11+
from asyncio import run
1112
from sys import argv
1213

14+
from keyboard import add_hotkey
15+
1316
from ephys_link.back_end.platform_handler import PlatformHandler
1417
from ephys_link.back_end.server import Server
1518
from ephys_link.front_end.cli import CLI
@@ -37,7 +40,8 @@ def main() -> None:
3740
# 4. Instantiate the Platform Handler with the appropriate platform bindings.
3841
platform_handler = PlatformHandler(options, console)
3942

40-
# 5. Instantiate the Emergency Stop service.
43+
# 5. Add hotkeys for emergency stop.
44+
_ = add_hotkey("ctrl+alt+shift+q", lambda: run(platform_handler.emergency_stop()))
4145

4246
# 6. Start the server.
4347
Server(options, platform_handler, console).launch()

0 commit comments

Comments
 (0)