Difference between revisions of "Guide to OpenSesame"
Line 13: | Line 13: | ||
[[File:SRBoxexample_intro_props.png|link=|border]] |
[[File:SRBoxexample_intro_props.png|link=|border]] |
||
− | The next item is the intro_response srbox item, which is the interface to the button box. The script will wait here until one of the buttons identified by the 'Allowed responses' property is pressed. In this case only button 3 (the middle button) is allowed. The semicolon-separated list '1;3;5' in the 'Turn on lights' property indicates that button lights 1, 3, and 5 will illuminate. The 'Allowed responses' property can also contain a semicolon-separated list. |
+ | The next item is the 'intro_response' srbox item, which is the interface to the button box. The script will wait here until one of the buttons identified by the 'Allowed responses' property is pressed. In this case only button 3 (the middle button) is allowed. The semicolon-separated list '1;3;5' in the 'Turn on lights' property indicates that button lights 1, 3, and 5 will illuminate. The 'Allowed responses' property can also contain a semicolon-separated list. |
The 'autodetect' value of the 'Device name' property identifies that OpenSesame should attempt to find the button box automatically. |
The 'autodetect' value of the 'Device name' property identifies that OpenSesame should attempt to find the button box automatically. |
||
Line 20: | Line 20: | ||
[[File:SRBoxexample_intro_response_props.png|link=|border]] |
[[File:SRBoxexample_intro_response_props.png|link=|border]] |
||
+ | |||
+ | Finally, the 'delay500' advanced delay item. The SRBox plugin does not provide event handling for button-down/button-up events. What this means is that the button box continuously sends button press data as long as the button is pressed. If the next stimulus in a loop is presented while a button is still being pressed in response to the previous stimulus, then the next stimulus will record an incorrect response. The delay500 item causes the script to wait 500ms before executing the next item, as shown by the value of the 'Duration' property. A longer delay may be necessary for subjects with heavy fingers. |
||
+ | |||
+ | [[File:SRBoxexample_delay500_props.png|link=|border]] |
||
+ | |||
+ | Summing up, the three steps for integrating the button box are: |
||
+ | |||
+ | # Provide a stimulus that does not wait indefinitely for subject keyboard input. |
||
+ | # Follow the stimulus with an srbox item. |
||
+ | # Introduce a delay to allow sufficient time for the subject to release the button before continuing to the next item. |
||
+ | |||
+ | These steps are repeated in the 'mainloop' sequence of the sample script, and a 'logger' item is also introduced to log subject responses. You will also see that the properties of the 'stimulus' and 'srbox_input' items are provided by variables defined in the 'mainloop' item rather than being hardcoded, as they are in the 'intro' and 'intro_response' items shown above. |
Revision as of 15:19, 9 October 2013
OpenSesame is an open-source software package for building and running psychology experiments. It's written in Python and is available for Windows, OS X, and Linux systems.
Using a button box with OpenSesame
The File:SRBoxexample.opensesame.tar.gz provides a demonstration of how to collect button presses in an OpenSesame experiment. For more detail on the use of button boxes see the documentation for the OpenSesame SRBox plugin.
In this example the basic pattern of presenting a stimulus and waiting for a response proceeds in three steps. Take a look at the experiment overview:
First, text is displayed to the subject by the 'intro' text display item. By default items of this type wait for a keypress, but we change the default 'keypress' value of the 'Duration' property to '0' to cause the script to immediately execute the following item.
The next item is the 'intro_response' srbox item, which is the interface to the button box. The script will wait here until one of the buttons identified by the 'Allowed responses' property is pressed. In this case only button 3 (the middle button) is allowed. The semicolon-separated list '1;3;5' in the 'Turn on lights' property indicates that button lights 1, 3, and 5 will illuminate. The 'Allowed responses' property can also contain a semicolon-separated list.
The 'autodetect' value of the 'Device name' property identifies that OpenSesame should attempt to find the button box automatically.
The 'infinite' value of the 'Timeout' property means that the script will wait on this item until one of the allowed responses is received. During our script the intro text display therefore remains on the screen until an allowed response is received.
Finally, the 'delay500' advanced delay item. The SRBox plugin does not provide event handling for button-down/button-up events. What this means is that the button box continuously sends button press data as long as the button is pressed. If the next stimulus in a loop is presented while a button is still being pressed in response to the previous stimulus, then the next stimulus will record an incorrect response. The delay500 item causes the script to wait 500ms before executing the next item, as shown by the value of the 'Duration' property. A longer delay may be necessary for subjects with heavy fingers.
Summing up, the three steps for integrating the button box are:
- Provide a stimulus that does not wait indefinitely for subject keyboard input.
- Follow the stimulus with an srbox item.
- Introduce a delay to allow sufficient time for the subject to release the button before continuing to the next item.
These steps are repeated in the 'mainloop' sequence of the sample script, and a 'logger' item is also introduced to log subject responses. You will also see that the properties of the 'stimulus' and 'srbox_input' items are provided by variables defined in the 'mainloop' item rather than being hardcoded, as they are in the 'intro' and 'intro_response' items shown above.