[FieldTrip] Realtime problems with intensive computations and data loss due to buffer expiration
Jacob Martin
caulveil at gmail.com
Thu Jan 24 23:32:56 CET 2013
Hello,
I have written a Matlab StreamExtractor Class that reads data from the
Fieldtrip buffer and then "notifies" various other Matlab component
classes that new BCI data is available so that the class can analyze
it (e.g. a Signal Viewer component could show the data so far, a
Classifier component could classify the newest data, etc).
The problem I am having is that since Matlab is single threaded, when
the notify method is called, and the notified component does a
computationally intense operation (e.g. building a classifier), then
by the time that the notify() method returns to the StreamExtractor,
many data samples can be lost. It is as if I am limited to very
short operations that will return "in time" to catch all the samples
that are in the buffer.
I have thought to use parallel processing to allow "notify" to return
quickly, but that strategy is made difficult with GUIs because pmode
processes in Matlab do not have access to graphics. More imporantly,
there is some overhead due to launching the parallel processes and
executing many notify commands, which may ultimately cause the
StreamExtractor class to again miss data if too many classes are
listening and being notified by the StreamExtractor.
I could "live downsample" the data (currently using 2048hz), but I
would prefer to keep 2048hz and just increase the buffer size if
possible so that all events will be recorded, regardless of how much
time each component takes to return. Is there a way to increase the
default buffer size in Fieldtrip so that I will not lose data due to
computationally intense operations being executed intermittently
during the stream?
Does anyone have any other ideas? I'm almost at a loss here...
Best wishes,
Jacob
More information about the fieldtrip
mailing list