mindaffect/pymindaffectBCI

Cyton issue

Closed this issue · 3 comments

Hello !

Firstly, thank you very much for your work!

I'm trying to use your code with a Cyton and our own EEG sensors, but I'm facing some issues probably due to parameters. Indeed, I manage to connect the Cyton but when I check the electrode quality it's not good. Electrodes are red and the noise to signal ratio is "nan":
nan

I know the issue doesn't come from the electrodes as acquisitions work well with OpenBCI and our own software. However, I have some leads, as parameters seem to be more fitted for the Ganglion than for the Cyton.
Where can I change the fs which apparently is not set at 250Hz? Maybe it's not the only raison for the issue but this is the main one I see for now...

Plus, it's not directly part of the problem but I would like to change the gain from x24 to x4, could you help me to find where I can do that?

Thank you very much! Have a nice day!
Guillaume

PS: I would also like to notice you a typo in "pymindaffectBCI\mindaffectBCI\examples\acquisition\utopia_cyton.py" line 1:
from mindaffectBCI.examples.acquisation.cyton import OpenBCICyton
which should be replace by:
from mindaffectBCI.examples.acquisition.cyton import OpenBCICyton

Hi Guillaume,

Thanks for your message and the bug-report. I'm excited to see how the performance looks using the conscious-labs (right?) electrodes. I've been wanting to try them for a while.

For your issue -- it definitely shouldn't be showing nan for the signal-to-noise ratio, normally this is an indication of a all-zeros channel or similar causing a division by zero in the computation. It would help to understand and debug the issue if I could see get a savefile from a testing run. This will be a file called something like mindaffectBCI_noisetag_bci_YYMMDD_HHMM.txt where YYMMDD, HHMM numbers for the date of the recording. By default this will be saved to the logs directory of your desktop (on windows), but it should also be shown in the pop-up which lists the ip addresses of the hub at startup. If you have this file, you can email directly to me at jason@mindaffect.nl

For setting the sample rate, most of the configuration takes place in the .json file which you specify at startup. Here, you can specify the sample rate in 2 places:

  1. In the acquisition section -- if the amplifier driver supports this, you can specific the sample rate to use.
  2. In the decoder section -- the out_fs parameter allows you to specify the sample rate after pre-processing used by the machine learning component.

BTW: Note that, when using the openBCI amplifiers, we recommend using the brainflow acquisition system (as it's better tested), in which case you can check the brainflow docs for possible settings -- though a quick look didn't seem to reveal any sample rate configuration options.

PS: thanks for the spot on the typo in utopia_cyton.py, it should be fixed now.

So I've had a look at the data you sent, and I think I understand the problem. Looking at the data, and in particular the time-stamps of the data coming from the amplifier I see this:

image (5)

What you can see is that the samples seem to be coming in blocks roughly every 400ms -- whilst our system can cope with quite a large degree of data arrival jitter, this extreme a situation causes us some issues.

Fortunately, we've seen this type of issue before with the cyton and it's generally associated with how you have setup the cyton. In particular did you follow the instructions on this page https://mindaffect-bci.readthedocs.io/en/latest/amp_config.html#openbci-cyton-latency-fix which talks about how to setup the cyton so that you don't get these issues with sample arrival times?

Closing as user responded that it was a latency configuration issue -- and the suggested fixes solved the issue.