mindaffect/pymindaffectBCI

Flicker timing issues

Opened this issue · 3 comments

Hello, I notice that whenever I run the different presentation examples on my PC, the flickering of each element happens way too fast. I am using a 100 Hz monitor, but is the flickering of the stimuli tied to the native refresh rate of the monitor? I can provide any details needed.

Hi Jadin,

Yes, you are completly correct -- the flicker rate is locked to the stimulus rate of the monitor, so with a 100hz monitor it will run at 100Hz. This is done to try to maximize the timing accuracy -- but does mean the flicker can look different on different displays.

If you are using the selectionMatrix and update to the newest version: pip install --upgrade mindaffectBCI which should give V.0.13.

Then you can slow down the stimuli with the --framesperbit option, so using --framesperbit 2 will make the stimuli run @50Hz on a 100hz display.

You can also run with --fullscreen which may help further with timing accuracy.

That is run:
python3 -m mindaffectBCI.examples.presentation.selectionMatrix --framesperbit 2 --fullscreen

Hi Jason,

Thank you so much for the quick response. I think this might have a lot to do with why I was getting such low accuracy. It seemed like the flickerings were probably moving so fast that they were indistinguishable on the EEG data.

Hi Jason,

I finally got around to updating the library and trying again and now nothing works. When I run the framerate check I get the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/framerate_check.py", line 109, in <module>
    doFrameRateTest()
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/framerate_check.py", line 100, in doFrameRateTest
    window = selectionMatrix.initPyglet(fullscreen=False)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/selectionMatrix.py", line 851, in initPyglet
    window.lastfliptime=getTimeStamp()
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/selectionMatrix.py", line 815, in getTimeStamp
    return nt.getTimeStamp()
NameError: name 'nt' is not defined

and when I try to run the selection matrix I get

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/selectionMatrix.py", line 918, in <module>
    pyglet.app.run()
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/pyglet/app/__init__.py", line 107, in run
    event_loop.run()
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/pyglet/app/base.py", line 167, in run
    timeout = self.idle()
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/pyglet/app/base.py", line 237, in idle
    redraw_all = self.clock.call_scheduled_functions(dt)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/pyglet/clock.py", line 255, in call_scheduled_functions
    item.func(dt, *item.args, **item.kwargs)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/selectionMatrix.py", line 859, in draw
    ss.draw(dt)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/selectionMatrix.py", line 688, in draw
    self.screen.draw(t)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/examples/presentation/selectionMatrix.py", line 568, in draw
    self.noisetag.updateStimulusState()
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/noisetag.py", line 455, in updateStimulusState
    self.stimulusStateMachineStack.next(t)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/noisetag.py", line 53, in next
    self.stack[-1].next(t)
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/noisetag.py", line 285, in next
    self.utopiaController.modeChange("Calibration.supervised")
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/utopiaController.py", line 118, in modeChange
    ModeChange(self.getTimeStamp(), newmode))
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/utopiaclient.py", line 818, in sendMessage
    self.sendRaw(msg.serialize()) # send the raw message directly
  File "/media/jadin/45ae8d0f-4043-48a9-b89c-31634a6d5989/Programming/AnotherEEGLib/venv/lib/python3.6/site-packages/mindaffectBCI/utopiaclient.py", line 803, in sendRaw
    raise IOError('Not connected to utopia server')
OSError: Not connected to utopia server

Could this have anything to do with the software on the decoder not being updated? Would someone be able to email me a disk image with the updated software on it since I can not connect the device to my home internet?