Re: help with creating random assignment to conditions !

261 views
Skip to first unread message

drkitty

unread,
Feb 19, 2013, 10:02:28 AM2/19/13
to psychop...@googlegroups.com
So, you want the subject to press "space" in order that the subject be randomly assigned to one of two conditions? In Builder I'd create a routine (call it "Condition"), with a conditions file that had 2 entries: condA.csv, condB.csv. The csv files will have the info about condA or condB where the subject is making the choice between options after being assigned to condA or condB. Put a loop around that routine (call it "pickCondition") with 0 repetitions, and random selection.  That should work.

On Tuesday, February 19, 2013 7:04:10 AM UTC-5, Michael Zoltak wrote:
Hi all!

I'm fairly new to PsychoPy and completely without experience in python. I basically need to create an experiment where participants after pressing SPACE are randomly assigned to two experimental conditions. In each of these they need to provide an answer (key press) from available 2 options. This does not have to be repeated. 

Any hints? I appreciate all help provided! Thanks!

Michael

Jared Roberts

unread,
Feb 19, 2013, 11:00:51 AM2/19/13
to psychop...@googlegroups.com
Hi Michael,

I'm not sure if you're looking for a builder solution or a coder solution.  I don't really use the builder myself, but I can hopefully point you in the right direction if you're looking to code something up.

It depends on the type of random assignment you want.  If you want absolutely random assignment all you need to do is import random and make a call to random.randint(0,1).  That's basically a coin flip.  However, it may be more useful to create a randomized counterbalanced list, store it off in a file, then reference it later.   I've written code to to do that here:  http://pastebin.com/eehbg1vX.  This is just using standard python calls to create files.  I know that psychopy has some way of handling file I/O, but I haven't used it. 

As for the rest of the experiment, I posted code for a basic forced choice experiment not too long ago.  It should be a good starting point.  You can find it here:  http://pastebin.com/0Xmvg7iM

I hope it helps!
-Jared



--
Jared Roberts
Graduate Student
The Yassa Learning and Memory Laboratory
Johns Hopkins University
"A lost cause can be as spiritually satisfying as a victory." - Robert Heinlein
Reply all
Reply to author
Forward
0 new messages