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.
- verbosebool |
str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- info
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_samples
int
Number of samples to fetch.
- picks
str
| array_like |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 ininfo['bads']
will be included if their names or indices are explicitly provided.
- n_samples
- Returns:
- epochinstance of
Epochs
The samples fetched as an Epochs object.
- epochinstance of
See also
- get_measurement_info()[source]#
Return the measurement info.
- Returns:
- self.info
dict
The measurement info.
- self.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:
- callback
callable()
The callback. The raw buffer is passed as the first parameter to callback.
- 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.
- nchan
- 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:
- callback
callable()
The callback to unregister.
- callback
Examples using mne_realtime.FieldTripClient
#
Compute real-time evoked responses with FieldTrip client
Compute real-time power spectrum density with FieldTrip client