Why I Write Code for Research
We study human beings. When they come to the lab, they are besieged by emotions. People with Parkinson’s disease (PD) want to hide their symptoms. Young healthy participants want to follow instructions perfectly, so that their data can help understand and treat neurologic symptoms.
These emotions can confound our studies. When we think too much or worry too much about how we move, our movements can become unusual. We are interested in how the motor system operates, separately from the influence of emotion and cognition.
The motor tasks we design should therefore ideally be impervious to thoughts and emotions. To this end, we spend considerable time and energy designing lab tasks that are as resistant as possible to cognitive factors like misunderstanding instructions, and emotional factors like the desire to do well.
Writing my own software for experiment control has been part of this aspect of experimental design. It allows me to design a user experience that automatically guides the participant through the task with minimal need for instruction. By making the task fun, like a videogame, I try to distract participants from thinking too much about what they are doing, and from potentially feeling embarrassed about their motor difficulties.
I chose a hardware platform (Mac) and programming language (the language previously known as Realbasic) that make particularly easy to focus on the user interface and create a visually and sonically appealing task workspace. The goal is for the participant to sit at the testing station and be drawn in. In a typical reaching task, for example, they see a cursor that shows their hand’s position; they see brightly colored shapes that seem to be inviting the cursor toward them; and they hear rich, informative sounds when things happen (a gentle gong sound when a target appears; a typewriter click when they hit a large, easy target; a xylophone major chord when they hit a small, difficult target).
The ongoing translation of our code to an open-source, Python-based environment will preserve an emphasis on the participant’s experience, but will allow easier integration with collaborators’ code for experimental control and real-time data visualization.
Like many motor control scientists, I write various pieces of software for laboratory studies. The main categories are software to control devices for data acquisition, and software for data analysis. Examples include programs that to read hand position from a motion capture device and use it to update the position of a screen cursor. A motor task can then be designed in which a research participant plays a simple video game designed to test hypotheses about motor control (e.g., what happens if the cursor is suddenly made to disappear in the middle of a movement). Examples of data anlysis software include routines to preprocess motion capture data and to calculate quantities that characterize motor performance, like speed and accuracy.
Most of this software is written in relatively specialized languages, like Realbasic and Igor, and has thus not been amenable to sharing with other researchers. A research engineer on our team, Dimitre Tomov, is now translating our code for data collection and analysis to Python, so that we may contribute to and benefit from collaborative efforts by the open-source community.