From b3e295d70f38ba01dc0724b981b981ecb830691d Mon Sep 17 00:00:00 2001 From: yanina-prystauka Date: Tue, 10 Oct 2017 12:10:03 -0400 Subject: [PATCH 1/2] sync --- wordTask_psychopy/word_task.py | 17 +++++++++-------- wordTask_psychopy/word_task.pyc | Bin 3455 -> 3415 bytes 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/wordTask_psychopy/word_task.py b/wordTask_psychopy/word_task.py index 4dfc316..f40cac4 100755 --- a/wordTask_psychopy/word_task.py +++ b/wordTask_psychopy/word_task.py @@ -42,7 +42,7 @@ font = "Arial", autoLog=True) -instruct_txt = visual.TextStim(win, text = " In this experiment you will be reading words.\n Please, read them carefully.\n Press the space bar when you are ready to continue.", +instruct_txt = visual.TextStim(win, text = " In this experiment you will be reading words.\n Please read them carefully.\n Press the button when you are ready to continue.", pos = [0.0,0.0], color = "black", height = 24, @@ -53,7 +53,7 @@ autoLog=True) #get some startup information from the user -info = {'participant_id':'', 'session': '1'} +info = {'participant_id':'', 'session': ''} dlg = gui.DlgFromDict(info, title = 'Word Task Startup') if not dlg.OK: core.quit() @@ -66,7 +66,7 @@ #win.logonFlip(msg=' ', level=logging.DATA) # in the data source, there are three columns: Time, StimType and Stim # load in our stimulus timing xlsx file -TRIAL_LIST = data.importConditions(fileName = parent_dir + "RunTest.xlsx") +TRIAL_LIST = data.importConditions(fileName = parent_dir + "Run" + info['session'] + ".xlsx") totalTrials = len(TRIAL_LIST) def check_exit(): @@ -92,7 +92,8 @@ def check_exit(): #creating variable for flip duration flip_duration= 21 # header for data log -data = np.hstack(("Stim","StimType","onset")) +#data = np.hstack(("Stim","StimType","onset")) +data = [0,0] # Goal for this section: Check what time it is. If the time matches a value in the column "Time" # then present the text display from that same row for 1.25 seconds and then go back to blank for index in range(len(TRIAL_LIST)): @@ -123,13 +124,13 @@ def check_exit(): logging.log("Datalog.log",level=logging.EXP) win.logOnFlip("Datalog.log",level=logging.EXP) onset = globalClock.getTime() - core.wait(1.25-(globalClock.getTime()-onset)) + core.wait(1.0-(globalClock.getTime()-onset)) null_txt.draw() win.flip() onset = globalClock.getTime() - core.wait(1.25-(globalClock.getTime()-onset)) + core.wait(1.5-(globalClock.getTime()-onset)) # store data into the numpy array - data = np.vstack((data, np.hstack((TRIAL_LIST[index]["Stim"],TRIAL_LIST[index]['StimType'],onset,))))# round the onset time (in seconds) to the third decimal place + data = np.vstack((data, np.hstack((TRIAL_LIST[index]['StimType'],onset,)))) #clear screen null_txt.draw() win.flip() @@ -141,7 +142,7 @@ def check_exit(): ### SAVE DATA ### np.savetxt(parent_dir+prefix+"_onsets.tsv", - data, fmt='%s', delimiter='\t', newline='\n', + data, fmt='%f', delimiter='\t', newline='\n', header='', footer='', comments='# ') # close everything win.close() diff --git a/wordTask_psychopy/word_task.pyc b/wordTask_psychopy/word_task.pyc index c744dddc95f89efd8e284d9e690cd2de2e4e6781..99555d0c397eeee713d2219ba750c3986d335700 100644 GIT binary patch delta 621 zcmZuuO-~b16g_vQE$wuW5Q6=HSfU0Nq?HO&DyXfBx-iiYNq{DVAoqey1B#s(Tqp|? zSM1)uaA)`#ZcJRTVQ*q$V&cXP(L2*hN%ZA?ocrE+=broC@BDFo*#6n;q(6OGUPq@5 z>RQ*)I*olC{%q~@b!gwT&`4l!pQH#GffR5+VV_%RQlkX9j01r7W*}GLUkd{nM^W6b;rZ0RyMJvpJe+0kdi6{?R+x``cL_Jn72_eB4ULKezXC}h1k-0e zXOI&Q8&>!v?O9)I_q%x?D=lfEv;R}-)}c~WNE(tyhHoOH@_Y+?8(ag|!FRxS!S}!g z@LV+C2R|@w{1QDp8jnxf^vJ9xi&n904wLT+3tQW=+5XKRwGMb(4`RCYG}ziU^;D+s zS1m|(;)ORa#Vn_;(1v-Nnm_uQ`bOp?{bVSJE8)dXOM)Pw=yfYtTW?12xv99L=W~vj c5ALC5yQbP(zBpky2o5623o8G5TWIQ4G@DNR0kNuGr+D`W?tcQ{`v#xkVH7Hk z--NX05_B!KB5D<@wjpKJGE(^3_-ZZdw3E@Voou@dJo#7e1E+ZY60%a2r@+(T8SrKB z74R&04qOCZJ(Ba_Yx<{iifa3X*sx7Cz37(ob9Xy`GkUllx$hC+QmvFO|Kyi_t`Kty;Pz5g!pnY_689)!`ol{Nh~xsY5ciyawf kL#I+_kNfuO7pYg4mDcTTgIyDrN1i#9C(rI6pE|`l1O;Mw)Bpeg From 022e32f9a13c15833ec4fbb44b0a85de5ba05083 Mon Sep 17 00:00:00 2001 From: yanina-prystauka Date: Wed, 11 Oct 2017 20:03:06 -0400 Subject: [PATCH 2/2] fix instructions, file upload, onset timing --- wordTask_psychopy/word_task.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wordTask_psychopy/word_task.py b/wordTask_psychopy/word_task.py index f40cac4..4a55d59 100755 --- a/wordTask_psychopy/word_task.py +++ b/wordTask_psychopy/word_task.py @@ -11,7 +11,7 @@ # info about the screen win = visual.Window(size = [1280,768], color = "white", - fullscr = False, + fullscr = True, allowGUI=False, units = "pix") # Set up text displays @@ -83,6 +83,7 @@ def check_exit(): win.flip() #waiting for space bar to continue keys =event.waitKeys(keyList=['space'], timeStamped=globalClock) +check_exit() #show waiting for scanner until keypress ScannerWait_txt.draw() win.flip() @@ -121,16 +122,17 @@ def check_exit(): autoLog=True) stim.draw(); win.flip() + onset = globalClock.getTime() logging.log("Datalog.log",level=logging.EXP) win.logOnFlip("Datalog.log",level=logging.EXP) - onset = globalClock.getTime() + onset_tr = onset - t0 core.wait(1.0-(globalClock.getTime()-onset)) null_txt.draw() win.flip() onset = globalClock.getTime() core.wait(1.5-(globalClock.getTime()-onset)) # store data into the numpy array - data = np.vstack((data, np.hstack((TRIAL_LIST[index]['StimType'],onset,)))) + data = np.vstack((data, np.hstack((TRIAL_LIST[index]['StimType'],onset_tr,)))) #clear screen null_txt.draw() win.flip()