This documentation is for development version 0.18.dev0.

mne.realtime.RtClient

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

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

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Methods

__hash__($self, /) Return hash(self).
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__($self, /)

Return hash(self).

get_client_id()[source]

Get the client ID.

Returns:
id : int

The client ID.

get_measurement_info()[source]

Get the measurement information.

Returns:
info : dict

The measurement information.

raw_buffers(nchan)[source]

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)[source]

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)[source]

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)[source]

Set client alias.

Parameters:
alias : str

The client alias.

start_measurement()[source]

Start the measurement.

start_receive_thread(nchan)[source]

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()[source]

Stop the measurement.

stop_receive_thread(stop_measurement=False)[source]

Stop the receive thread.

Parameters:
stop_measurement : bool

Also stop the measurement.

unregister_receive_callback(callback)[source]

Unregister a raw buffer receive callback.

Parameters:
callback : callable

The callback to unregister.