NeuroTechX / bci-workshop

Material for the BCI Workshop held at District 3 in May 2015 by BCI Montréal.
Other
88 stars 54 forks source link

test with openbci #18

Closed micuat closed 6 years ago

micuat commented 6 years ago

@rcassani test needed with openbci lsl (openbci_gui and openbci_python?)

micuat commented 6 years ago

I did test without electrodes attached (cyton + dongle + OpenBCI_GUI). exercise 1 worked (and the eeg plot seems moving when I touch the pins) and exercise 2 failed at svm fitting:

C:\Users\naoto\Documents\2018ntx\bci-workshop\python\bci_workshop_tools.py:140: RuntimeWarning: divide by zero encountered in log10
  feature_vector = np.log10(feature_vector)
C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\_methods.py:101: RuntimeWarning: invalid value encountered in subtract
  x = asanyarray(arr - arrmean)
C:\Users\naoto\Documents\2018ntx\bci-workshop\python\bci_workshop_tools.py:204: RuntimeWarning: invalid value encountered in subtract
  X = (features_all - mu_ft) / std_ft
Traceback (most recent call last):
  File "exercise_02.py", line 115, in <module>
    feat_matrix0, feat_matrix1, 'SVM')
  File "C:\Users\naoto\Documents\2018ntx\bci-workshop\python\bci_workshop_tools.py", line 208, in train_classifier
    clf.fit(X, y)
  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\svm\base.py", line 151, in fit
    X, y = check_X_y(X, y, dtype=np.float64, order='C', accept_sparse='csr')
  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 521, in check_X_y
    ensure_min_features, warn_on_dtype, estimator)
  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 407, in check_array
    _assert_all_finite(array)
  File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 58, in _assert_all_finite
    " or a value too large for %r." % X.dtype)
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

I haven't debugged but it seems 0 is passed to logarithm. I don't know this is due to OpenBCI or just because I didn't attach electrodes.

rcassani commented 6 years ago

@micuat, do you know if only EEG channels are streamed? When there is constant channel (sometimes triggers) its features are constant, then there is the issue when normalizing those features.

micuat commented 6 years ago

@rcassani I haven't used labrecorder to verify but I only activated time series stream. but it's probably openbci_gui detected as railed and only output 0s or NaNs so the fft failed on exercise scripts. I will try with actually attaching electrodes later

micuat commented 6 years ago

@rcassani ok now I tested with actual electrodes and it works. The only issue I found was that when you stream data from OpenBCI_GUI, you have to disable both notch and BP filters (otherwise you will only see weird pulse)