kuz / BrainActivity3D

Computer Graphics Project 2013
GNU General Public License v3.0
22 stars 5 forks source link

Bad file descriptor errors on Mac OS X #27

Open tamakoshihiroki opened 10 years ago

tamakoshihiroki commented 10 years ago

The pre-compiled binary for Mac OS X doesn't work correctly. Invoking brainactivity displays the following messages:

Looking for device
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [1]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [2]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [3]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [4]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [5]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [6]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [7]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [8]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [9]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [10]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [11]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [12]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [13]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [14]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Restarting gevent.core.dispatch() after an error [15]: [Errno 9] Bad file descriptor
[warn] kevent: Bad file descriptor
Process Process-2:
Traceback (most recent call last):
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/multiprocessing.process", line 258, in _bootstrap
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/multiprocessing.process", line 114, in run
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/lib.epoc", line 20, in epoc_reader
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/gevent.hub", line 79, in sleep
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/gevent.hub", line 164, in switch
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/gevent.hub", line 179, in run
  File "core.pyx", line 398, in gevent.core.dispatch (gevent/core.c:6132)
IOError: [Errno 9] Bad file descriptor
Could not connect to the device. Running with dummy data.
/Users/hiroki-tamakoshi/Downloads/brainactivity/sklearn/decomposition/fastica_.py:107: UserWarning: FastICA did not converge. You might want to increase the number of iterations.
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "<string>", line 251, in display
  File "<string>", line 279, in brain_scene
  File "<string>", line 508, in draw_electrodes
  File "<string>", line 546, in draw_electrode
  File "<string>", line 557, in draw_label
  File "/Users/kuz/Development/BrainActivity3D/binaries/MacOSX/build/onedir/out00-PYZ.pyz/OpenGL.platform.baseplatform", line 384, in __call__
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutBitmapString, check for bool(glutBitmapString) before calling
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "<string>", line 305, in idle
  File "<string>", line 248, in display
  File "<string>", line 630, in draw_background
  File "latebind.pyx", line 32, in OpenGL_accelerate.latebind.LateBind.__call__ (src/latebind.c:667)
  File "errorchecker.pyx", line 50, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src/errorchecker.c:854)
OpenGL.error.GLError: GLError(
    err = 1282,
    description = 'invalid operation',
    baseOperation = glUniform1i,
    cArguments = (0, 0)
)

EPOC Control Panel provided officially works as expected.

My environment is as follows:

Mac OS X Mavericks
SDK is the Research Edition 1.0.0.5
EPOC Control Panel 2.0.0.20
kuz commented 10 years ago

The last time I tried I was not able to make emokit (the library which communicates with the device) work under Mac OS X. Will look into it.

Until then you can resort to using Windows version.

tamakoshihiroki commented 10 years ago

Thanks kuz, I'll wait for a good news. (sorry I don't have any Windows PC.)

tamakoshihiroki commented 10 years ago

I prepared a Windows PC and invoked brainactivity3d.exe on it, but the following error messages are shown.

Looking for device
Traceback (most recent call last):
File "C:\Users\kuz\Documents\BrainActivity3D\binaries\Windows\build\onedir\out00-PYZ.pyz\gevent.greenlet", line 390, in run
File "C:\Users\kuz\Documents\BrainActivity3D\binaries\Windows\build\onedir\out00-PYZ.pyz\lib.emokit.emotiv", line 353, in setup
File "C:\Users\kuz\Documents\BrainActivity3D\binaries\Windows\build\onedir\out00-PYZ.pyz\lib.emokit.emotiv", line 455, in setupPosix
File "C:\Users\kuz\Documents\BrainActivity3D\binaries\Windows\build\onedir\out00-PYZ.pyz\lib.emokit.emotiv", line 369, in getLinuxSetup
WindowsError: [Error 3] Specified path not found: '/sys/class/hidraw/.'
>> failed with WindowsError

Could not connect to the device. Running with dummy data.

I don't have the Emotiv SDK for Windows. What is wrong with me?

kuz commented 10 years ago

Do you have pywinusb installed? There is nothing wrong with you, our system is in a "very beta" stage :)

kuz commented 10 years ago

Actually no, pywinusb is not responsible, in principle the bundle should have all the required packages installed. Well, obviously there is something broken in the Windows distribution as well. I will fix it sooner or later. Until then you can try to run from the source code using python (see the main page for instructions).

tamakoshihiroki commented 10 years ago

Thanks kuz,

I was just going to install all of the dependencies( python, pywinusb, gevent, PyCrypto, ... ) Again I'll wait for your update. I feel that I don't have the ability to run from your source code currently. I should start to study the language and libraries...

By the way, can I read academic papers you or your class mates wrote in COMPUTATIONAL NEUROSCIENCE LAB related to the brain source reconstruction?

kuz commented 10 years ago

We have not produced an article out of that. The code is based on Independent Component Analysis (ICA) + optimization to estimate distances from the ICA components. This is pretty common way to do it and you can easily find some reading on that topic from Google Scholar: http://scholar.google.com/scholar?q=eeg+source+localization+ica

konstantint commented 10 years ago

... well, there's the report, which is nearly like an article, isn't it.