PsychoPy

From BCI2000 Wiki
Revision as of 15:54, 30 July 2019 by Dashmeetkaur (talk | contribs)
Jump to navigation Jump to search

PsychoPy is an open-source application using which a large number of neuroscience, psychology and psychophysics experiments can be performed [1]. This section first describes the two components that are developed to remotely start BCI2000 from the PsychoPy and the second section lists the steps to follow to add the new components in the PsychoPy application.

Components

BCIStart

The component starts up the BCI2000 modules remotely. The component takes two parameters:

Path
Path to the BCI2000 prog directory which contains the BCI2000Remote.py file.
States
List of new states to add to the BCI2000. The states in the list are defined as follows: 'StateName defaultValue maxValue'. Eg: lastKey 0 255, correctKey 0 1.

"BCI2000 start component image showing its parameters"

BCIUpdateState

The component defines which state to update and when. It takes the following parameters:

State Name
The name of the state in BCI2000 to update.
Response Component Variable
The variable to which the state is be set OR the variable which contains the new value of the state. Note- the variable is written as $VariableName.
Use Expression
If it is checked, the code written in 'Expression' is executed for each Frame and the variable specified is not used to update the state.
Expression
The code to execute for each Frame. It is given for the cases, where the variable is not available and the users want more control over how the state is updated. Note- the user would have to use commands like bci.Execute and SET STATE to update the state in such cases. See Programming Reference:BCI2000Remote Class and User Reference:Operator Module Scripting for more details.

"BCI2000 update state component image showing its parameters"

Integrating BCI2000 into PyschoPy

Download the PsychoPy from the PyschoPy website.


Standalone version

For Windows, Copy the folders BCIStart and BCIUpdateState from src/contrib/PsychoPy Components directory of your BCI2000 repository into the folder {$PsychoPyHome}\Lib\site-packages\psychopy\experiment\components folder.


Developer version

Here is a picture of how PsychoPy looks before integrating BCI2000 in it. Notice that in the rightmost column, under Custom Components, there is no BCI2000 component. "PsychoPy Homepage without BCI2000 Components"

Copy the folders BCIStart and BCIUpdateState from src/contrib/PsychoPy Components directory of your BCI2000 repository into the folder {$PsychoPyHome}\psychopy\experiment\components. Open terminal and navigate to the PsychoPy home directory where setup.py resides. Run the following command in the terminal:
pip install -e .



Start Psychopy application and in the builder view, under the Custom Components (in rightmost column), you should see the two new components - BCI2000Start and BCI2000UpdateState as shown in the figure below.

"PsychoPy Homepage with BCI2000 Components"

Note: Make sure you don't run the experiments on full screen if you are using a single screen.

References

See Also