-
Notifications
You must be signed in to change notification settings - Fork 5
/
InputBox.py
64 lines (50 loc) · 1.99 KB
/
InputBox.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""
Author:JOHN NAULTY
DATE: JULY 2014
SSVEP_GUI
"""
from psychopy import gui
class InputBox(object):
def __init__(self):
self.myDlg = gui.Dlg(title="OpenBCI Menu")
self.myDlg.addText('Subject info')
self.myDlg.addField('Participant:')#0
self.myDlg.addField('Session', 001)#1
self.myDlg.addField('Port', '/dev/ttyACM0')#2
self.myDlg.addText('Frequency Selction')
self.myDlg.addField('Frequency', choices=["None", "6", "7.5","10","12", "15", "20"])#3
self.myDlg.addText('Flash Duration')
self.myDlg.addField('Duration', '5')#4
self.myDlg.addText('Time after stimulus')
self.myDlg.addField('InterTrialTime', '2')#5
self.myDlg.addText('Choose Number of Trials')
self.myDlg.addField('NumberTrials', '1')#6
self.myDlg.show() # show dialog and wait for OK or Cancel
if self.myDlg.OK: # then the user pressed OK
self.thisInfo = self.myDlg.data
self.options = {'participant': self.thisInfo[0], 'session': self.thisInfo[1], 'port': self.thisInfo[2], 'Frequency': self.thisInfo[3], 'Duration': self.thisInfo[4], 'InterTrialTime': self.thisInfo[5], 'NumberTrials': self.thisInfo[6]}
else:
print 'User Cancelled'
# Setup filename for saving
self.fname = '%s_%s.csv' %(self.options['participant'], self.options['session'])
#port name
self.port = '%s' %self.options['port']
#flash duration
self.flash_duration= '%s' %self.options['Duration']
#number of trials
self.num_trials= '%s' %self.options['NumberTrials']
#time to wait between trials
self.wait_dur= '%s' %self.options['InterTrialTime']
self.freq = self.options['Frequency']
def file(self):
return str(self.fname)
def port_name(self):
return str(self.port)
def stim_duration(self):
return int(self.flash_duration)
def stim_trials(self):
return int(self.num_trials)
def waitduration(self):
return int(self.wait_dur)
def frequency(self):
return float(self.freq)