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

Notes

This software uses the FieldTrip buffer open source library. See http:/www.fieldtriptoolbox.org for details. The FieldTrip buffer is used under the BSD 3-Clause License.

get_data_as_epoch(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. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

Returns
epochinstance of Epochs

The samples fetched as an Epochs object.

get_measurement_info()[source]

Return the measurement info.

Returns
self.infodict

The measurement info.

iter_raw_buffers()[source]

Return an iterator over raw buffers.

Returns
raw_buffergenerator

Generator for iteration over raw buffers.

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.

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

Stop the receive thread.

Parameters
stop_measurementbool

unused, for compatibility.

unregister_receive_callback(callback)[source]

Unregister a raw buffer receive callback.

Parameters
callbackcallable()

The callback to unregister.

Examples using mne_realtime.FieldTripClient

Compute real-time evoked responses with FieldTrip client

Compute real-time evoked responses with FieldTrip client

Compute real-time evoked responses with FieldTrip client
Compute real-time power spectrum density with FieldTrip client

Compute real-time power spectrum density with FieldTrip client

Compute real-time power spectrum density with FieldTrip client