Episode 4: g.HIamp

Stream a g.HIamp, the wired high-channel-count EEG amplifier, into a filtered scope at a rate the device lists.

The g.HIamp reaches g.Pype through the GDS service, like the g.Nautilus. What differs is its rates, and how many channels it can bring.

Before you start
  • Install the devices extra: pip install "gpype[devices]". It brings gtec_gds, which reaches the amplifier through the g.tec Device Service, GDS. The service has to be installed and running.

  • Connect the amplifier over USB and switch it on. Only one program can hold it at a time.

The amplifier

The device opens when the node is created, and reads its configuration back there and then. sampling_rate must be a rate the connected g.HIamp lists as supported; anything else is refused when the device opens. channel_count takes the first so many channels; a g.HIamp can bring far more than eight.

10    # Opens the device here, through the GDS service. The rate must be
11    # one the connected g.HIamp lists; anything else is refused
12    source = gp.GHIamp(sampling_rate=1200, channel_count=8)
The rest of the chain

The same filters and scope as the other amplifiers. At 1200 Hz the filters run on more samples, and the scope shows the same ten seconds.

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()
Result

Run the script. The channels arrive unlabelled, as with the g.Nautilus; a ChannelLabeler after the source names them. With nothing on the inputs the traces sit far outside the EEG range; with electrodes on skin and the bandpass in place, scalp EEG fits the plus or minus 50 µV lanes.

Summary

In this episode, you learned how to:

  • stream a GHIamp at one of the rates it lists

  • take a subset of its channels

  • reuse the Season 2 chain unchanged on a wired amplifier

Proceed to Episode 5, where a g.USBamp’s digital trigger is kept apart from the signal.

Nodes in this episode: GHIamp, Bandpass, Bandstop, TimeSeriesScope

File s3e4_ghiamp.py – View file on GitHub

 1"""Season 3, Episode 4: a g.HIamp 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 must be
11    # one the connected g.HIamp lists; anything else is refused
12    source = gp.GHIamp(sampling_rate=1200, 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()