libmushu.driver package

Submodules

libmushu.driver.emotiv module

libmushu.driver.fsm module

class libmushu.driver.fsm.FSM(state_transition_table, current_state)[source]

Bases: object

Methods

transition(transition)
transition(transition)[source]
class libmushu.driver.fsm.Input[source]

Bases: object

class libmushu.driver.fsm.State(name)[source]

Bases: object

Finite-State Machine.

class libmushu.driver.fsm.Transition[source]

Bases: object

Methods

transition(input)
transition(input)[source]

libmushu.driver.gtec module

exception libmushu.driver.gtec.AmpError[source]

Bases: exceptions.Exception

class libmushu.driver.gtec.GUSBamp[source]

Bases: libmushu.amplifier.Amplifier

Methods

calculate_impedance(u_measured[, u_applied])
configure(**kwargs) Configure the amplifier.
get_channels()
get_data() Get data.
get_sampling_frequency() Return the sampling frequency.
is_available()
set_calibration_mode(mode)
set_common_ground([a, b, c, d]) Set common ground for the electrodes.
set_common_reference([a, b, c, d]) Set common reference for the electrodes.
set_mode(mode) Set mode, ‘impedance’, ‘data’.
set_sampling_ferquency(fs, channels, ...) Set the sampling frequency and filters for individual channels.
set_slave_mode(slave) Set amp into slave or master mode.
start()
stop()
calculate_impedance(u_measured, u_applied=10000.0)[source]
get_channels()[source]
get_data()[source]

Get data.

static is_available()[source]
set_calibration_mode(mode)[source]
set_common_ground(a=False, b=False, c=False, d=False)[source]

Set common ground for the electrodes.

Parameters:
a, b, c, d – correspond to the groups on the amp, either of them
can be true or false
set_common_reference(a=False, b=False, c=False, d=False)[source]

Set common reference for the electrodes.

Parameters:
a, b, c, d – correspond to the groups on the amp, either of them
can be true or false
set_mode(mode)[source]

Set mode, ‘impedance’, ‘data’.

set_sampling_ferquency(fs, channels, bpfilter, notchfilter)[source]

Set the sampling frequency and filters for individual channels.

Parameters: fs – sampling frequency channels – list of booleans: channels[0] == True: enable filter for channel 0 bpfilter – tuple: parameters for the band pass filter (hp, lp, fs, order) or None notchfilter – tuple: parameters for the band stop filter (hp, lp, fs, order) or None

set_slave_mode(slave)[source]

Set amp into slave or master mode.

Parameters:
slave – if true, set into slave mode, set to master otherwise
start()[source]
stop()[source]
libmushu.driver.gtec.main()[source]

libmushu.driver.labstreaminglayer module

libmushu.driver.randomamp module

class libmushu.driver.randomamp.RandomAmp[source]

Bases: libmushu.amplifier.Amplifier

An amplifier that produces random data.

Methods

configure(fs, channels)
get_channels()
get_data()
get_sampling_frequency()
is_available()
start()
stop() Stop the amplifier.
configure(fs, channels)[source]
get_channels()[source]
get_data()[source]
get_sampling_frequency()[source]
static is_available()[source]
sample_len[source]
start()[source]

libmushu.driver.replayamp module

class libmushu.driver.replayamp.ReplayAmp[source]

Bases: libmushu.amplifier.Amplifier

Methods

configure(data, marker, channels, fs[, ...])
Parameters:
get_channels()
get_data()
Returns:
get_sampling_frequency()
is_available()
start()
stop()
configure(data, marker, channels, fs, realtime=True, blocksize_ms=None, blocksize_samples=None)[source]
Parameters:

data :

marker :

channels :

fs :

realtime :

blocksize_ms : float

blocksize in milliseconds

blocksize_samples : int

blocksize in samples

Raises:

TypeError : :

if blocksize_ms and blocksize_s are given.

get_channels()[source]
get_data()[source]
Returns:

chunk, markers: Markers is time in ms since relative to the :

first sample of that block. :

get_sampling_frequency()[source]
static is_available()[source]
start()[source]
stop()[source]

libmushu.driver.sinusamp module

class libmushu.driver.sinusamp.SinusAmp[source]

Bases: libmushu.amplifier.Amplifier

An amplifier that produces sinus data.

Methods

configure(f, fs, channels)
get_channels()
get_data()
get_sampling_frequency()
is_available()
start() Make the amplifier ready for delivering data.
stop() Stop the amplifier.
configure(f, fs, channels)[source]
elapsed[source]
get_channels()[source]
get_data()[source]
get_sampling_frequency()[source]
static is_available()[source]
sample_len[source]

Module contents

This package contains the low-level drivers for various amplifiers.

As a user, you’ll probably not deal with them directly but with their decorated counterparts via libmushu.__init__.get_amp().

If you want to use the low level drivers directly you can use it like this:

from libmushu.driver.randomamp import RandomAmp
amp = RandomAmp()

TODO: Add a ‘writing your own drivers’ section or tutorial.