This documentation is for development version 0.18.dev0.


class mne.realtime.FieldTripClient(info=None, host='localhost', port=1972, wait_max=30, tmin=None, tmax=inf, buffer_size=1000, verbose=None)[source]

Realtime FieldTrip client.

info : dict | None

The measurement info read in from a file. If None, it is guessed from the Fieldtrip Header object.

host : str

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

port : int

Port to use for the connection.

wait_max : float

Maximum time (in seconds) to wait for Fieldtrip buffer to start

tmin : float | None

Time instant to start receiving buffers. If None, start from the latest samples available.

tmax : float

Time instant to stop receiving buffers.

buffer_size : int

Size of each buffer in terms of number of samples.

verbose : bool, str, int, or None

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


__hash__($self, /) Return hash(self).
get_data_as_epoch([n_samples, picks]) Return last n_samples from current time.
get_measurement_info() Return the measurement info.
iter_raw_buffers() Return an iterator over raw buffers.
register_receive_callback(callback) Register a raw buffer receive callback.
start_receive_thread(nchan) Start the receive thread.
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_data_as_epoch(n_samples=1024, picks=None)[source]

Return last n_samples from current time.

n_samples : int

Number of samples to fetch.

picks : str | list | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values “all” to pick all channels, or “data” to pick data channels. None (default) will pick all channels.

epoch : instance of Epochs

The samples fetched as an Epochs object.


Return the measurement info.

Returns: : dict

The measurement info.


Return an iterator over raw buffers.

raw_buffer : generator

Generator for iteration over raw buffers.


Register a raw buffer receive callback.

callback : callable

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


Start the receive thread.

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

nchan : int

The number of channels in the data.


Stop the receive thread.

stop_measurement : bool

unused, for compatibility.


Unregister a raw buffer receive callback.

callback : callable

The callback to unregister.