-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·47 lines (40 loc) · 1.88 KB
/
Copy pathmain.py
File metadata and controls
executable file
·47 lines (40 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys
from StimulusPresentation import StimulusPresentation, PresentationMode, PresentationStatus
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QCoreApplication, QEventLoop, QDateTime
from lslrecorder import Lslrecorder
class P3speller():
def __init__(self):
self.lslrec = Lslrecorder()
if(self.lslrec.findStream() == -1):
return
self.lslrec.startRec()
app = QApplication(sys.argv)
presentation = StimulusPresentation()
# init speller-mode with image path and inter-stimulus-interval,
presentation.initialize('speller_images/', 120, PresentationMode.SPELLER_MODE)
# show window
presentation.show()
# simulate waiting time to demonstrate startup-feature
#curr_time = QDateTime.currentMSecsSinceEpoch()
#while QDateTime.currentMSecsSinceEpoch() < curr_time + 1000:
# QCoreApplication.processEvents(QEventLoop.AllEvents, 100)
# show target with text
#presentation.show_target(1, 'Search for this Target')
# execute subtrial and save flash-sequence
_flash_sequence = presentation.execute_sub_trial()
curr_time = QDateTime.currentMSecsSinceEpoch()
while QDateTime.currentMSecsSinceEpoch() < curr_time + 1000:
QCoreApplication.processEvents(QEventLoop.AllEvents, 100)
# show target, and afterwards highlight target in matrix before next keypress
#presentation.show_target(5, 'This is multi-\nline text', show_matrix=True)
#_flash_sequence = presentation.execute_sub_trial()
print(_flash_sequence)
self.getDataSnippets(_flash_sequence)
sys.exit(app.exec_())
def getDataSnippets(self, flash_sequence):
for (ind,timestamp) in flash_sequence:
self.lslrec.getDataAtTimestamp(timestamp)
return
if __name__ == '__main__':
P3speller()