Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments

2026

Read Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-15245.txt.

Introduction

Pallier, Bonnaire, and Fourcade introduce Goxpyriment, a Go tool for writing behavioral and cognitive experiments. Python tools often burden labs with complex runtime setups that slow rollout. Because Go compiles and embeds assets, Goxpyriment packs each experiment into a single-file binary needing no runtime extras. Its human-friendly design, inspired by Expyriment, ships stimuli from text and shapes to motion clouds.

Catalog record

YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE24933
LICENSEhttp://creativecommons.org/licenses/by-sa/4.0/
RIGHTSCC BY SA
SOURCEarXiv

Source: https://arxiv.org/abs/2604.15245

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments Abstract We introduce goxpyriment , a new open-source software framework for programming behavioral and cognitive experiments using the Go programming language. The library is designed to address some limitations of existing Python-based experiment tools, particularly the runtime environment complexity that frequently complicates deployment across laboratories. Because Go is a compiled language that can natively embed assets (e.g., graphics, audio files, and stimulus lists), goxpyriment compiles entire experiments into single, self-contained executable binaries with zero runtime dependencies. This drastically simplifies distribution to collaborators and testing computers. The programming interface, inspired by Expyriment ( 10 ) , was designed to be human friendly. The library includes an array of visual stimuli (text, shapes, images, Gabor patches, motion clouds, …) and audio capabilities (WAV playback and tone generation). While developping goxpyriment , we focused on timing reliability. Input events are timestamped by the operating system at hardware-interrupt time, so reaction times are computed by subtracting two OS-level timestamps rather than relying on continuous polling. Go’s garbage collector can be disabled, greatly reducing the probability of unpredictable pauses that could corrupt stimulus timing. Finally, a set of over forty psychology experiments implemented in goxpyriment are provided that promote not only learning by humans but also improve the ability of modern AI-assisted coding tools to help program experiments. The framework is released under the GNU General Public License v3 and is freely available at https://github.com/chrplr/goxpyriment . Let’s go experiment! \rightheader Let’s go experiment! \leftheader Let’s go experiment! \authorsnames Christophe Pallier, Julie Bonnaire, Marie-France Fourcade \authorsaffiliations Cognitive Neuroimaging Unit, CNRS INSERM CEA \authornote \addORCIDlink Christophe Pallier0000-0002-3324-666X Correspondence should be addressed to C. Pallier, Cognitive Neuroimaging Unit, Neurospin, Gif-sur-Yvette, F-91191, France. E-mail: [email protected]. I would like to thank Luca Bonatti and Raphael Bordas for alpha testing this software. The authors have no conflicts of interest to disclose. keywords framework, library, stimulus presentation, timing, behavioral experiments, psychophysics, psychology Introduction Experiment-control software occupies a central position in behavioral and cognitive neuroscience: the temporal precision of stimulus delivery and response recording, the ergonomics of experiment programming, and the ease of deploying experiments to laboratory hardware each affect the quality and reproducibility of empirical data. Over the past two decades, Python has become the dominant language for experiment programming, primarily through two libraries: Expyriment ( 10 ) and PsychoPy ( 13 ) . Before Python, MATLAB with the Psychophysics Toolbox ( 2 ; 9 ) was the de facto standard in many laboratories. More recently, web-based frameworks such as jsPsych ( 5 ; 4 ) and lab.js ( 7 ) have enabled large-scale online data collection. Each class of tool involves tradeoffs. MATLAB, extended with specialized C/C++ libraries (e.g. the Psychtoolbox), can offer good timing on well-configured hardware. Yet Psychtoolbox scripts written on Windows often do not work out of the box on Linux (and vice-versa). MATLAB can also be quite expensive when one cannot purchase academic licenses (as is the case for non diploma-delivering research institutions). Python tools provide a more open, flexible programming environment with a large scientific ecosystem. Python-based experiments can achieve high-precision timing, for example by relying on the psychtoolbox Python module which provides pieces of the Psychtoolbox-3 (see https://pypi.org/project/psychtoolbox/ ). However, the use of Python introduces practical difficulties. First, deploying an experiment to a computer that does not already have a compatible Python environment requires package management (conda, pip, venv) and can be a source of breakage across operating-system versions. For example, installing the psychopy module under Linux can crashes while attempting to compile the wxPython package when there is no precompiled wheel. Second, Python’s garbage collector can introduce unpredictable pause times that corrupt the timing of stimulus presentation and response recording during the critical trial loop. Web-based tools trade timing precision for accessibility: browser-mediated stimulus presentation is subject to event-loop latency that makes sub-frame timing difficult or impossible ( 3 ; 1 ) . The Go programming language ( 6 ) offers a different perspective. Designed from the ground up for simplicity, Go has fewer moving parts than Python; as a consequence, the code is often described as “boring” but highly predictable, as the language structure typically enforces only one way to solve a given problem. In addition, Go is strongly typed and encourages error checking, which translates into less run-time debugging. Another important feature of Go is that it (cross-)compiles to native machine code for each target platform and can produce self-contained binaries that embed the stimuli, experiment lists, and thus have no runtime dependencies. Its garbage collector is concurrent and can be suspended for the duration of a timing-critical section. These properties make it an attractive basis for a behavioral experiment library that prioritizes timing reliability and deployment simplicity. The present article describes the design and capabilities of goxpyriment , discusses its timing architecture, and situates it relative to existing tools. Specifically, we highlight three main contributions of this framework: (1) zero-dependency deployment via single compiled binaries that simplify distribution across laboratory hardware; (2) native high-precision timing achieved directly through the Go and SDL3 APIs without requiring external C/C++ helper engines; and (3) a linear, straightforward API that is well suited for modern AI-assisted coding workflows. Listing 1: Example of a Parity Decision experiment ⬇ 1 package main 2 3 import ( 4 " slices " 5 " strconv " 6 7 " github . com / chrplr / goxpyriment / control " 8 " github . com / chrplr / goxpyriment / design " 9 " github . com / chrplr / goxpyriment / stimuli " 10 ) 11 12 func main () { 13 exp := control . NewExperimentFromFlags (" Parity Decision ", 14 control . Black , control . White , 32) 15 defer exp . End () 16 17 Targets := [] int {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 18 NTrialsPerTarget := 2 19 EvenResponse := control . K_F 20 OddResponse := control . K_J 21 Instructions := " When you ’ ll see a number , your task to decide , 22 as quickly as possible , whether it is even or odd .\ n \ n 23 if it is even , press ’ F ’\ n \ nif it is odd , press ’ J ’" 24 25 cue := stimuli . NewFixCross (25, 2, control . DefaultTextColor ) 26 // creates a map number -> image 27 Image := make ( map [ int ]* stimuli . TextLine ) 28 for _ , num := range Targets { 29 Image [ num ] = stimuli . NewTextLine ( strconv . Itoa ( num ), 30 0, 0, control . DefaultTextColor ) 31 } 32 33 trials := slices . Repeat ( Targets , NTrialsPerTarget ) 34 design . ShuffleList ( trials ) 35 36 exp . AddDataVariableNames ([] string {" number ", " key ", " rt ", 37 " correct "}) 38 39 exp . Run ( func () error { 40 exp . ShowInstructions ( Instructions ) 41 42 for _ , t := range trials { 43 exp . Blank (1000) 44 exp . ShowTimed ( cue , 500) 45 key , rt , _ := exp . ShowAndGetRT

Read the complete text