-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
45 lines (36 loc) · 1.33 KB
/
run.py
File metadata and controls
45 lines (36 loc) · 1.33 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from modules import main
from modules import config
from psychopy import gui
def user(user_ID):
#Coded being executed from the terminal
print('##############################################')
print(f'Running pyVisualStim. Good luck {user_ID}!')
#Creating folder
user_folder = config.OUT_DIR
if not os.path.exists(user_folder):
os.mkdir(user_folder)
#Setting user information for the first time
mainfile_name_temp = os.path.join(user_folder,'current_recording.txt')
mainfile_temp = open(mainfile_name_temp, 'w')
mainfile_temp.write(f'ID,value\n')
mainfile_temp.write(f'USER_ID,{user_ID}\n')
mainfile_temp.write(f'SUBJECT_ID,\n')
mainfile_temp.write(f'EXP_NAME,\n')
#Asking for stimulus
file_path = gui.fileOpenDlg('./stimuli_collection')
main(file_path[0])
print(__name__)
if __name__ == "__main__":
# # For debugging option
if __debug__:
user('seb')
# #For running from the terminal:
# "In the terminal write: python run.py user <choose_user_name>"
# #user("seb"), for example.
else:
globals()[sys.argv[1]](sys.argv[2]) # Makes possible to run the user() function and input the unser_name variable in the command line
user()