![]() ![]() The two block-level loops have no condition files associated with them, but in the ‘nReps’ field of their properties box I’ve put a variable ‘nRepsblock1’ for block1 and ‘nRepsblock2’ for block2. The two blocks can contain any kind of (different) stimulus element one could have pictures, and one could have sounds, for instance – I’ve just put some simple text in each one for demo purposes. So, there are two blocks, each of which have their own loop, a ‘blockSelect’ routine, and a ‘blockSelectLoop’ enclosing the whole thing. I thought it was worth elaborating the solution on here somewhat, and I even created a simple little demo program which you can download and peruse/modify. ![]() You can in fact get PsychoPy to ‘skip’ routines in the flow panel, by the use of loops, and a tiny bit of coding magic. There’s a good reason for why this kind of functionality hasn’t been implemented it would make the builder interface much more complicated and the PsychoPy developers are (rightly) concerned with keeping the builder as clean and simple as possible.įortunately, there’s an easy little hack which was actually suggested by Jon Peirce (and others) on the PsychoPy users forum. Furthermore, you probably wouldn’t want to use the same sequence for every participant, so you’d have to laboriously build different versions with different sequences of the blocks. Building such a task would be very tedious, and more importantly, crashingly inelegant. There’s no easy way of doing this in the builder. In an experiment lasting 10 minutes one might have 40 15-second blocks, and the only way to produce the (psuedo-random) sequence you want is with 40 separate elements in the flow panel that all executed one-by-one (with no loops). have a sequence which goes ABCBCACAB…etc.). The problem arises when there are more than two block-types in your experiment, and you want to randomise them (i.e. For a simple two-condition-alternating experiment one could just produce routines for two conditions, and throw a loop around them for as many repeats as needed. They might be a ‘rest’ block (no stimuli) alternated with a visual stimulus, or two different kinds of stimuli, say, household objects vs. This is a slight issue for programming fMRI experiments that use block-designs. In block-design experiments, typically two (or more) blocks of about 15-20 seconds are alternated. This is an extremely powerful interface, but there’s no option to ‘skip’ part of the flow diagram – everything is run in the order in which it appears from left-to-right. The loops around parts of the flow panel indicate that the bits inside the loops are run multiple times (i.e. The experiment proceeds from left to right, and each part of the flow panel is executed in turn. ![]() One common use of conditional branching in psychology experiments is to repeat trials that the subject got incorrect for instance, one might want one’s subjects to achieve 90% correct on a block of trials before they continue to the next one, so the program would have something in it which said ‘if (correct trials > 90%) then continue to the next block, else if (correct trials < 90%) repeat the incorrect trials’.Īt the bottom of the PsychoPy builder is a time-line graphic (the ‘flow panel’) which shows the parts of the experiment: 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. 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. ![]()
0 Comments
Leave a Reply. |