-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f5333fe
Showing
95 changed files
with
23,072 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
from psychopy import visual, event | ||
import pickle | ||
import sys | ||
sys.path.append('..') | ||
from psychopytools import Buttons | ||
from ospanFuncs import extendMe, procRec, dispOp, dispTBR | ||
from sharedFuncs import genSpatialGrid, calcOpsDur, RecButtons, genTrials, dispInstructions, task, genInstructions, procVer | ||
|
||
|
||
################## | ||
#Parameters | ||
fname_stimDict = "ostims.pickle" | ||
letters = [["F", "H", "J"], | ||
["K", "L", "N"], | ||
["P", "Q", "R"], | ||
["S", "T", "Y"]] | ||
|
||
|
||
verPrompt = "" | ||
recPrompt = "Select the letters in order. Use the blank button to fill in forgotten letters." | ||
|
||
################## | ||
|
||
|
||
f1 = open(fname_stimDict, "r") | ||
stimDict = pickle.load(f1) | ||
f1.close() | ||
letters_flat = extendMe(letters) | ||
|
||
#INITIALIZE TRIALS | ||
trialStims = genTrials([6,6],1, stimDict, letters_flat) | ||
pracStims = genTrials([2], 2, stimDict, letters_flat) | ||
pracOps = genTrials([1], 10, stimDict, letters_flat) | ||
pracBoth = genTrials([2], 3, stimDict, letters_flat) | ||
win = visual.Window((1600, 1200), fullscr = False, color = "white", units = 'pix') | ||
myMouse = event.Mouse(win = win) | ||
instruct_dir = ('instructions/pracTBR', 'instructions/pracOp', 'instructions/pracBoth', 'instructions/pracDone') | ||
instructs = [genInstructions(win, fname) for fname in instruct_dir] | ||
## | ||
#GENERATE STIMULI | ||
#Response Grid | ||
nrow, ncol = 4,3 | ||
boxHght, boxWdth = 50, 50 | ||
textHght = boxHght - 15 | ||
Rpos, Rwdth, Rhght, Rtxt, ltrPos = genSpatialGrid(600,450,nrow,ncol, optWdth = 125, optHght = 50, optDist = 200, | ||
recWdth = boxWdth, recHght = boxHght, | ||
letters = True, gridPos = (0, 100)) | ||
|
||
RecScreen = RecButtons(win, Rpos, Rwdth, Rhght, Rtxt, | ||
txtKwargs = {"color": "black", "height": textHght}, | ||
lineColor = "black", fillColor = win.color, interpolate = False) | ||
|
||
Prompt = visual.TextStim(win, text = recPrompt, pos = (0, 450), color = "black") | ||
|
||
LetterStims = [] | ||
for row in range(nrow): | ||
for col in range(ncol): | ||
LetterStims.append(visual.TextStim(win, text = " " + letters[row][col], | ||
pos = ltrPos[ncol*row + col], | ||
alignHoriz = "left", | ||
height = textHght, | ||
color = "black")) | ||
|
||
#CREATE PROCEDURES | ||
#Processing task Stimulus | ||
OpStim = visual.TextStim(win, color = "black", height = textHght) | ||
dispOp = dispOp(win, OpStim) | ||
#Verification Screen | ||
VerText = visual.TextStim(win, text = verPrompt, color = "black", pos = (0, 150), height = textHght) | ||
Vwdth, Vhght = 100, 50 | ||
VerScreen = Buttons(win, | ||
[(-200 - Vwdth/2, 0), (200 - Vwdth/2, 0)], #pos | ||
[Vwdth]*2, #width | ||
[Vhght]*2, #height | ||
["True", "False"], #text | ||
txtKwargs = {"color":"black", "height" : textHght}, | ||
lineColor = "black", lineWidth = 5, interpolate = False, fillColor = "white") | ||
procVer = procVer(win, myMouse, TxtStim = VerText, VerScreen = VerScreen) | ||
#TBR | ||
TBRStim = visual.TextStim(win, color = "black", height = textHght) | ||
dispTBR = dispTBR(win, TBRStim, letters, color = 'black') | ||
#Recall | ||
procRec = procRec(win, myMouse, RecScreen, Prompt, LetterStims, letters) | ||
|
||
pars = dict(screenBlankInterval = .25, | ||
opsPracFeedbackTime = 1, | ||
TBRItemTime = .75, | ||
feedbackTime = 2, | ||
procRec = procRec, | ||
procVer = procVer, | ||
dispOp = dispOp, | ||
dispTBR = dispTBR) | ||
|
||
#RUN TASK | ||
#Introduction | ||
#Practice TBR Item and Recall | ||
#dispInstructions(win, myMouse, instructs[0]) | ||
#task(win, myMouse, pracStims, kwargs_dict, opsDur = 60, TBROnly = True, **pars) | ||
#Practice Ops and calc ops duration | ||
dispInstructions(win, myMouse, instructs[1]) | ||
task(win, myMouse, pracOps, opsDur = 60, opsOnly = True, opsFeedback = True, **pars) | ||
RTs = [trial['op.RT.W'][0] for trial in pracOps.trialList] #get RTs for practice ops | ||
print RTs | ||
opsDur = calcOpsDur(RTs, trimNum = 2) | ||
print opsDur | ||
##Practice both | ||
dispInstructions(win, myMouse, instructs[2]) | ||
task(win, myMouse, pracBoth, opsDur = opsDur, **pars) | ||
##Actual Task | ||
dispInstructions(win, myMouse, instructs[3]) | ||
task(win, myMouse, trialStims, opsDur = opsDur, **pars) | ||
win.close() | ||
#Save Data | ||
trialStims.saveAsWideText('data/testout.tsv') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import random | ||
import pickle | ||
|
||
def genMathOps(multDig1, multDig2, divDig1, divDig2, add, sub): | ||
multDivList = ["%s * %s"%(ii,jj) for ii in multDig1 for jj in multDig2 if ii != jj] #diff multipliers | ||
multDivList.extend(["%s / %s"%(ii,jj) for ii in divDig1 for jj in divDig2 if (ii%jj == 0)]) #must divide evenly | ||
arith = [" + %s"%ii for ii in add] | ||
arith.extend([" - %s"%ii for ii in sub]) | ||
Ops = [(muldiv + adsub) for muldiv in multDivList for adsub in arith #keep those that >= 0 | ||
if eval(muldiv + adsub) >= 0] | ||
opsList = [] | ||
for op in Ops: | ||
#Solutions | ||
corr = random.randint(0,1) | ||
adjust = random.randint(1, 5)*(-1**random.randint(0,1)) #to add or subtract to ans | ||
ans = eval(op) + (not corr) * adjust #if correct don't adjust | ||
while ans < 0: | ||
adjust = random.randint(1, 5) #re-adjust (there will likely be more additions than subtractions as a result) | ||
ans = eval(op) + adjust | ||
opsList.append([op, (ans, bool(corr))]) | ||
|
||
|
||
|
||
return opsList | ||
|
||
ranges = [range(1,10)]*6 | ||
stimDict = genMathOps(*ranges) #1 through 9 for each | ||
|
||
|
||
fname_storage = "ostims.pickle" | ||
f1 = open(fname_storage, "w") | ||
pickle.dump(stimDict, f1) | ||
f1.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Now you will practice doing both parts of the experiment at the same time. | ||
|
||
In the next practice set, you will be given one of the math problems. Once you make your decision about the picture, a square will appear on the screen. Try and remember the letter. | ||
|
||
In the previous section where you only solved math problems, the computer computed your average time to solve the problems. If you take longer than your average time, the computer will automatically move you onto the letter part, thus skipping the True or False part and will count that problem as a math error. | ||
Therefore it is VERY important to solve the problems as quickly and as accurately as possible | ||
|
||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
After the square goes away, another math problem will appear, and then another letter. | ||
|
||
At the end of each set of letters and math problems, a recall screen will appear. Use the mouse to select the letters you just saw. Try your best to get the letters in the correct order. | ||
|
||
It is important to work QUICKLY and ACCURATELY on the math. Make sure you know the answer to the math hproblem before clicking to the next screen. | ||
|
||
|
||
You will not be told if your answer to the math problem is correct. | ||
|
||
After the recall screen, you will be given feedback about your performance regarding both the number of letters recalled and the percent correct on the math problems. | ||
|
||
|
||
|
||
Do you have any questions? | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
During the feedback, you will see a number in red in the top right of the screen. | ||
|
||
This indicates your percent correct for the math problems for the entire experiment. | ||
|
||
It is VERY important for you to keep this at least at 85%. | ||
|
||
For our purposes, we can only use your data if you are at least 85% accurate on the math. | ||
|
||
Therefore, in order for you to be asked to come back for future experiments, you must perform at least at 85% on the math problems problems WHILE doing your best to recall as many letters as possible. | ||
|
||
Do you have any questions? | ||
|
||
Click the mouse to try some practice problems. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
That is the end of the practice. | ||
|
||
The real trials will look just like the practice trials you just completed. | ||
|
||
Some sets will have more problems than others. | ||
|
||
It is important that you do your best on both the symmetry and the square parts of this experiment. | ||
|
||
|
||
Also, remember to keep your symmetry accuracy at 85% or above. | ||
|
||
Do you have any questions? If not, click the mouse to begin the experiment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Now you will practice doing the math part of the experiment. | ||
|
||
A math problem will appear on the screen, like this: | ||
|
||
(2 * 1) + 1 = ? | ||
|
||
As soon as you see the math problem, you should compute the correct answer. | ||
|
||
In the above problem, the answer 3 is correct. | ||
|
||
When you know the correct answer, you will click the mouse button. | ||
|
||
|
||
|
||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
Notice that this picture is symmetrical about the red line. | ||
|
||
In the real pictures the red line will not be present. | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
Here, the picture is NOT symmetrical. | ||
|
||
If you folded this across the red line, the boxes would NOT line up. | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
This is another example of a picture that IS symmetrical. | ||
|
||
If you folded it vertically, the two sides would line up. | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
|
||
Here is another example of a picture that is NOT symmetrical. | ||
|
||
Notice that if folded, the two sides would not line up. | ||
|
||
If you have any questions about how symmetry works, please ask them now. | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
You will see a number displayed on the next screen, along with a box marked TRUE and a box marked FALSE. | ||
|
||
If the number on the screen is the correct answer to the math problem, click on the TRUE box with the mouse. | ||
|
||
If the number is not the correct answer, click on the FLASE box. | ||
|
||
For example, if you see the problem | ||
(2 * 2) + 1 = | ||
and the number on the following screen is 5 | ||
click the TRUE box, because the answer is correct. | ||
|
||
If you see the problem | ||
(2 * 2) + 1 = ? | ||
and the number on the next screen is 6 | ||
click the FALSE box, because the correct answer is 5, not 6. | ||
|
||
After you click on one of the boxes, the computer will tell you if you made the right choice. | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
It is VERY important that you get the math problems correct. It is also important that you try and solve the problem as quickly as you can. | ||
|
||
|
||
Do you have any questions? | ||
|
||
|
||
|
||
|
||
When you are ready, click the mouse to try some practice problems. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
In this experiment you will try to memorize letters you see on the screen while you also solve simple math problems. | ||
|
||
In the next few minutes, you will have some practice to get you familiar with how the experiment works. | ||
|
||
We will begin by practicing the letter part of the experiment. | ||
|
||
Click the mouse to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
For this practice set, letters will appear on the screen one at a time. | ||
|
||
Try to remember each letter in the order it was presented in. | ||
|
||
After 3 to 7 letters have been shown, you will see a screen listing 12 possible letters with a check box beside each one. | ||
|
||
Your job is to select each letter in the order presented. To do this, use the mouse to select the appropriate box beside each letter. The letters you select will appear at the bottom of the screen. | ||
|
||
|
||
Click the mouse button to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
When you have selected all the letters, and they are in the correct order, hit the EXIT box at the bottom right of the screen. | ||
|
||
If you make a mistake, hit the CLEAR box to start over. | ||
|
||
If you forget one of the letters, click the BLANK box to mark the spot for the missing letter. | ||
|
||
Remember, it is very important to get the letters in the same order as you see them. If you forget one, use the BLANK box to mark the position. | ||
|
||
Do you have any questions so far? | ||
|
||
When you're ready, click the mouse button to start the letter practice. |
Oops, something went wrong.