RPG: A low-cost, open-source, high-performance solution for displaying visual stimuli

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

Highlights

  • RPG provides a simple interface Python to display visual stimuli.

  • RPG utilizes the Raspberry Pi, a low-cost computer.

  • RPG allow users to trigger stimuli via TTL.

  • RPG allows users to receive real-time feedback on frame timings.

  • RPG performance is equivalent to more complex and expensive options.

Abstract

Background

The development of new high throughput approaches for neuroscience such as high-density silicon probes and 2-photon imaging have led to a renaissance in visual neuroscience. However, generating the stimuli needed to evoke activity in the visual system still represents a non-negligible difficulty for experimentalists. While several widely used software toolkits exist to deliver such stimuli, they all suffer from some shortcomings. Primarily, the hardware needed to effectively display such stimuli comes at a significant financial cost, and secondly, triggering and/or timing the stimuli such that it can be accurately synchronized with other devices requires the use of legacy hardware, further hardware, or bespoke solutions.

Results

Here we present RPG (Raspberry Pi Gratings), a Python package written for the Raspberry Pi, which overcomes these issues. Specifically, the Raspberry Pi is a low-cost, credit card sized computer with general purpose input/output pins, allowing RPG to be triggered to deliver stimuli and to provide real-time feedback on stimulus timing. RPG delivers stimuli at 60 frames per second and the feedback of frame timings is accurate to 10s of microseconds.

Comparison with existing method(s)

With respect to the accuracy of frame timings, the performance of RPG is at least as accurate as commonly used packages. However, the inbuilt ability to trigger stimuli and the real-time feedback of frame timings will be extremely useful for certain experiments.

Conclusions

RPG provides a simple to use Python interface that is capable of generating drifting sine wave gratings, Gabor patches and displaying raw images/video.

Introduction

Using a computer to control the presentation of stimuli is a common task in visual neuroscience. As such, several software packages have been developed to deliver stimuli, most notably Psychophysics Toolbox (Brainard, 1997) and PsychoPy (Peirce, 2007). These packages can provide a diverse range of stimuli and are essentially capable of running entire experiments directly. However, they do have two significant limitations. Firstly, they are recommended to be run on relatively costly modern computers with graphics cards. Secondly, triggering the software from other sources or getting the software to trigger other equipment relies on a collection of non-ideal solutions. A primary option is the use of parallel or serial ports (e.g. Nagel and Spüler, 2018), which are both legacy hardware, being largely supplanted by USB. A second option is to use external data acquisition hardware (e.g. Schneider et al., 2018), however, this further complicates the overall code, and increases costs. Finally, bespoke solutions such as using photodiodes to monitor screens can be used to collect frame timing (e.g. Aller et al., 2015). The diversity of computing hardware further complicates matters, such that code which utilizes this software may run perfectly on one computer but results in missed timings or dropped frames on another.

Here we present RPG, a high performance, low cost, open source solution for displaying drifting gratings, Gabor patches and raw images/video. RPG is written in a combination of the languages Python and C, with Python providing a user-friendly way to interface with the underlying code written in C for performance. RPG runs exclusively on the Raspberry Pi, a single-board computer, running the Raspbian Linux distribution. The Raspberry Pi features general purpose input/output (GPIO) pins, which are used by RPG digital input/outputs, specifically to trigger the display of stimuli and to provide output for the exact timing of frames. By running on standardized, low-cost hardware that comes equipped with GPIOs, we believe that some scientists will find RPG to be a superior option for displaying visual stimuli.

RPG is not intended as a replacement for other psychophysics toolboxes, as it lacks many of the functions that these excellent packages provide. However, for scientists who simply need to display drifting/stationary gratings, Gabor patches or raw video/images, we believe RPG will provide a simpler, more robust, and more reproducible solution than existing software.

Section snippets

Raspberry Pi

RPG has been developed and tested on the Model B Raspberry Pi 3 and 4, which are powered by a quad core Cortex A53 (1.2 GHz) and A72 (1.5 GHz) with 1 GB and 4 GB of RAM and running the default Raspbian GNU/Linux 9 “Stretch” and Raspian GNU/Linux 10 “Buster” operating systems respectively. The monitor was a Dell U2415.

Windows PC

Benchmarking of packages with similar functionality was performed on an Intel Core i7-8700k running at 3.7 GHz with 32 GB Ram and a NVIDA GeForce 1080 Ti. Psychtoolbox (v3.0.15)

What RPG provides

RPG, along with the Raspberry Pi hardware, provides a convenient platform to generate and display visual stimuli (Fig. 1). RPG is available to download at https://github.com/bill-connelly/rpg, along with a full code reference. RPG allows users to generate drifting or stationary gratings and Gabor patches and save them to disk. Also, arbitrary greyscale or color images and videos can be converted from a raw format to an RPG format. These gratings, videos or images can then be loaded to memory

Conclusion

RPG provides a simple, robust, flexible and high-performance solution for displaying visual stimuli. The feedback allows sub-millisecond knowledge of frame timings. When run on a Raspberry Pi 4, RPG can store large amounts of video data for rapid display, and with a USB 3.0 external hard drive, it can load data on the fly, allowing for a huge reservoir of potential stimuli. RPG is full documented and is designed to allow scientists to rapidly deploy visual stimuli with minimal difficulty.

CRediT authorship contribution statement

Vivian Imbriotis: Methodology, Software, Validation, Writing – review & editing. Adam Ranson: Validation, Investigation, Formal analysis, Writing – review & editing. William M. Connelly: Conceptualization, Software, Investigation, Formal analysis, Writing – original draft.

Competing interests statement

The authors have no competing interests to declare.

References (6)

  • J.W. Peirce

    PsychoPy - Psychophysics software in Python

    J. Neurosci. Methods

    (2007)
  • M. Aller et al.

    A spatially collocated sound thrusts a flash into awareness

    Front. Integr. Neurosci.

    (2015)
  • B.K. Andrásfalvy et al.

    Quantum dot-based multiphoton fluorescent pipettes for targeted neuronal electrophysiology

    Nat. Methods

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

Cited by (0)

1

These authors are joint corresponding authors.

View full text