mne.realtime.RtClient

class mne.realtime.RtClient(host, cmd_port=4217, data_port=4218, timeout=1.0, verbose=None)

Realtime Client

Client to communicate with mne_rt_server

Parameters:

host : str

Hostname (or IP address) of the host where mne_rt_server is running.

cmd_port : int

Port to use for the command connection.

data_port : int

Port to use for the data connection.

timeout : float

Communication timeout in seconds.

verbose : bool, str, int, or None

Log verbosity see mne.verbose.

Methods

__hash__() <==> hash(x)
get_client_id() Get the client ID
get_measurement_info() Get the measurement information
raw_buffers(nchan) Return an iterator over raw buffers
read_raw_buffer(nchan) Read a single buffer with raw data
register_receive_callback(callback) Register a raw buffer receive callback
set_client_alias(alias) Set client alias
start_measurement() Start the measurement
start_receive_thread(nchan) Start the receive thread
stop_measurement() Stop the measurement
stop_receive_thread([stop_measurement]) Stop the receive thread
unregister_receive_callback(callback) Unregister a raw buffer receive callback
__hash__() <==> hash(x)
get_client_id()

Get the client ID

Returns:

id : int

The client ID.

get_measurement_info()

Get the measurement information

Returns:

info : dict

The measurement information.

raw_buffers(nchan)

Return an iterator over raw buffers

Parameters:

nchan : int

The number of channels (info[‘nchan’]).

Returns:

raw_buffer : generator

Generator for iteration over raw buffers.

read_raw_buffer(nchan)

Read a single buffer with raw data

Parameters:

nchan : int

The number of channels (info[‘nchan’]).

Returns:

raw_buffer : float array, shape=(nchan, n_times)

The raw data.

register_receive_callback(callback)

Register a raw buffer receive callback

Parameters:

callback : callable

The callback. The raw buffer is passed as the first parameter to callback.

set_client_alias(alias)

Set client alias

Parameters:

alias : str

The client alias.

start_measurement()

Start the measurement

start_receive_thread(nchan)

Start the receive thread

If the measurement has not been started, it will also be started.

Parameters:

nchan : int

The number of channels in the data.

stop_measurement()

Stop the measurement

stop_receive_thread(stop_measurement=False)

Stop the receive thread

Parameters:

stop_measurement : bool

Also stop the measurement.

unregister_receive_callback(callback)

Unregister a raw buffer receive callback

Parameters:

callback : function

The callback to unregister.