Elsevier

Journal of Neuroscience Methods

Volume 174, Issue 2, 30 September 2008, Pages 245-258
Journal of Neuroscience Methods

A flexible software tool for temporally-precise behavioral control in Matlab

https://doi.org/10.1016/j.jneumeth.2008.07.014Get rights and content

Abstract

Systems and cognitive neuroscience depend on carefully designed and precisely implemented behavioral tasks to elicit the neural phenomena of interest. To facilitate this process, we have developed a software system that allows for the straightforward coding and temporally-reliable execution of these tasks in Matlab. We find that, in most cases, millisecond accuracy is attainable, and those instances in which it is not are usually related to predictable, programmed events. In this report, we describe the design of our system, benchmark its performance in a real-world setting, and describe some key features.

Introduction

Interesting neural data are often the products of well-designed, psychophysically-rigorous behavioral paradigms. The creation and execution of these behavioral tasks relies upon a small range of applications that run on a relatively narrow range of software and hardware (Hays et al., 1982, White et al., 1989–2008, Ghose et al., 1995, Maunsell, 2008). The strengths and weakness of each application reflect the types of behaviors studied at the time of their initial development. Too often, the transition towards different types of behavioral tasks strains the flexibility of these programs, and cumbersome workarounds layer successively upon one another.

Recently, however, the performance of even a higher-level programming environment, specifically Matlab, has been demonstrated to be adequate for behavioral control at the 1 ms time-scale (Meyer and Constantinidis, 2005, Asaad and Eskandar, 2008). Thus, although no software running on Windows can attain truly deterministic, hard-real-time performance (Ramamritham et al., 1998), such software can nevertheless deliver high (not perfect) temporal reliability. Given those data, we now focus on the design, real-world performance, and usability such a system can achieve.

In particular, we sought to harness the Matlab high-level programming environment to allow the quick and efficient coding behavioral tasks. By creating a system that has minimal programming overhead, we hoped to allow users to focus on the essential features of experimental design and the basic elements of behavioral control and monitoring rather than on the often arcane details of the video presentation and data acquisition hardware. Our major goals were:

  • To allow behavioral control with high temporal precision in Matlab.

  • To allow straightforward scripting of behavioral tasks using standard Matlab syntax and functions.

  • To interface transparently with data acquisition hardware for input / output functions, such as eye-signal, joystick and button-press acquisition, reward delivery, digital event marker output, as well as analog and TTL output to drive stimulators and injectors.

  • To allow the full reconstruction of task events from the behavioral data file by including complete descriptions of behavioral performance, the event markers and their text labels, the task structure, and the actual stimulus images used; as a demonstration of this goal, to allow the re-playing of any given trial from the behavioral data file alone.

  • To provide the experimenter with an information-rich display of behavioral performance and to reflect task events in real-time to aid the assessment of on-going behavior.

Section snippets

Materials and methods

Our tested system was composed of a Dell Computer with a Pentium Core 2 Duo processor (model 6300) running at 1.86 GHz and containing 1 GB of RAM (Dell Inc., Round Rock, TX). The operating system was Microsoft Windows XP, service pack 2 (Microsoft, Redmond, WA). The graphics hardware in this machine consisted of an nVidia Quadro NVS 285 with 256 MB of video RAM. Output from this dual-headed graphics card was split to two subject displays running in full-screen mode at pixel resolutions of 800 × 600,

Results

First we describe the basic design strategy of the software and the potential strengths and weaknesses of our approaches. We then examine the temporal performance of the software, specifically in the context of an actual behavioral task (rather than as in the more abstract tests described in Asaad and Eskandar, 2008). Finally we describe some features intended to enhance usability.

Design

The interactive structure of any behavioral task is defined by only two main activities: stimulus presentation and behavioral monitoring (corresponding to input and output, from the perspective of the subject). As such, our software is designed to facilitate these two activities by providing one function corresponding to each.

Stimulus presentation consists of the activation or inactivation of inputs to the subject that are intended to drive or constrain behavior and/or neural activity. Stimuli

General performance

At the beginning of each trial, functions such as toggle and track are initialized with information regarding the memory addresses of the video buffers containing the current trial's stimuli, and with the latest DAQ assignments and calibrations. In addition, data logging is initiated on the DAQ that is set to acquire data to memory. These events took 0.11 ms, at maximum, as shown in Table 1.

At the end of each trial, the logged analog data and a record of time-stamps is retrieved before returning

Discussion

Being unsatisfied with currently available options for behavioral control, we sought to develop a high-level software system that simplifies task design and execution while maintaining a high degree of temporal precision. Matlab turned out to be an excellent platform for this project, as the timing constraints could be met while providing the user access to the simplicity and flexibility of that environment. Nevertheless, there are notable limitations.

Windows cannot support hard real-time

Acknowledgements

The authors thank David Freedman, Tim Buschman, Camillo Padoa-Schioppa, Valerie Yorgan, Markus Siegel, and John Gale for contributions to the software, beta testing, and helpful discussions. We also thank Jeffrey Perry for making the low-level graphic drivers publicly available and for helpful advice regarding their implementation. Anne-Marie Amacher, Ming Cheng, Jason Gerrard, Rollin Hu, Earl Miller, Andrew Mitz and Ziv Williams are appreciated for offering useful ideas for program testing and

References (11)

There are more references available in the full text version of this article.

Cited by (113)

  • Cognitive strategies shift information from single neurons to populations in prefrontal cortex

    2022, Neuron
    Citation Excerpt :

    Subjects sat head-fixed in a primate chair and viewed a computer screen. MonkeyLogic software (Asaad and Eskandar, 2008) controlled the behavior interface and subjects’ eye movements were tracked with an infrared camera (ISCAN). Subjects each had two circular recording chambers (Crist instrument, Inc.) situated over the bilateral prefrontal cortex.

  • History-dependent dopamine release increases cAMP levels in most basal amygdala glutamatergic neurons to control learning

    2022, Cell Reports
    Citation Excerpt :

    Each training day consisted of a single 30 min session during which a total of 60 visual stimuli were presented with the inter-trial interval of 30 s. All mice were trained on the Pavlovian conditioning task for four consecutive days. All behavioral training was conducted using MonkeyLogic (Asaad and Eskandar, 2008; Lutas et al., 2019) and licks were detected by a capacitance-sensing lickspout (3D printed with conductive filament connected to a capacitance sensor, MPR121; Adafruit). Statistical details are found in the figure legends.

View all citing articles on Scopus
View full text