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

Log verbosity (see mne.verbose() and Logging documentation for more).

Methods

__hash__() <==> hash(x)
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__() <==> hash(x)
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 : array-like of int | None

If None all channels are kept otherwise the channels indices in picks are kept.

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

Also stop the measurement.

unregister_receive_callback(callback)[source]

Unregister a raw buffer receive callback.

Parameters:

callback : callable

The callback to unregister.