Difference: DocsSectionsExampleSpellerPart4 (1 vs. 6)

Revision 614 Nov 2014 - Main.PhilipVanDenBroek

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Example 2: Visual speller

Part 4

Line: 7 to 7
  In previous parts of the experiment, stimulus presentation timing was not accurate. Epochs occurred later than specified and the time between stimuli was not constant throughout a sequence. In this part of the example, we will improve these timing issues by using a simple loop function for stimulus presentation.
Changed:
<
<
The loop function runSequence executes most actions of the stimulus presentation plug-in. The new flowchart of the plug-in looks like this:
>
>
The loop function runSequence executes most actions of the stimulus presentation import-table. The new flowchart of the imported table looks like this:
  flowchart2.png
Changed:
<
<
Figure 1: Stimulus presentation plug-in flowchart. Actions indicated in orange are executed at the BrainStream Matlab session, whereas actions indicated in blue are executed at the client.
>
>
Figure 1: Stimulus presentation import-table flowchart. Actions indicated in orange are executed at the BrainStream Matlab session, whereas actions indicated in blue are executed at the client.
  This is the runSequence function:
function ev = runSequence(ev)

Revision 530 Jan 2012 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Example 2: Visual speller

Part 4

Line: 7 to 7
  In previous parts of the experiment, stimulus presentation timing was not accurate. Epochs occurred later than specified and the time between stimuli was not constant throughout a sequence. In this part of the example, we will improve these timing issues by using a simple loop function for stimulus presentation.
Changed:
<
<
The loop function runSequence replaces most actions of the stimulus presentation plug-in. The new flowchart of the plug-in looks like this:
>
>
The loop function runSequence executes most actions of the stimulus presentation plug-in. The new flowchart of the plug-in looks like this:
 
Changed:
<
<
flowchart1.png
>
>
flowchart2.png
  Figure 1: Stimulus presentation plug-in flowchart. Actions indicated in orange are executed at the BrainStream Matlab session, whereas actions indicated in blue are executed at the client.
Line: 62 to 62
 <- Go back to Part 3 - Continue with Part 5 ->

META FILEATTACHMENT attachment="flowchart1.png" attr="" comment="" date="1325755779" name="flowchart1.png" path="flowchart1.png" size="131369" stream="flowchart1.png" tmpFilename="/var/tmp/CGItemp2081" user="MarjoleinVanDerWaal" version="1"
Added:
>
>
META FILEATTACHMENT attachment="flowchart2.png" attr="" comment="" date="1327922789" name="flowchart2.png" path="flowchart2.png" size="223522" stream="flowchart2.png" tmpFilename="/var/tmp/CGItemp16529" user="MarjoleinVanDerWaal" version="1"

Revision 409 Jan 2012 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Example 2: Visual speller

Part 4

<- Go back to Part 3 - Continue with Part 5 ->

Changed:
<
<
In previous parts of the experiment, stimulus presentation timing was not accurate. Epochs occurred later than specified and the time between stimuli was not constant throughout a sequence. In this part of the example, we will improve these timing issues by using a loop function for stimulus presentation.
>
>
In previous parts of the experiment, stimulus presentation timing was not accurate. Epochs occurred later than specified and the time between stimuli was not constant throughout a sequence. In this part of the example, we will improve these timing issues by using a simple loop function for stimulus presentation.
  The loop function runSequence replaces most actions of the stimulus presentation plug-in. The new flowchart of the plug-in looks like this:
Line: 41 to 41
 end end
Changed:
<
<
This loop function should make sure that the time between to stimuli is always 200 ms, during which period a row or column is flashed for 100 ms and the non-highlighted grid is shown for the next 100 ms. Matlab's tic, toc and pause functions are used for stimulus timing.
>
>
This loop function should make sure that the time between two stimuli is always 200 ms, during which period a row or column is flashed for 100 ms and the non-highlighted grid is shown for the next 100 ms. Matlab's tic, toc and pause functions are used for stimulus timing.
 

Evaluation

Revision 306 Jan 2012 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Example 2: Visual speller

Part 4

Line: 57 to 57
  Thus, rows and columns are highlighted and dimmed precisely every 100 ms. Stimulus duration and inter stimulus interval are stable throughout the sequence. In conclusion, using loop functions for presenting sequences of stimuli allows for a much better timing of your stimuli.
Changed:
<
<
A downside of the loop function which we used here is that the loop cannot be interrupted by BrainStream. All stimuli must be presented before the function is finished and BrainStream processing can continue. In the final part of this example we will show how to create a so-called loop-tick function to improve this situation.
>
>
A downside of the loop function which we used here is that the loop cannot be interrupted by BrainStream. All stimuli must be presented before the function is finished and BrainStream processing can continue. In the final part of this example we will show how to create a looptick function to improve this situation.
  <- Go back to Part 3 - Continue with Part 5 ->

Revision 205 Jan 2012 - Main.MarjoleinVanDerWaal

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Example 2: Visual speller

Part 4

Added:
>
>
<- Go back to Part 3 - Continue with Part 5 ->
 In previous parts of the experiment, stimulus presentation timing was not accurate. Epochs occurred later than specified and the time between stimuli was not constant throughout a sequence. In this part of the example, we will improve these timing issues by using a loop function for stimulus presentation.

The loop function runSequence replaces most actions of the stimulus presentation plug-in. The new flowchart of the plug-in looks like this:

Changed:
<
<
StimPres4.png
>
>
flowchart1.png
 
Changed:
<
<
Figure 1: Stimulus presentation plug-in flowchart
>
>
Figure 1: Stimulus presentation plug-in flowchart. Actions indicated in orange are executed at the BrainStream Matlab session, whereas actions indicated in blue are executed at the client.
  This is the runSequence function:
function ev = runSequence(ev)
Line: 41 to 43
  This loop function should make sure that the time between to stimuli is always 200 ms, during which period a row or column is flashed for 100 ms and the non-highlighted grid is shown for the next 100 ms. Matlab's tic, toc and pause functions are used for stimulus timing.
Changed:
<
<
META FILEATTACHMENT attachment="StimPres4.png" attr="" comment="" date="1325683378" name="StimPres4.png" path="StimPres4.png" size="52885" stream="StimPres4.png" tmpFilename="/var/tmp/CGItemp2145" user="MarjoleinVanDerWaal" version="1"
>
>

Evaluation

As a result of the tic and toc commands in the runSequence function, we can see in the client's command window at which timepoints stimuli have been turned on and off. These are the results of the first and last three stimuli of the last sequence:

stimulus highlight on highlight off
1 0.000007 0.099184
2 0.199446 0.299849
3 0.399729 0.499392
... ... ...
18 3.399827 3.499717
19 3.599168 3.699124
20 3.799698 3.899841

Thus, rows and columns are highlighted and dimmed precisely every 100 ms. Stimulus duration and inter stimulus interval are stable throughout the sequence. In conclusion, using loop functions for presenting sequences of stimuli allows for a much better timing of your stimuli.

A downside of the loop function which we used here is that the loop cannot be interrupted by BrainStream. All stimuli must be presented before the function is finished and BrainStream processing can continue. In the final part of this example we will show how to create a so-called loop-tick function to improve this situation.

<- Go back to Part 3 - Continue with Part 5 ->

META FILEATTACHMENT attachment="flowchart1.png" attr="" comment="" date="1325755779" name="flowchart1.png" path="flowchart1.png" size="131369" stream="flowchart1.png" tmpFilename="/var/tmp/CGItemp2081" user="MarjoleinVanDerWaal" version="1"

Revision 104 Jan 2012 - Main.MarjoleinVanDerWaal

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Example 2: Visual speller

Part 4

In previous parts of the experiment, stimulus presentation timing was not accurate. Epochs occurred later than specified and the time between stimuli was not constant throughout a sequence. In this part of the example, we will improve these timing issues by using a loop function for stimulus presentation.

The loop function runSequence replaces most actions of the stimulus presentation plug-in. The new flowchart of the plug-in looks like this:

StimPres4.png

Figure 1: Stimulus presentation plug-in flowchart

This is the runSequence function:

function ev = runSequence(ev)
 
isi = 0.2; % inter-stimulus-interval
flashed = 0;
count = 0;
tic;
while 1
    toc
    if ~flashed
        % randomly highlight row or column and send stim_## marker
        ev = highlightGrid(ev);
        ev = bs_send_hardware_marker(ev,sprintf('stim_%d',ev.stimCode),'eeg'); % mark the data with what happened
    else
        % dim higlighted row or column
        ev = showGrid(ev);
        ev = bs_send_hardware_marker(ev,'highlightOff','eeg'); % also mark this moment
    end
    count = count + 1;
    if count >= 2*bs_get_blockvalue(ev,'Experiment','nRep',10)
        ev = bs_send_buffer_marker(ev,'endSequence','eeg',.3); % N.B. enough extra for ERP to finish...
        break
    end
    flashed = ~flashed;
    pause(max(0, count*(isi/2)-toc));
end
end

This loop function should make sure that the time between to stimuli is always 200 ms, during which period a row or column is flashed for 100 ms and the non-highlighted grid is shown for the next 100 ms. Matlab's tic, toc and pause functions are used for stimulus timing.

META FILEATTACHMENT attachment="StimPres4.png" attr="" comment="" date="1325683378" name="StimPres4.png" path="StimPres4.png" size="52885" stream="StimPres4.png" tmpFilename="/var/tmp/CGItemp2145" user="MarjoleinVanDerWaal" version="1"
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback