mindaffect/pymindaffectBCI

Cannot load fake data or running after installation

Opened this issue · 4 comments

Dear Developer of MindAffect,

I am trying to use this library. However, I have difficulty to run this by using fake data that is provided by this library. Could anyone give me some help? I tried to run this code

acq_args=dict(host='localhost', nch=4, fs=200)
acq_process = mindaffectBCI.online_bci.startacquisitionProcess('fakedata', acq_args)

Here is the screenshot of the issue

image

Also, I tried to follow the step here , Installation check section.
tried to run this code python -m mindaffectBCI.online_bci --acquisition fakedata

It asked me for the following json file. Which one should I choose? I tried each JSON file, yet it still does not work.
image

I chose online_bci.json . Here is the following set up in it
"acq_args":{
"board_id":-1,
"serial_port":"com5"
},

yet it gives me this error

image

Thank you so much in advance for your help.

Best,
Ihshan

Dear Ihshan,

Sorry to hear you are having issues getting the BCI setup. From what you report it's hard to be sure what the issue is. However, it looks like the utopia-hub is not running. Can I ask you to check a few things;

  1. Have you installed a java-runtime environment? as described here? https://github.com/mindaffect/pymindaffectBCI.
  2. If you have installed a java-runtime, can you check if the utopia-hub is running correctly by running, in a terminal (command window on windows):
    python3 -m mindaffectBCI.decoder.startUtopiaHub

This should generate some text in this window and then open a window with "Utopia Hub" in the window, and a list of network addresses where the hub can be reached.
Screenshot 2021-04-05 094212

  1. If the hub runs correctly and you are still having issues, then there may be an issue connecting to the hub. To test this, can you run the startUtopiaHub command in one window, and then with it running in another window can you run:
    python3 -m mindaffectBCI.noisetag

This should also generate some text in this window, and if it's running correctly, say stuff like:
flicker: 240 frames, tgt 4 *..*.**.*.*..**.*.*.*..*.*.**.*..**.*.*.*..*.*.*.*.*.*.*.*.*.*.**..*.**..**..*.**.*.*..*.**.*.*..**.*.*.*.*..*.*.**.*.*.*

If this does not work can you grab the output in this window and post it in the issue as it will give a better hint for what is causing the connection issues.

Best,
Jason

Dear Jason,

Thank you very much for your help. The issue is I haven't installed yet the java-runtime environment.
Once I have installed it. the main window pops up .

However, I still have another issue. The nature of my recording is I want to run or record the OpenBCI first by using Brainflow, then I run the mindaffect. If that is the order, it seems that the mindaffect is not able to connect. Kindly see the error below
image

Fyi, In the brainflow script, I set it up like this board.start_stream(450000,'streaming_board://130.216.209.252:8400')
These are the scripts to run mindaffect as suggested on the website

import mindaffectBCI.online_bci
# load the config-file to use.  Here we use the default noisetag config file:
config = mindaffectBCI.online_bci.load_config("noisetag_bci")
# Run the above configuration
mindaffectBCI.online_bci.run(**config)

But, If I run the above mindaffect script directly without running my brainflow script, it can give me the main window without any problem. It can connect to the my cython daisy OpenBCI. The reason why I need to run my brainflow script first because there are already some settings that I can control during the experiment such as giving markers, etc.

Do you have any idea how to connect mindaffect to brainflow script that is already running ?

Thanks
Ihshan

Fyi, to get further info on the error given . Thanks

image

Hi Ihshan,

Sorry for the delay in replying.

I now understand your issue, I have to say this isn't a configuration that we have tested before, that is with one brainflow running to setup the board and streaming the data, and another running as part of our BCI to catch the streamed data. In principle this should work, but it's not something that we have tried. However, to make it work, according to the brainflow docs https://brainflow.readthedocs.io/en/stable/SupportedBoards.html#streaming-board you would need to specify the mindaffectBCI acquisition parameters as:

    "acquisation":"brainflow",
    "acq_args":{
        "board_id":-2,
        "ip_address":"130.216.209.252",
        "ip_port": 8401,
       "other_info": 0 
    }

Note: don't use 8400 for the brainflow streaming configuration, as this port is used for the mindaffectBCI hub communications. So please use, e.g. 8401. and be sure to use the same port number when you start the brainflow stream, with board.start_stream(450000,'streaming_board://130.216.209.252:8401')

Alternatively, if you need to do special config for the brainflow server, then perhaps this could be achieved either by:

  1. setting the parameters to pass to brainflow in the mindaffectBCI. In the 'acquisition' section of the configuration file you can specify a lot of parameters to pass to "BrainFlowInputParams", such as ``ip_port,serial_port,mac_address,other_info, serial_number,ip_address,ip_protocol,timeout, streamer_params,. We've also just added the ability to give a list of config_board` commands to be sent to the board after initialization. These can also be specified in the configuration .json file using the `config_params` key in the acquisition dictionary, e.g. this will set the cyton up such that channel 8 is a bipolar reference channel
    "acq_args":{
        "board_id":0,
        "serial_port":"com4"
        "config_params": [ "x8020000X" ],
    },
  1. Alternatively, you could directly modify the utopia_brainflow.py script in the examples\acquisition directory to do your additional configuration.

I hope this helps -- please let us know if this did (or didn't) resolve your issue.

Jason