eeg_stream

Module: tools.live.eeg_stream

eeg_stream.py EEG client module.

Created by Timo Duchrow on 2008-08-26.

Inheritance diagram for pySPACE.tools.live.eeg_stream:

Inheritance diagram of pySPACE.tools.live.eeg_stream

Class Summary

EEGClient([host, port]) EEG stream client for EEG stream protocol
EEGServer(absolute_data_path[, block_size, port]) EEG stream server for EEG stream protocol
EEGClientUsb([ipmarker_server]) Acquire raw streamed eeg-data from usb-acquisition submodule

Function Summary

dummylisten1(samples, markers)
dummylisten2(samples, markers)
dummylisten3(samples, markers)

Classes

EEGClient

class pySPACE.tools.live.eeg_stream.EEGClient(host='127.0.0.1', port=51244, **kwargs)[source]

Bases: pySPACE.missions.support.WindowerInterface.AbstractStreamReader

EEG stream client for EEG stream protocol

Class Components Summary

__abstractmethods__
_abc_cache
_abc_negative_cache
_abc_negative_cache_version
_abc_registry
_getdata32msg(payload[, verbose]) Convenience method for getting data from 32-bit type data message (float)
_getdatamsg(payload[, verbose, dtype, msgtype]) Get data from 16-bit type data message (short)
_getmuxdatamsg(payload[, verbose]) Get data from 16/32-bit type data message (short)
_getstartmsg(payload[, verbose]) Decode metadata from start type message
_getstopmsg(payload[, verbose])
_grace(signum, stackframe)
_readmsg([msg_type, verbose]) Reads EEG stream message and invokes appropiate handler.
_sendmsg([msg_type, content]) Sends Messages to EEGServer
channelNames
connect([verbose]) Connect to EEG stream server and collect metadata
dSamplingInterval
markerNames
markerids
read([nblocks, verbose]) Invoke registered callbacks for each incoming data block
regcallback(func) Register callback function
stdblocksize
__init__(host='127.0.0.1', port=51244, **kwargs)[source]
dSamplingInterval
stdblocksize
markerids
channelNames
markerNames
connect(verbose=False)[source]

Connect to EEG stream server and collect metadata

regcallback(func)[source]

Register callback function

read(nblocks=1, verbose=False)[source]

Invoke registered callbacks for each incoming data block

returns number of read _data_ blocks

_sendmsg(msg_type=10, content=None)[source]

Sends Messages to EEGServer

T_ReadyMessage := tell Server to send another EEG{Data, Start, Stop}Message

_readmsg(msg_type='all', verbose=False)[source]

Reads EEG stream message and invokes appropiate handler.

Reads EEG stream header and checks optional type constraint. Returns which message type was read.

_getstopmsg(payload, verbose=False)[source]
_getstartmsg(payload, verbose=False)[source]

Decode metadata from start type message

_getdata32msg(payload, verbose=False)[source]

Convenience method for getting data from 32-bit type data message (float)

_getdatamsg(payload, verbose=False, dtype='short', msgtype='h')[source]

Get data from 16-bit type data message (short)

_getmuxdatamsg(payload, verbose=False)[source]

Get data from 16/32-bit type data message (short)

_grace(signum, stackframe)[source]
__abstractmethods__ = frozenset([])
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 33
_abc_registry = <_weakrefset.WeakSet object>

EEGServer

class pySPACE.tools.live.eeg_stream.EEGServer(absolute_data_path, block_size=4, port=51244)[source]

Bases: object

EEG stream server for EEG stream protocol

Class Components Summary

__del__()
reset() Reset the EEG server so that he points again to the beginning
start() Starts the EEG server
__init__(absolute_data_path, block_size=4, port=51244)[source]
__del__()[source]
start()[source]

Starts the EEG server

reset()[source]

Reset the EEG server so that he points again to the beginning

__weakref__

list of weak references to the object (if defined)

EEGClientUsb

class pySPACE.tools.live.eeg_stream.EEGClientUsb(ipmarker_server=None, **kwargs)[source]

Bases: pySPACE.missions.support.WindowerInterface.AbstractStreamReader

Acquire raw streamed eeg-data from usb-acquisition submodule

This implementation uses the usb1 module, available from Pip/easy_install. usb1 is used to wrap calls to the libusbx c-library.

Class Components Summary

__abstractmethods__
_abc_cache
_abc_negative_cache
_abc_negative_cache_version
_abc_registry
block_length_ms()
channelNames
connect([verbose])
dSamplingInterval
digital_marker(raw_value)
disconnect()
gather_enough_data() gets enough data to generate a block
insert_ip_markers(mark)
mark2index(m)
markerNames
markerids
new_marker_id()
read([nblocks, verbose])
regcallback(func)
separate() separates the raw-data into the data- and marker-channels
stdblocksize
time2index(t)
__init__(ipmarker_server=None, **kwargs)[source]

currently no parameter

dSamplingInterval
stdblocksize
markerids
channelNames
markerNames
regcallback(func)[source]
block_length_ms()[source]
disconnect()[source]
new_marker_id()[source]
connect(verbose=False)[source]
read(nblocks=1, verbose=False)[source]
gather_enough_data()[source]

gets enough data to generate a block of size stdblocksize in channel and markers

separate()[source]

separates the raw-data into the data- and marker-channels

insert_ip_markers(mark)[source]
mark2index(m)[source]
time2index(t)[source]
digital_marker(raw_value)[source]
__abstractmethods__ = frozenset([])
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 33
_abc_registry = <_weakrefset.WeakSet object>

Functions

dummylisten1()

pySPACE.tools.live.eeg_stream.dummylisten1(samples, markers)[source]

dummylisten2()

pySPACE.tools.live.eeg_stream.dummylisten2(samples, markers)[source]

dummylisten3()

pySPACE.tools.live.eeg_stream.dummylisten3(samples, markers)[source]