PsychoPy: Difference between revisions

From BCI2000 Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
The component defines which state to update and when. It takes the following parameters:
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.
; 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 variables are written as ''$VariableName''.  
; 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.  
; 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.
; 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.



Revision as of 18:39, 26 July 2019

PsychoPy is an open-source application using which a large number of neuroscience, psychology and psychophysics experiments can be performed.[1] This documentation described how to integrate BCI2000 in PsychoPy and its usage.

BCI2000 and PyschoPy

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.


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.

Integrating BCI2000 into PyschoPy

Download the PsychoPy from the PyschoPy website.
Copy the following two folders BCIStart and BCIUpdateState in 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, you should see the two new components - BCI2000Start and BCI2000UpdateState as shown in the figure below.

References