|
1 | 1 | # General imports |
2 | 2 | import os |
3 | 3 | import sys |
4 | | -from pathlib import Path |
5 | | -from hashlib import blake2b |
6 | 4 | # Smile imports |
7 | 5 | from smile.common import Experiment, Log, Wait, Func, UntilDone, \ |
8 | 6 | Label, Loop, If, Elif, Else, KeyPress, Ref, \ |
|
75 | 73 | scale_down=True, scale_box=(1000, 1000), debug=False, |
76 | 74 | Touch=False, local_crashlog=True, |
77 | 75 | cmd_traceback=False, data_dir=WRK_DIR, |
78 | | - working_dir=WRK_DIR, show_splash = False) |
| 76 | + working_dir=WRK_DIR, show_splash=False) |
79 | 77 | exp._code = '' |
80 | 78 | if CogBatt_config.WORKER_ID_SOURCE == 'EXECUTABLE': |
81 | 79 | retrieved_worker_id = retrieve_worker_id() |
|
97 | 95 | raise NotImplementedError |
98 | 96 |
|
99 | 97 | # get subject id odd or even to counterbalance CAB |
100 | | -flip_CAB = Func(sid_evenness, Ref.object(exp)._subject).result |
| 98 | +exp.FLIP_CAB = Func(sid_evenness, Ref.object(exp)._subject).result |
| 99 | +with If(exp.FLIP_CAB): |
| 100 | + exp.CAB_RESP_KEYS = {'old': AssBind_config.RESP_KEYS['new'], "new": AssBind_config.RESP_KEYS['old']} |
| 101 | +with Else(): |
| 102 | + exp.CAB_RESP_KEYS = {'old': AssBind_config.RESP_KEYS['old'], "new": AssBind_config.RESP_KEYS['new']} |
| 103 | + |
101 | 104 | # take next digit to counterbalance BART |
102 | | -flip_BART = Func(sid_evenness, Ref.object(exp)._subject, True).result |
| 105 | +exp.FLIP_BART = Func(sid_evenness, Ref.object(exp)._subject, True).result |
103 | 106 |
|
104 | 107 | with Parallel(): |
105 | 108 | with Serial(blocking=False): |
|
111 | 114 | email=version.__email__) |
112 | 115 | Wait(.5) |
113 | 116 | with If(Ref.object(exp).get_var('code_invalid')): |
114 | | - error_screen(error='Invalid task code: ' + Ref(str, exp._code), |
115 | | - message='You entered an incorrect task code, please double check the code ' |
116 | | - 'listed on the website and try again. If it still does not work ' |
117 | | - 'please contact Dylan Nielson through Prolific or at [email protected].' |
| 117 | + error_screen(error='Invalid combination of Worker ID and Code.', |
| 118 | + message='Please double check the Worker ID and Code ' |
| 119 | + 'and try again.' |
| 120 | + ' Be careful of errors in the Worker ID.' |
| 121 | + '\nYou entered: ' |
| 122 | + '\nWorker ID: ' + Ref.object(exp)._subject + |
| 123 | + '\n Code: ' + Ref.object(exp)._vars['_code'] + |
| 124 | + '\n\n If it still does not work ' |
| 125 | + 'please contact Dylan Nielson through Prolific.' |
118 | 126 | ) |
119 | 127 |
|
120 | 128 | with If(CogBatt_config.RUNNING_FROM_EXECUTABLE and (CogBatt_config.WORKER_ID_SOURCE != 'USER')): |
121 | 129 | # Handles case where retrieval of worker id fails |
122 | 130 | with If(exp.worker_id_dict['status'] == 'error'): |
123 | 131 | error_screen(error='Failed to Retrieve Identifier: ' + exp.worker_id_dict['content'], |
124 | | - message='Contact Dylan Nielson through Prolific or at [email protected]') |
| 132 | + message='Contact Dylan Nielson through Prolific.') |
125 | 133 | # Handles case where retrieval of worker id is default placeholder |
126 | 134 | with Elif((exp.worker_id_dict['content'] == CogBatt_config.WORKER_ID_PLACEHOLDER_VALUE) |
127 | 135 | and (CogBatt_config.API_BASE_URL != 'NOSERVER')): |
128 | 136 | error_screen(error='Non-Unique Identifier', |
129 | | - message='Contact Dylan Nielson through Prolific or at [email protected]') |
| 137 | + message='Contact Dylan Nielson through Prolific') |
130 | 138 | # Error screen for failed GET request to retrieve blocks |
131 | 139 | with If(exp.tasks_from_api['status'] == 'error'): |
132 | 140 | error_screen(error='Failed to retrieve tasks.', |
|
201 | 209 | unzip_dir=unzipdir, |
202 | 210 | sub_dir=Ref.object(exp)._subject_dir, |
203 | 211 | block=exp.block_number, |
204 | | - happy_mid=False, |
205 | | - flip_resp=flip_CAB) |
| 212 | + happy_mid=False) |
206 | 213 | with Elif(exp.task_name == "rdm"): |
207 | 214 | Wait(.5) |
208 | 215 | RDMExp(RDM_config, |
|
222 | 229 | sub_dir=Ref.object(exp)._session_dir, |
223 | 230 | practice=True, |
224 | 231 | task_dir=task2dir, |
225 | | - happy_mid=False, |
226 | | - flip_resp=flip_BART) |
| 232 | + happy_mid=False) |
227 | 233 |
|
228 | 234 | Wait(.5) |
229 | 235 |
|
|
306 | 312 | ' and click the "I have completed the tasks" button.' |
307 | 313 | '\n\n If you no longer have the page open, click on the task link' |
308 | 314 | ' from Prolific again to return to the webpage.' |
309 | | - '\n\n You wil be redirected to Prolific with your completion code.', |
| 315 | + '\n\n You wil be redirected to Prolific with your completion code.' |
| 316 | + '\n\n Press escape to close this window.', |
310 | 317 | text_size=(s(700), None), font_size=s(CogBatt_config.SSI_FONT_SIZE)) |
311 | 318 | with UntilDone(): |
312 | 319 | KeyPress() |
|
0 commit comments