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:
hoststr

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

cmd_portint

Port to use for the command connection.

data_portint

Port to use for the data connection.

timeoutfloat

Communication timeout in seconds.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

get_client_id()[source]#

Get the client ID.

Returns:
idint

The client ID.

get_measurement_info()[source]#

Get the measurement information.

Returns:
infodict

The measurement information.

raw_buffers(nchan)[source]#

Return an iterator over raw buffers.

Parameters:
nchanint

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

Returns:
raw_buffergenerator

Generator for iteration over raw buffers.

read_raw_buffer(nchan)[source]#

Read a single buffer with raw data.

Parameters:
nchanint

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

Returns:
raw_bufferfloat array, shape=(nchan, n_times)

The raw data.

register_receive_callback(callback)[source]#

Register a raw buffer receive callback.

Parameters:
callbackcallable()

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

set_client_alias(alias)[source]#

Set client alias.

Parameters:
aliasstr

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:
nchanint

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_measurementbool

Also stop the measurement.

unregister_receive_callback(callback)[source]#

Unregister a raw buffer receive callback.

Parameters:
callbackcallable()

The callback to unregister.