Friday, February 15, 2013

how to build a psychophysics experiment

You wouldn't know it from my CV (unless you look at the conference presentations), but I've built dozens of psychophysics experiments in my nearly 10 years in the field. I've developed a routine:

1. First, design the planned trial algorithm; how will the stimulus vary from trial to trial? What kind of responses will be collected, and how will they drive the stimulus variation? Staircases and step sizes, interleaved and latticed. In my mind, I always imagine the algorithm as a gear train driving the stimulus presentation, like the mechanism behind the turning hands on a clock. Here, a model observer is usually set up, if I can figure out what one should look like, to help test the algorithm.

2. With the first step still in progress, set up the actual trial loop and use it to test the basics of the stimulus presentation and internal trial structure, with a dummy response. Usually this part is already there, in a previous experiment, so this step usually consists of taking an old experiment and stripping most of the parts out. The trial loop and its internal structure constitute another gear train, really the interface of the experiment: the stimulus and other intervals and features (sounds, fixation points, ISIs), response intervals and valid buttons, and proper timing etc.

3. The trial algorithm should be settling by now. I start to plug it into the trial loop like this: port over the algorithm, but don't connect it to the stimulus train just yet. Instead, start to work out the finer details of the stimulus presentation with the algorithm in mind. That is, if the algorithm is like a set of gears to transmit variation through the stimulus, we have to make sure that the teeth on the stimulus gear mesh with the teeth on the output gear of the algorithm. And, the input gear to the algorithm has to mesh with the response gear. It's easiest to do this, for me, if I first design the algorithm and set it in place so that I can look at it while I finish the design of the interface.

As the algorithm is being set in place, I'll usually simultaneously start setting up the method for writing the data down. This really constitutes a third little mechanism, an output mechanism outside the big algorithm-trial loop, which records everything about the completed trial up to the response, but before the response moves the algorithm train.

4. Finally, the algorithm and the trial structure get linked together, not without a few mistakes, and the whole machine can be tested. Usually it takes a few debugging runs to find all the gears that have been put on backwards, or connected in the wrong place, or left out completely.

I think that these stages, in this order, are what I have been following for at least five years now, and it seems to work pretty well. There are parts of the skeletons of most of my experiments over the past 3 years that are nearly identical; I think that the for V = 1:Trials statement, and the closeout statements at the end of that loop, have survived through a dozen completely different experiments. The other 99% changes, though some parts are common over many different scripts.

Another thing that's constant is the way I feel when I build these things: I really feel like I'm building a machine. It's the same feeling as when I was a kid and I'd take apart a clock or a motor or a fishing reel and try to put it back together, usually failing because I didn't understand at the beginning, when I took it apart, how it actually worked (I became a scientist, not an engineer). But now, since I'm designing it, I can see where the big wheels contain the little wheels, where there are little clusters of gears connected to other clusters, transmitting motion through the whole thing. I can see how exactly the same thing, the same device underlying the experiment, could be built with gear trains and springs and chains and switches and punched tape (for the random trial order). I should make an illustration one of these days...

Anyways, that's how you do it!

No comments:

Post a Comment