BrainStreamExampleSpellerPart3
Example 2: Visual speller
Part 3
<- Go back to Part 2 - Continue with Part 4 ->
In the previous parts of this visual speller example, all actions were executed by the BrainStream Matlab session. In this section, we will describe how to enable parallel processing. All actions related to stimulus presentation will be handled by a client.
Below, the new flowcharts of the experiment are shown. Actions indicated in orange are executed at the BrainStream Matlab session, whereas actions indicated in blue are executed at the client.
Figure 1: Main flowchart. In the stimulus presentation import-table, actions are defined for the BrainStream Matlab session as well as the client (see Figure 2).
At the start of the experiment, the speller is intialized on the client. The client then sends a marker to BrainStream to trigger the initTrain function. The advantage of this construction is that you are always sure that the stimulus client is correctly initialized before the actual experiment starts.
Figure 2: Import-table flowchart
In the import-table flowchart you can see why it is advantageous to use parallel processing: if the action of updating the codebook (at the BrainStream session) is delayed or takes more than 0.07 seconds, the duration of the stimulus (at the client) is not affected.
In order to build this experiment, we first need to indicate that we want to use parallel processing and define the client. This can be done in the block file speller_common.blk:
[RunMode] Parallel=1; [Clients] stim = 'localhost';
Thus, the name of the client is 'stim'. Furthermore, 'stim' is an internal client of type 'localhost'. This means that in order to run the experiment, we must start a second Matlab session manually and connect this session to the BrainStream session by typing the command connect_brainstream_client('localhost') in the client's command window.
Now that we have specified the client in the block file, we can direct the execution of any action to this client. We can do this by specifying the name of the client in the 'client' column of the Actions table:
Figure 3: Actions sheet of the speller_train table
Figure 4: Actions sheet of the speller_common table
Evaluation
---