From BCI2000 Wiki
Revision as of 16:57, 9 February 2021 by Nluczak (talk | contribs)
Jump to navigation Jump to search
===Under construction====


BCPy2000 is a software project which allows a platform for rapid, flexible development of experimental brain-computer interface systems. It is based on, and hosted by, the BCI2000 project. It differs in that this implementation is based in Python 3.6, taking advantage of various high-level packages: Psychopy for stimulus presentation, and NumPy and SciPy for signal processing and classification. Because it is based on the BCI2000 system, it is modular, comprising of an application module which presents the stimuli, a signal source module which waits for data to come in from hardware and to then send these blocks of data to the signal processing module while synchronizing to the hardware clock, and a signal processing module which acts as an intermediate between the signal source and the application. Each of these modules are independent of the others, allowing for you to pick and choose which modules you wish to run as Python modules or BCI2000 compiled modules, for example you can use BCI2000's Signal Source module which supports a wide range of EEG acquisition modules. BCPy2000 is made in mind for developers as well as clinicians with some experience in Python. This project aims to allow you to build your own experiments and modules based on your own python code tailored for your needs. We provide a demo implementation which exemplifies some higher level Python tools which will give you a good idea of where to start.


For this project you will need two things, our portable Python package, and BCI2000. You can find the 32 bit version of our portable Python here and the 64 version [here.] BCPy2000 will be compiled automatically with other BCI2000 programs. Compilation is only supported in BCI2000 with the Visual Studio or MinGW compilers. You can find these instructions at Programming_Howto:Building_BCI2000. Make sure that when you are configuring BCI2000 in CMake, you choose the "BUILD_BCPY2000" and "BUILD_CONTRIB" flags. Once you have done this you can configure and generate your BCI2000 solution.


Once you are in Visual Studio, you can edit the Python Application, Signal Processing, and Source modules and build them individually or all together (note that when you first open this project you will want to build the entire solution first). All three modules share a filer and wrapper classes classes which allow Python functions to be loaded dynamically from a DLL at runtime. These files are where you will be able to make any necessary customization of the interface between the BCI2000 C++ code and the Python code should you want to. After building the application, source, and signal processing modules, then, from your main BCI home directory you will need to navigate to src\contrib\BCPy2000\demo and copy the contents of the batch, data, parms, prog, and python folders into each corresponding folder in the main directory. The next step in the configuration process is to configure Python as a system variable. First you will want to unzip one of our Portable Python packages. Make sure that you have chosen either the 32 or 64 bit version of Python based on how you built your BCI2000 installation. Now that you have unzipped the portable Python package, you will need to set it’s file directory’s PATH in the System Variables settings menu which you can access by searching "System Variables" after pressing the Windows key. Add a new Path Called PYTHONHOME_BCI2000 so as to not have it interfere with any other Python installations you may already have installed. The portable Python package is where you will find all of your Python dependencies, including the BCPy2000 Python code as well as many other high level Python packages. This is where you will do most of your customization. Under the Python site packages you will find important files pertaining to our implementation under the BCPy2000 folder, and the Psychopy folder. You can also add new packages to the portable python version by going into the command prompt, changing your local directory to Python’s directory and installing any new packages by using pip, Python’s native package installer and manager. Now that you have properly installed all of the necessary components for Python we can go into how to implement your own experiment.