Episode 3: g.Nautilus
Stream a g.Nautilus, the wireless EEG headset that talks to a base station on the computer’s USB port, and respect the settings the device is strict about.
The g.Nautilus is reached through the g.tec Device Service, GDS, which also serves the g.HIamp and the g.USBamp of Episodes 4 and 5. The three share the same habits.
Install the
devicesextra:pip install "gpype[devices]". It bringsgtec_gds, which reaches the amplifier through GDS. The service has to be installed and running.Plug in the base station and switch the headset on.
Only one program can hold the device at a time. A second one is refused with “An already existing data acquisition session cannot be opened exclusively”, usually a script that is still running somewhere else.
gp.GNautilus(...) connects to the amplifier and reads back its configuration there and then, so the script pauses on that line for a few seconds before p.start() is reached. Without a serial, the node opens the first g.Nautilus the service lists.
10 # Opens the device here, through the GDS service. The rate is 250 or
11 # 500 Hz, nothing else; the channel count is what the headset has
12 source = gp.GNautilus(sampling_rate=250, channel_count=8)
Asking it what it supports is quicker than guessing. sampling_rate is 250 or 500 Hz; any other value is refused, naming the two. frame_size is either 1, the default, or the size the device recommends for the rate; anything else is refused, naming the allowed values. sensitivity sets the input range, the widest by default; get_supported_sensitivities() lists the steps yours offers.
The same filters and scope as Episode 1.
14 # 1-30 Hz keeps the brain rhythms and drops the drift below and the
15 # muscle activity above; two notches cover either mains standard
16 bandpass = gp.Bandpass(f_lo=1, f_hi=30)
17 notch50 = gp.Bandstop(f_lo=48, f_hi=52)
18 notch60 = gp.Bandstop(f_lo=58, f_hi=62)
19
20 scope = gp.TimeSeriesScope(amplitude_limit=50, time_window=10)
21
22 p.connect(source, bandpass)
23 p.connect(bandpass, notch50)
24 p.connect(notch50, notch60)
25 p.connect(notch60, scope)
26 app.add_widget(scope)
27
28 p.start()
29 app.run()
30 p.stop()
31 p.close()
Run the script. No channel names come from the device: the g.Nautilus reports how many channels it has, not where the electrodes sit, so the data arrives unlabelled. Put a ChannelLabeler right after the source, with the names of the positions you mounted, as Episode 9 of Season 2 taught, and every node and recording downstream uses them.
Know what no contact looks like: with the headset off the head, the channels float far outside the EEG range and swing widely. The bandpass removes the offset but not the swings; waves far larger than any EEG, on every channel, mean the electrodes are not on skin.
The node can add more, each stream switched on by its own parameter: acceleration_data (three channels), battery_level, link_quality, validation_indicator, enable_counter and enable_di, the digital input. car and noise_reduction switch on the device’s own common average reference and noise reduction.
In this episode, you learned how to:
stream a GNautilus through the GDS service
give it a rate, a frame size and a sensitivity it accepts
name its channels yourself, since the device does not
Proceed to Episode 4, where a GHIamp arrives through the same GDS service.
Nodes in this episode: GNautilus, Bandpass, Bandstop, TimeSeriesScope
File s3e3_gnautilus.py – View file on GitHub
1"""Season 3, Episode 3: a g.Nautilus streamed into a filtered scope."""
2
3import gpype as gp
4
5if __name__ == "__main__":
6
7 app = gp.MainApp()
8 p = gp.Pipeline()
9
10 # Opens the device here, through the GDS service. The rate is 250 or
11 # 500 Hz, nothing else; the channel count is what the headset has
12 source = gp.GNautilus(sampling_rate=250, channel_count=8)
13
14 # 1-30 Hz keeps the brain rhythms and drops the drift below and the
15 # muscle activity above; two notches cover either mains standard
16 bandpass = gp.Bandpass(f_lo=1, f_hi=30)
17 notch50 = gp.Bandstop(f_lo=48, f_hi=52)
18 notch60 = gp.Bandstop(f_lo=58, f_hi=62)
19
20 scope = gp.TimeSeriesScope(amplitude_limit=50, time_window=10)
21
22 p.connect(source, bandpass)
23 p.connect(bandpass, notch50)
24 p.connect(notch50, notch60)
25 p.connect(notch60, scope)
26 app.add_widget(scope)
27
28 p.start()
29 app.run()
30 p.stop()
31 p.close()