This documentation is for development version 0.18.dev0.

mne.realtime.FieldTripClient

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.

Parameters:
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).

Methods

__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.

Parameters:
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.

Returns:
epoch : instance of Epochs

The samples fetched as an Epochs object.

get_measurement_info()[source]

Return the measurement info.

Returns:
self.info : dict

The measurement info.

iter_raw_buffers()[source]

Return an iterator over raw buffers.

Returns:
raw_buffer : generator

Generator for iteration over raw buffers.

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.

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_receive_thread(stop_measurement=False)[source]

Stop the receive thread.

Parameters:
stop_measurement : bool

unused, for compatibility.

unregister_receive_callback(callback)[source]

Unregister a raw buffer receive callback.

Parameters:
callback : callable

The callback to unregister.