Essentially the program says, ‘if A is true: do X, otherwise (or ‘else’ in programming jargon) if B is true do Y’. which branch to follow) based on some value or ‘condition’. A ‘conditional branch’ is where the computer decides what to do out of two of more alternatives (i.e. In programming logic, a ‘branch’ is a point in a program which causes the computer to start executing a different set of instructions. The PsychoPy ‘builder’ interface (a generally brilliant, friendly, GUI front-end) does have one pretty substantial drawback though it doesn’t support conditional branching. I’ve been using it a lot recently, and I’m happy to report my initial ardour for it is still lambently undimmed. i.e.Regular readers will know that I’m a big fan of PsychoPy, which (for non-regular readers *tsk*) is a piece of free, open-source software for designing and programming experiments, built on the Python language. So we should also reset the wp_response variable at the start of the routine, as you already do for rt_list. This was actually a useful bug to arise, because it also highlights that if the routine was skipped, the reaction times for that trial might still be saved, simply because the wp_response variable still exists from a previous run of the routine. So we should tidy up that “end routine” code, something like this: if run_secondary_task: # now only execute the following code conditionally So we should make the code in that “end routine” tab conditional too. This will be an issue because in that case, as the routine itself didn’t run, neither did the “every frame” code, and so the variable wp_response never got created. the routine is skipped) the “end routine” code will still execute. I think the issue is that if the secondary task doesn’t run (i.e. Oops, OK, that helped make a possible issue obvious. ThisExp.addData('wordproblem_rts', rt_list) ThisExp.addData('wordproblem_correct', 'False') GainsThisBlock = gainsThisBlock - 5 # minus 5 points for an incorrect answer ThisExp.addData('wordproblem_correct', 'True') GainsThisBlock = gainsThisBlock + 5 # 5 points for a correct answer If answer = corrAns: # corrAns refers to the correct answer to the word problem, can be any key If wp_response: # must allow for multiple key presses Is it possible to isolate the rt by each key press?īegin Routine: if not run_secondary_task:Įach Frame: # check the keyboard queue for events: This is similar to what I have for time recording in the primary task. ThisExp.addData('wordproblem_correct', 'N/A') GainsThisBlock = gainsThisBlock - 5 # minus 5 points for no response ThisExp.addData('wordproblem_rt', t) #rt for entire trial I checked my output files and they look fine.Īnyway, this is what I have in my End Routine tab for the secondary task: if wp_response: The code you posted works perfectly! Just a quick question Would you recommend inserting event.clearEvents() in the Begin Routine tab of the secondary task to make sure the program isn’t counting previous key presses as responses to the task? I did so for the primary task (the math problems) since pressing c, ,i, or ‘y’ even when there was no stimuli present resulted in each key press being counted, but I just want to be sure this won’t have any other consequences on how they are recorded. I see, thank you for taking the time to break it down like that.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |