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
infodict | None

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

hoststr

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

portint

Port to use for the connection.

wait_maxfloat

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

tminfloat | None

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

tmaxfloat

Time instant to stop receiving buffers.

buffer_sizeint

Size of each buffer in terms of number of samples.

verbosebool, 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(self[, n_samples, picks])

Return last n_samples from current time.

get_measurement_info(self)

Return the measurement info.

iter_raw_buffers(self)

Return an iterator over raw buffers.

register_receive_callback(self, callback)

Register a raw buffer receive callback.

start(self)

Start the client.

start_receive_thread(self, nchan)

Start the receive thread.

stop(self)

Stop the client.

stop_receive_thread(self[, stop_measurement])

Stop the receive thread.

unregister_receive_callback(self, callback)

Unregister a raw buffer receive callback.

__hash__(self, /)

Return hash(self).

get_data_as_epoch(self, n_samples=1024, picks=None)[source]

Return last n_samples from current time.

Parameters
n_samplesint

Number of samples to fetch.

picksstr | 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
epochinstance of Epochs

The samples fetched as an Epochs object.

get_measurement_info(self)[source]

Return the measurement info.

Returns
self.infodict

The measurement info.

iter_raw_buffers(self)[source]

Return an iterator over raw buffers.

Returns
raw_buffergenerator

Generator for iteration over raw buffers.

register_receive_callback(self, callback)[source]

Register a raw buffer receive callback.

Parameters
callbackcallable()

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

start(self)[source]

Start the client.

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

Stop the client.

stop_receive_thread(self, stop_measurement=False)[source]

Stop the receive thread.

Parameters
stop_measurementbool

Also stop the measurement.

unregister_receive_callback(self, callback)[source]

Unregister a raw buffer receive callback.

Parameters
callbackcallable()

The callback to unregister.