Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# the executable is prepared for distribution.
WORKER_ID_PLACEHOLDER_VALUE = '"------------------------------------------------".---------------------------'
EXP_NAME = "SUPREMEMOOD"
TASKGET_TRIES=3

BACKGROUND_COLOR = (.35, .35, .35, 1.0)

Expand Down
3 changes: 3 additions & 0 deletions custom_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def InputSubject(self):
background_normal="",
background_color=INFO_OUTLINE_COLOR,
disabled=True)
esc_lbl = Label(text="Press 'Shift' + 'Esc' if you need to exit this screen.", center_x=recin.center_x,
top=recin.bottom - s(10),
font_size=s(INFO_FONT_SIZE))
with Serial():
with While(
(Ref.object(codeIn.text).__len__() < 4)
Expand Down
2 changes: 1 addition & 1 deletion error_screen.py

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to move the error box down a little bit to make more room for some of my more verbose error messages.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@Subroutine
def error_screen(self, error, message):
with BoxLayout(orientation='vertical', spacing=20):
with BoxLayout(orientation='vertical', spacing=20, pos=[self.exp.screen.width/2, self.exp.screen.height/4]):
Label(name="error_details",
text=error,
text_size=(scale(700), None), font_size=scale(SSI_FONT_SIZE),
Expand Down
39 changes: 23 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# General imports
import os
import sys
from pathlib import Path
from hashlib import blake2b
# Smile imports
from smile.common import Experiment, Log, Wait, Func, UntilDone, \
Label, Loop, If, Elif, Else, KeyPress, Ref, \
Expand Down Expand Up @@ -75,7 +73,7 @@
scale_down=True, scale_box=(1000, 1000), debug=False,
Touch=False, local_crashlog=True,
cmd_traceback=False, data_dir=WRK_DIR,
working_dir=WRK_DIR, show_splash = False)
working_dir=WRK_DIR, show_splash=False)
exp._code = ''
if CogBatt_config.WORKER_ID_SOURCE == 'EXECUTABLE':
retrieved_worker_id = retrieve_worker_id()
Expand All @@ -97,9 +95,14 @@
raise NotImplementedError

# get subject id odd or even to counterbalance CAB
flip_CAB = Func(sid_evenness, Ref.object(exp)._subject).result
exp.FLIP_CAB = Func(sid_evenness, Ref.object(exp)._subject).result
with If(exp.FLIP_CAB):
exp.CAB_RESP_KEYS = {'old': AssBind_config.RESP_KEYS['new'], "new": AssBind_config.RESP_KEYS['old']}
with Else():
exp.CAB_RESP_KEYS = {'old': AssBind_config.RESP_KEYS['old'], "new": AssBind_config.RESP_KEYS['new']}

# take next digit to counterbalance BART
flip_BART = Func(sid_evenness, Ref.object(exp)._subject, True).result
exp.FLIP_BART = Func(sid_evenness, Ref.object(exp)._subject, True).result

with Parallel():
with Serial(blocking=False):
Expand All @@ -111,22 +114,27 @@
email=version.__email__)
Wait(.5)
with If(Ref.object(exp).get_var('code_invalid')):
error_screen(error='Invalid task code: ' + Ref(str, exp._code),
message='You entered an incorrect task code, please double check the code '
'listed on the website and try again. If it still does not work '
'please contact Dylan Nielson through Prolific or at Dylan.Nielson@nih.gov.'
error_screen(error='Invalid combination of Worker ID and Code.',
message='Please double check the Worker ID and Code '
'and try again.'
' Be careful of errors in the Worker ID.'
'\nYou entered: '
'\nWorker ID: ' + Ref.object(exp)._subject +
'\n Code: ' + Ref.object(exp)._vars['_code'] +
'\n\n If it still does not work '
'please contact Dylan Nielson through Prolific.'
)

with If(CogBatt_config.RUNNING_FROM_EXECUTABLE and (CogBatt_config.WORKER_ID_SOURCE != 'USER')):
# Handles case where retrieval of worker id fails
with If(exp.worker_id_dict['status'] == 'error'):
error_screen(error='Failed to Retrieve Identifier: ' + exp.worker_id_dict['content'],
message='Contact Dylan Nielson through Prolific or at Dylan.Nielson@nih.gov')
message='Contact Dylan Nielson through Prolific.')
# Handles case where retrieval of worker id is default placeholder
with Elif((exp.worker_id_dict['content'] == CogBatt_config.WORKER_ID_PLACEHOLDER_VALUE)
and (CogBatt_config.API_BASE_URL != 'NOSERVER')):
error_screen(error='Non-Unique Identifier',
message='Contact Dylan Nielson through Prolific or at Dylan.Nielson@nih.gov')
message='Contact Dylan Nielson through Prolific')
# Error screen for failed GET request to retrieve blocks
with If(exp.tasks_from_api['status'] == 'error'):
error_screen(error='Failed to retrieve tasks.',
Expand Down Expand Up @@ -201,8 +209,7 @@
unzip_dir=unzipdir,
sub_dir=Ref.object(exp)._subject_dir,
block=exp.block_number,
happy_mid=False,
flip_resp=flip_CAB)
happy_mid=False)
with Elif(exp.task_name == "rdm"):
Wait(.5)
RDMExp(RDM_config,
Expand All @@ -222,8 +229,7 @@
sub_dir=Ref.object(exp)._session_dir,
practice=True,
task_dir=task2dir,
happy_mid=False,
flip_resp=flip_BART)
happy_mid=False)

Wait(.5)

Expand Down Expand Up @@ -306,7 +312,8 @@
' and click the "I have completed the tasks" button.'
'\n\n If you no longer have the page open, click on the task link'
' from Prolific again to return to the webpage.'
'\n\n You wil be redirected to Prolific with your completion code.',
'\n\n You wil be redirected to Prolific with your completion code.'
'\n\n Press escape to close this window.',
text_size=(s(700), None), font_size=s(CogBatt_config.SSI_FONT_SIZE))
with UntilDone():
KeyPress()
Expand Down
Loading
Loading