Skip to content

Commit 0242692

Browse files
committed
Clean implicit frustration demo to fit the repo standards
1 parent 6f278a8 commit 0242692

20 files changed

+230
-233
lines changed

implicit/frustration/.gitignore

-1
This file was deleted.

implicit/frustration/LICENSE

-21
This file was deleted.

implicit/frustration/README.md

+36
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
1+
# Implicit frustration
2+
13
Implicit Frustration application based on [Neuroadaptive technology enables implicit cursor
24
control based on medial prefrontal cortex activity](https://www.pnas.org/doi/abs/10.1073/pnas.1605155114).
35

6+
## Setting up
7+
8+
### With fake or recorded data (no device)
9+
10+
The default configuration uses real recorded data. You can also try sinusoidal waves by commenting out the `replay.yaml` graph in `main.yaml` and uncomment `sinus.yaml`.
11+
12+
### Using a Muse device
13+
14+
Uncomment the `muse.yaml` graph in `main.yaml` file, and comment out the other input graphs.
15+
16+
### Using a Unicorn device
17+
18+
Uncomment the `unicorn.yaml` graph in `main.yaml` file, and comment out the other input graphs.
19+
20+
## Running the demo
21+
22+
Launch the app:
23+
24+
```
25+
$ timeflux -d implicit/frustration/main.yaml
26+
```
27+
28+
Open a browser, and visualize:
29+
30+
- [The raw EEG data](http://localhost:8000/monitor/)
31+
- [The application to perform the experiment](http://localhost:8000/frustration/)
32+
33+
34+
![demo-bands-eeg](img/interface.gif)
35+
36+
37+
38+
39+
440
The application is already implemented for two eeg headsets:
541
- the muse 2016 BLED by Muse in LSL
642
- stream the LSL using muse_stream.sh

implicit/frustration/graphs/muse.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
graphs:
2+
- id: muse
3+
nodes:
4+
- id: eeg
5+
module: timeflux.nodes.lsl
6+
class: Receive
7+
params:
8+
prop: type
9+
value: EEG
10+
unit: s
11+
sync: None
12+
- id: pub_eeg
13+
module: timeflux.nodes.zmq
14+
class: Pub
15+
params:
16+
topic: eeg
17+
- id: reindex
18+
module: timeflux.nodes.dejitter
19+
class: Reindex
20+
params:
21+
rate: 256
22+
edges:
23+
- source: eeg
24+
target: reindex
25+
- source: reindex
26+
target: pub_eeg
27+
rate: 5
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
graphs:
2+
3+
- id: replay
4+
nodes:
5+
- id: replay
6+
module: timeflux.nodes.hdf5
7+
class: Replay
8+
params:
9+
filename: data/XXX.hdf5
10+
keys:
11+
- /eeg
12+
speed: 1
13+
- id: select
14+
module: timeflux.nodes.query
15+
class: LocQuery
16+
params:
17+
key: [ Fpz ]
18+
- id: pub
19+
module: timeflux.nodes.zmq
20+
class: Pub
21+
params:
22+
topic: eeg
23+
edges:
24+
- source: replay:eeg
25+
target: select
26+
- source: select
27+
target: pub
28+
rate: 10

implicit/frustration/graphs/save.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
graphs:
2+
- id: Record
3+
nodes:
4+
- id: sub
5+
module: timeflux.nodes.zmq
6+
class: Sub
7+
params:
8+
topics: [events, eeg]
9+
- id: save
10+
module: timeflux.nodes.hdf5
11+
class: Save
12+
params:
13+
path: data
14+
complevel: 0
15+
min_itemsize: 200
16+
- id: debug
17+
module: timeflux.nodes.debug
18+
class: Display
19+
edges:
20+
- source: sub:*
21+
target: save
22+
- source: sub:events
23+
target: debug
24+
rate: 1
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
graphs:
2+
- id: generate
3+
nodes:
4+
- id: sinus
5+
module: timeflux_audio.nodes.signal
6+
class: Additive
7+
params:
8+
frequencies: [1, 5, 10, 18, 30, 50] # center of delta, theta, alpha, beta, gamma bands and line noise
9+
resolution: 500
10+
amplitudes: [1, .5, .25, .12, .06, 0.2] # Amplitudes of bands and line noise
11+
name: Fpz
12+
13+
# Publish
14+
# -------
15+
- id: pub
16+
module: timeflux.nodes.zmq
17+
class: Pub
18+
params:
19+
topic: eeg
20+
21+
edges:
22+
- source: sinus
23+
target: pub
24+
25+
rate: 10
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
graphs:
2+
- id: unicorn
3+
nodes:
4+
- id: eeg
5+
module: timeflux_brainflow.nodes.driver
6+
class: BrainFlow
7+
params:
8+
board: unicorn
9+
- id: pub_eeg
10+
module: timeflux.nodes.zmq
11+
class: Pub
12+
params:
13+
topic: eeg
14+
- id: reindex
15+
module: timeflux.nodes.dejitter
16+
class: Reindex
17+
params:
18+
rate: 250
19+
edges:
20+
- source: eeg
21+
target: reindex
22+
- source: reindex
23+
target: pub_eeg
24+
rate: 5
7.29 MB
Loading

implicit/frustration/main.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import:
2+
# Input graphs
3+
# -------------
4+
# - graphs/unicorn.yaml # uncomment this line to use unicorn device
5+
# - graphs/muse.yaml # uncomment this line to use muse device
6+
# - graphs/replay.yaml # uncomment this line to use replayed data
7+
- graphs/sinus.yaml # uncomment this line to use generated data
8+
# - graphs/save.yaml # uncomment this graph to save the data in HDF5
9+
10+
graphs:
11+
- id: Broker
12+
nodes:
13+
- id: proxy
14+
module: timeflux.nodes.zmq
15+
class: Broker
16+
17+
- id: UI
18+
nodes:
19+
- id: ui
20+
module: timeflux_ui.nodes.ui
21+
class: UI
22+
params:
23+
routes:
24+
frustration: www # app will be available at http://localhost:8000/frustration/
25+
settings:
26+
grid:
27+
grid:
28+
rows: 4
29+
columns: 4
30+
frustration:
31+
durations:
32+
step: 1000
33+
new_grid: 2000
34+
keys:
35+
activate: true
36+
good: b
37+
bad: v
38+
sessions: 30
39+
max_step: 15
40+
- id: sub
41+
module: timeflux.nodes.zmq
42+
class: Sub
43+
params:
44+
topics: [model, eeg]
45+
- id: pub
46+
module: timeflux.nodes.zmq
47+
class: Pub
48+
params:
49+
topic: events
50+
- id: bp_filter
51+
module: timeflux_dsp.nodes.filters
52+
class: IIRFilter
53+
params:
54+
order: 2
55+
frequencies: [0.1, 40]
56+
edges:
57+
- source: ui:events
58+
target: pub
59+
- source: sub:model
60+
target: ui:model
61+
- source: sub:eeg
62+
target: ui:eeg
63+
- source: sub:eeg
64+
target: bp_filter
65+
- source: bp_filter
66+
target: ui:filtered_eeg

implicit/frustration/muse.yaml

-106
This file was deleted.

0 commit comments

Comments
 (0)