Spaces:
Sleeping
Sleeping
Commit
·
0710306
1
Parent(s):
7f64467
readme
Browse files- README.md +116 -0
- figures/gui.png +0 -0
README.md
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Portiloop software
|
2 |
+
|
3 |
+
This software works with the [Coral implementation](https://github.com/Portiloop/portiloop-hardware) of the `Portiloop` EEG closed-loop stimulation device.
|
4 |
+
|
5 |
+
It enables controlling the `Portiloop` from a simple Graphical User Interface (GUI).
|
6 |
+
|
7 |
+
## Quick links
|
8 |
+
- [Installation on the Portiloop](#installation)
|
9 |
+
- [GUI usage](#usage)
|
10 |
+
|
11 |
+
## Usage:
|
12 |
+
|
13 |
+
The `Portiloop` GUI is a web-based interface running as a `jupyter` server.
|
14 |
+
|
15 |
+
- Connect to the `Portiloop` WiFi network.
|
16 |
+
- Open your favorite web browser
|
17 |
+
- Enter the following address: `192.168.0.1:9000`
|
18 |
+
|
19 |
+
You should now be connected to the `jupyter` server.
|
20 |
+
|
21 |
+
_If the jupyter notebook is not yet created:_
|
22 |
+
- Hit `New` and select `Python 3`.
|
23 |
+
|
24 |
+
This creates a `jupyter` notebook, in which you can simply paste and execute te following:
|
25 |
+
|
26 |
+
```python
|
27 |
+
from portiloop.capture import Capture
|
28 |
+
|
29 |
+
cap = Capture()
|
30 |
+
```
|
31 |
+
|
32 |
+
_When the jupyter notebook is created:_
|
33 |
+
|
34 |
+
You can open the notebook and simply execute the cell.
|
35 |
+
|
36 |
+
The GUI now looks like this:
|
37 |
+
|
38 |
+

|
39 |
+
|
40 |
+
The `Channels` pannel enables you to configure each electrode:
|
41 |
+
- `disabled`: the electrode is not used
|
42 |
+
- `simple`: the electrode is simply used to measure signal (not recommended)
|
43 |
+
- `bias in`: the electrode is used to measure signal and to compute a bias ("ground") signal
|
44 |
+
- `bias out`: the electrode is used to output the bias ("ground") signal
|
45 |
+
|
46 |
+
Use the `Freq` widget to enter your desired sampling rate.
|
47 |
+
|
48 |
+
Use the `Time` widget to enter a maximum duration for the experiment (you can also stop the experiment manually).
|
49 |
+
|
50 |
+
Use the `Recording` widget to enter the name of a `.edf` output file if you wish to record the signal
|
51 |
+
|
52 |
+
If you tick the `Record` checkbox, the signal will be recorded in this file.
|
53 |
+
|
54 |
+
If you tick the `Display` checkbox, the signal will be displayed for the duration of the whole experiment.
|
55 |
+
|
56 |
+
The `Clock` widget lets you select the sampling method:
|
57 |
+
- `Coral` sets the `ADS1299` sampling rate to twice your target, and uses the Coral RT clock to sample at your target.
|
58 |
+
- `ADS` sets the `ADS1299` sampling rate to the closest compatible to your target and uses the ADS interrupts to sample.
|
59 |
+
|
60 |
+
Finally, the `Capture` widget lets you start and stop the experiment at any point in time.
|
61 |
+
Note that one the experiment is started, all widgets are deactivated until you stop the experiment.
|
62 |
+
|
63 |
+
## Installation:
|
64 |
+
|
65 |
+
Follow these instruction if the software is not readily installed on your `Portiloop` device.
|
66 |
+
|
67 |
+
### Install the library:
|
68 |
+
|
69 |
+
_(Requires python 3)_
|
70 |
+
|
71 |
+
- Clone this repository on the `Coral` board
|
72 |
+
- `cd` to he root of the repository where the `setup.py` file is located
|
73 |
+
- Execute `pip3 install -e .`
|
74 |
+
|
75 |
+
### Setup the Coral board as a wifi access point
|
76 |
+
|
77 |
+
You can find instructions [here](https://www.linux.com/training-tutorials/create-secure-linux-based-wireless-access-point/) to set Linux as a WiFi access point.
|
78 |
+
|
79 |
+
### Setup a jupyter server:
|
80 |
+
|
81 |
+
- On your `Portiloop` device, execute `pip3 install notebook`
|
82 |
+
- Generate a `jupyter` password and copy the result:
|
83 |
+
```python
|
84 |
+
from notebook.auth import passwd
|
85 |
+
passwd()
|
86 |
+
```
|
87 |
+
- Execute `jupyter notebook --generate-config`
|
88 |
+
- `cd` to the `.jupyter` folder and edit `jupyter_notebook_config.py`
|
89 |
+
- Find the relevant lines, and uncomment them while setting the following values:
|
90 |
+
- `c.NotebookApp.ip = '*'`
|
91 |
+
- `c.NotebookApp.open_browser = False`
|
92 |
+
- `c.NotebookApp.password = u'your_generated_password_here'`
|
93 |
+
- `c.NotebookApp.port = 9000`
|
94 |
+
|
95 |
+
### Setup a service for your jupyter server to start automatically:
|
96 |
+
|
97 |
+
- `cd /etc/systemd/system`
|
98 |
+
- create an empty file named `notebook.service` and open it.
|
99 |
+
- paste the following and save:
|
100 |
+
```bash
|
101 |
+
[Unit]
|
102 |
+
Description=Autostarts jupyter server
|
103 |
+
|
104 |
+
[Service]
|
105 |
+
User=mendel
|
106 |
+
WorkingDirectory=~
|
107 |
+
ExecStart=jupyter notebook
|
108 |
+
Restart=always
|
109 |
+
|
110 |
+
[Install]
|
111 |
+
WantedBy=multi-user.target
|
112 |
+
```
|
113 |
+
- Execute `sudo systemctl daemon-reload`
|
114 |
+
- Execute `sudo systemctl start notebook.service`
|
115 |
+
- Check that your service is up and running: `sudo systemctl status notebook.service`
|
116 |
+
|
figures/gui.png
ADDED
![]() |