Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Genomics Radio. Generated commentary on the latest computational biology and genomics papers.
Ines: I'm Ines.
Marcus: And I'm Marcus, here with Yuki.
Ines: We're looking at the paper: "Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments".
Paper summary: Ines: So, we're looking at the paper today about Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments. We’re talking about what they claim this framework is designed to do.
Marcus: Basically, the thesis is that they are introducing a new open-source software framework built with the Go programming language specifically for programming behavioral and cognitive experiments.
Ines: They claim this framework addresses limitations of existing Python-based experiment tools, particularly around the complexity of runtime environment when you try to deploy them across different laboratories.
Yuki: It seems like they are focusing on making deployment simpler, which is a major pain point for researchers who need to run the same experiments consistently in various settings.
Ines: Right, and because Go is a compiled language, it can natively embed assets like graphics, audio files, and stimulus lists directly into the executable. This means the framework compiles entire experiments into single, self-contained binaries with zero runtime dependencies.
Marcus: That’s a big deal for distribution; instead of managing virtual environments or interpreter installations on each machine, you just copy one file to get it running anywhere.
Yuki: So it makes sharing materials and testing across different computers much more straightforward than what you might experience with Python setups.
Ines: Also, they claim the programming interface is designed to be human friendly, drawing inspiration from an existing framework called Expyriment.
Marcus: And on the technical side, they focused heavily on timing reliability during development because they wanted to address issues like unpredictable pause times that can corrupt the timing of stimulus presentation and response recording during a critical trial loop.
Yuki: They are tackling those timing issues directly, which is crucial for any experiment involving high-speed sequences or precise reaction time measurements.
Ines: And they also mention specific techniques to control memory management tasks, such as exposing a runtime API to suspend the garbage collector during timing-critical loops to ensure stimulus onsets and offsets are not delayed by memory management tasks.
Marcus: So they’ve put effort into making sure that the stimulus presentation timing is as accurate as possible, especially when dealing with dense sequences.
Yuki: And they also use specialized stream functions for those fast sequences, which disable garbage collection and busy-wait at the sub-frame level to make sure each stimulus onset is scheduled accurately.
Ines: So in short, the paper introduces a framework that emphasizes zero runtime dependencies through static linking and embedding assets directly into the binary.
Marcus: It’s about simplifying distribution so that researchers can focus more on the experiment design rather than infrastructure management when collaborating with others.
Conclusion: Ines: So, wrapping up our look at Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments. The authors are Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade from the Cognitive Neuroimaging Unit CNRS INSERM CEA.
Marcus: They essentially propose this Go framework as a way to make programming these kinds of experiments much more straightforward by solving the deployment headaches that come with current Python tools.
Yuki: In simple terms, it’s a tool designed to be self-contained so you don't have to worry about installing a whole environment every time you want to run an experiment.
Ines: Exactly. It’s about making the process of taking an experiment from design to running it on multiple machines much more accessible by removing that environmental complexity for collaborators.
Marcus: The implications are that researchers can focus more on the actual
Cognitive Neuroimaging Unit CNRS INSERM CEA
q-bio.NC
Submitted: 2026-04-16
Updated: 2026-11-25
Comments: 8 pages, 2 figures, 2 tables
Code: https://github.com/chrplr/goxpyriment
Project page: https://chrplr.github.io/goxpyriment
License: http://creativecommons.org/licenses/by-sa/4.0/
Importance score: 89/100
The gist: Goxpyriment introduces goxpyriment, a new open-source software framework for programming behavioral and cognitive experiments using the Go programming language.<ref:2604.15245#pg1…
Key concepts
- Experiment Object
- This central object manages all aspects of an experiment, including the window display, how visuals are rendered, and audio subsystems. It acts as the main container for setting up and running a single experimental setup.
- Single-Binary Deployment
- Go compiles the entire program into one executable file that has no external runtime dependencies. The necessary SDL3 libraries are embedded directly into this file, meaning users only need to copy one file to run experiments on any lab computer without managing virtual environments.
- High-Precision Streams
- For fast stimulus sequences like retinotopic stimulation, specialized functions ensure accurate timing. These functions disable garbage collection and busy-wait at the sub-frame level to guarantee that every stimulus starts exactly when scheduled.
- OS-Level Response Timestamps
- The framework uses SDL3 OS events to capture response times with high accuracy. By comparing the response time against screen flip timestamps, researchers can measure reaction times with minimal jitter and no overhead.
Terminology
Summary
Goxpyriment introduces goxpyriment, a new open-source software framework for programming behavioral and cognitive experiments using the Go programming language. p. 0 Goxpyriment: A Go Framework for Behavioral and Cognitive
Experiments
Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade
Cognitive Neuroimaging Unit
CNRS INSERM CEA
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. Goxpyriment: A Go Framework for Behavioral and Cognitive
Experiments
Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade
Cognitive Neuroimaging Unit
CNRS INSERM CEA
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. Goxpyriment: A Go Framework for Behavioral and Cognitive
Experiments
Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade
Cognitive Neuroimaging Unit
CNRS INSERM CEA
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. Goxpyriment: A Go Framework for Behavioral and Cognitive
Experiments
Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade
Cognitive Neuroimaging Unit
CNRS INSERM CEA
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.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Framework Design
Every experiment centers on an Experiment object that manages the window, renderer, and audio subsystems.<ref:2604.15245#pg2, Every experiment centers on an Experiment object that manages the window, renderer, and audio subsystems>. p. 1 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. Framework Design
Programming Model
Every experiment centers on an Experiment object that
manages the window, renderer, and audio subsystems. Framework Design
Programming Model
Every experiment centers on an Experiment object that
manages the window, renderer, and audio subsystems. Execution is wrapped in a Run callback that provides a safety
layer: if the participant presses the Escape key or closes
the window, the library catches the resulting internal signal,
safely flushes the data file to disk, and shuts down the SDL
subsystems. Framework Design
Programming Model
Every experiment centers on an Experiment object that
manages the window, renderer, and audio subsystems. Execution is wrapped in a Run callback that provides a safety
layer: if the participant presses the Escape key or closes
the window, the library catches the resulting internal signal,
safely flushes the data file to disk, and shuts down the SDL
subsystems. This ensures that data is preserved even if a session is aborted prematurely. It is possible, but not necessary, to build the experiment
around a hierarchical structure of blocks and trials, over
which the program can iterate, following a patten inspired
by Expyriment (Krause & Lindemann, 2014). This ensures that data is preserved even if a session is aborted prematurely. It is possible, but not necessary, to build the experiment
around a hierarchical structure of blocks and trials, over
which the program can iterate, following a patten inspired
by Expyriment (Krause & Lindemann, 2014). Each trial is
a collection of factors that can be randomized and logged. Data collection is handled by an exp. Data collection is handled by an exp. Data object, which
writes to a CSV file withal metadata headers providing extensive information about the computer OS and hardware,
A. Each trial is
a collection of factors that can be randomized and logged. Data collection is handled by an exp. Data collection is handled by an exp. Data object, which
writes to a CSV file withal metadata headers providing extensive information about the computer OS and hardware,
A.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies.<ref:2604.15245#pg3, Go compiles programs into a single statically linked executable with no external runtime dependencies>. p. 2 LET’S GO EXPERIMENT! 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. In addition, the stimuli, experimental lists, fonts, and other
assets can be embedded in the binary too. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. In addition, the stimuli, experimental lists, fonts, and other
assets can be embedded in the binary too. In addition, the stimuli, experimental lists, fonts, and other
assets can be embedded in the binary too. As a result, distributing an experiment requires copying just one file; there
is no need to manage virtual environments, package versions,
or interpreter installations across laboratory computers. In addition, the stimuli, experimental lists, fonts, and other
assets can be embedded in the binary too. As a result, distributing an experiment requires copying just one file; there
is no need to manage virtual environments, package versions,
or interpreter installations across laboratory computers.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Hardware-Synchronized Presentation
Through go-sdl3 (Jung, 2026), goxpyriment relies on the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and graphics hardware.<ref:2604.15245#pg3, Through go-sdl3 (Jung, 2026), goxpyriment relies on the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and graphics hardware>. p. 2 goxpyriment uses this mechanism in its
timing-critical loops, ensuring that stimulus onsets and offsets are not delayed by memory management tasks. Hardware-Synchronized Presentation
Through go-sdl3 (Jung, 2026), goxpyriment relies on
the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and
graphics hardware (SDL Developers, 2026). Hardware-Synchronized Presentation
Through go-sdl3 (Jung, 2026), goxpyriment relies on
the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and
graphics hardware (SDL Developers, 2026). For example, screen. For example, screen. Update() calls SDL’s SDL_RenderPresent. Hardware-Synchronized Presentation
Through go-sdl3 (Jung, 2026), goxpyriment relies on
the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and
graphics hardware (SDL Developers, 2026). For example, screen. For example, screen. Update() calls SDL’s SDL_RenderPresent. Update() calls SDL’s SDL_RenderPresent. When VSYNC is enabled, this function blocks until the
display’s vertical retrace. Update() calls SDL’s SDL_RenderPresent. When VSYNC is enabled, this function blocks until the
display’s vertical retrace.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
High-Precision Streams
For paradigms with dense, high-speed stimulus sequences such as retinotopic stimulation goxpyriment provides specialized stream functions such as PresentStreamOfImages.<ref:2604.15245#pg3, For paradigms with dense, high-speed stimulus sequences (e. p. 2 When VSYNC is disabled,
SDL_RenderPresent returns immediately, supporting variable refresh rate (VRR) monitors. High-Precision Streams
For paradigms with dense, high-speed stimulus sequences (e. High-Precision Streams
For paradigms with dense, high-speed stimulus sequences (e. , retinotopic stimulation), goxpyriment
provides specialized stream functions such as
PresentStreamOfImages. , retinotopic stimulation), goxpyriment
provides specialized stream functions such as
PresentStreamOfImages. These functions disable
garbage collection, drain the event queue, and busy-wait
at the sub-frame level to ensure that each stimulus onset is
scheduled accurately. , retinotopic stimulation), goxpyriment
provides specialized stream functions such as
PresentStreamOfImages. These functions disable
garbage collection, drain the event queue, and busy-wait
at the sub-frame level to ensure that each stimulus onset is
scheduled accurately. These functions disable
garbage collection, drain the event queue, and busy-wait
at the sub-frame level to ensure that each stimulus onset is
scheduled accurately. A TimingLog records the target and
actual onsets for post-hoc verification, as well as the timing
of keys pressed during the presentation of the stream. These functions disable
garbage collection, drain the event queue, and busy-wait
at the sub-frame level to ensure that each stimulus onset is
scheduled accurately. A TimingLog records the target and
actual onsets for post-hoc verification, as well as the timing
of keys pressed during the presentation of the stream.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
OS-Level Response Timestamps
Response timing in goxpyriment leverages SDL3 OSlevel event timestamps.<ref:2604.15245#pg3, Response timing in goxpyriment leverages SDL3 OSlevel event timestamps>. p. 2 A TimingLog records the target and
actual onsets for post-hoc verification, as well as the timing
of keys pressed during the presentation of the stream. OS-Level Response Timestamps
Response timing in goxpyriment leverages SDL3 OSlevel event timestamps. OS-Level Response Timestamps
Response timing in goxpyriment leverages SDL3 OSlevel event timestamps. The GetKeyEventTS method returns the KeyboardEvent. The GetKeyEventTS method returns the KeyboardEvent. Timestamp field, which is populated by the OS input subsystem at hardware-interrupt time
(nanoseconds since SDL initialization). OS-Level Response Timestamps
Response timing in goxpyriment leverages SDL3 OSlevel event timestamps. The GetKeyEventTS method returns the KeyboardEvent. The GetKeyEventTS method returns the KeyboardEvent. Timestamp field, which is populated by the OS input subsystem at hardware-interrupt time
(nanoseconds since SDL initialization). Timestamp field, which is populated by the OS input subsystem at hardware-interrupt time
(nanoseconds since SDL initialization). Because SDL events
carry their timestamp in the event structure itself, the event
remains in the queue with its original timestamp regardless
of how much computation occurs between stimulus onset
and response collection. Timestamp field, which is populated by the OS input subsystem at hardware-interrupt time
(nanoseconds since SDL initialization). Because SDL events
carry their timestamp in the event structure itself, the event
remains in the queue with its original timestamp regardless
of how much computation occurs between stimulus onset
and response collection. Because SDL events
carry their timestamp in the event structure itself, the event
remains in the queue with its original timestamp regardless
of how much computation occurs between stimulus onset
and response collection. By comparing the response timestamp with the Screen. By comparing the response timestamp with the Screen. FlipTS() timestamp—which uses
the same clock—reaction times can be measured with minimal jitter and no interpreter overhead (of course, potential
hardware level lags at the level of the keyboard or mouse
can still be present). Because SDL events
carry their timestamp in the event structure itself, the event
remains in the queue with its original timestamp regardless
of how much computation occurs between stimulus onset
and response collection. By comparing the response timestamp with the Screen. By comparing the response timestamp with the Screen. FlipTS() timestamp—which uses
the same clock—reaction times can be measured with minimal jitter and no interpreter overhead (of course, potential
hardware level lags at the level of the keyboard or mouse
can still be present).Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
AI-Assisted Coding
Go’s design emphasizes simplicity and predictability.<ref:2604.15245#pg4, Go’s design emphasizes simplicity and predictability>. p. 3 A special folder in the
goxpyriment github repository (performance-reports) is
dedicated for users to share the results of timing tests. AI-Assisted Coding
An AI-Friendly framework
Go’s design emphasizes simplicity and predictability. AI-Assisted Coding
An AI-Friendly framework
Go’s design emphasizes simplicity and predictability. Because the language has few synonymous constructs, it is particularly well-suited for use with AI-powered coding assistants, for example Claude Code or Gemini cli. AI-Assisted Coding
An AI-Friendly framework
Go’s design emphasizes simplicity and predictability. Because the language has few synonymous constructs, it is particularly well-suited for use with AI-powered coding assistants, for example Claude Code or Gemini cli. Unlike dynamic languages where errors like
misspelled method names or invalid argument types (e. ,
supplying a string “red” where a RGB color value is expected) only surface at runtime, Go’s compiler catches these
during the first build attempt. Because the language has few synonymous constructs, it is particularly well-suited for use with AI-powered coding assistants, for example Claude Code or Gemini cli. The framework’s AI-friendliness also comes from other primary technical merits:
Type Safety. The framework’s AI-friendliness also comes from other primary technical merits:
Type Safety. Unlike dynamic languages where errors like
misspelled method names or invalid argument types (e. Unlike dynamic languages where errors like
misspelled method names or invalid argument types (e. ,
supplying a string “red” where a RGB color value is expected) only surface at runtime, Go’s compiler catches these
during the first build attempt. The strict typing reduces erroneous API calls in AI-generated code. Linear Control Flow. In
goxpyriment, the exp. Run wrapper handles the event loop
and automatic cleanup internally, simplfting the work of both
the human and AI coder. The strict typing reduces erroneous API calls in AI-generated code. Linear Control Flow. Linear Control Flow. In some other frameworks, the
programmer must manage an explicit event loop (e. In some other frameworks, the
programmer must manage an explicit event loop (e. ,
while True), manually polling for events and checking
for exit signals. Asset Embedding: A frequent failure point for AIgenerated experiments is incorrect file paths for stimuli. Using Go’s //go:embed directive, an AI can generate code that
bundles assets directly into the binary, eliminating path errors
caused by mismatched directory structures. Run wrapper handles the event loop
and automatic cleanup internally, simplfting the work of both
the human and AI coder. Asset Embedding: A frequent failure point for AIgenerated experiments is incorrect file paths for stimuli.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Comparison with Existing Tools
goxpyriment resembles Expyriment in its API design a central experiment object a present-based stimulus API a structured trial-loop model and output to.csv-format files with metadata. p. 4 goxpyriment resembles Expyriment in its API design: a
central experiment object, a present()-based stimulus API,
a structured trial-loop model, and output to . csv-format files
with metadata. The code for a simple experiment (Parity Decision) is provided in Appendix (Listing 1). The primary
technical differences are the use of Go rather than Python and
the use of SDL3 rather than the older Pygame/SDL2 stack.Where the paper says it
Where the paper says it
Limitations and Future Directions
Video playback functions currently do not expose frame-accurate timestamps or hardware trigger outputs.<ref:2604.15245#pg7>. Eye-tracker support is not present for the moment this is a target for future releases. p. 4 Eye-tracker support. There is none for the moment. There is currently no support for recording audio responses and measuring naming
times, nor videos. As SDL3 supports recording audio and
vido, these features could be implemented in the future. goxpyriment does not currently
support web-based deployment. In theory, this should be
possible as Go can compile to web assembly (wasm) and
SDL3 supports EMSCRIPTEN (https://emscripten. Language barrier. Researchers who are unfamiliar with
Go, that is, the vast majority, will need to invest a bit of
time in getting acquainted with the language. Name of the project. The name “goxpyriment” is quite
hard to pronounce and memorize.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Author Contributions
Christophe Pallier takes full responsibility for all content.<ref:2604.15245#pg8>. Julie Bonnaire and Marie-France Fourcade helped set up the timing measurment system and performed tests. p. 4 Christophe Pallier takes full responsibility for all content. Julie Bonnaire and Marie-France Fourcade helped
set up the timing measurment system and performed tests. The name “goxpyriment” is quite
hard to pronounce and memorize. Author Contributions
Christophe Pallier: Conceptualization, Software implementation, Documentation and Paper Writing, with assistance from Claude Sonnet 4. AI-Assisted Coding
An AI-Friendly framework
Go’s design emphasizes simplicity and predictability. Because the language has few synonymous constructs, it is particularly well-suited for use with AI-powered coding assistants, for example Claude Code or Gemini cli. 6 and Gemini 2. Consistent with current editorial norms (Nature Portfolio, 2023;
Springer Nature, 2023), Claude and Gemini are listed under
Author Contributions rather than as a named author, because
authorship requires the capacity to take accountability for the
work.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Open Practices Statement
The source code of goxpyriment is available under the GNU General Public License v3 at https://github.com/chrplr/goxpyriment. p. 0 The framework is released under the GNU General Public License v3 and is freely
available at https://github. com/chrplr/goxpyriment. com/chr
plr/goxpyriment. All example experiments described in this
article are included in the repository. All example experiments described in this
article are included in the repository. No empirical data are
reported in this article.Where the paper says it
Where the paper says it
Where the paper says it
References
Krause and Lindemann, 2014.<ref:2604.15245#pg6>. Peirce et al. p. 0 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 (Krause & Lindemann, 2014) and PsychoPy
(Peirce et al. 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 (Krause & Lindemann, 2014) and PsychoPy
(Peirce et al. Over the past
two decades, Python has become the dominant language for
experiment programming, primarily through two libraries:
Expyriment (Krause & Lindemann, 2014) and PsychoPy
(Peirce et al. Before Python, MATLAB with the Psychophysics Toolbox (Brainard, 1997; Kleiner et al. p. 0 Over the past
two decades, Python has become the dominant language for
experiment programming, primarily through two libraries:
Expyriment (Krause & Lindemann, 2014) and PsychoPy
(Peirce et al. Before Python, MATLAB with the Psychophysics Toolbox (Brainard, 1997; Kleiner et al. , 2007)
was the de facto standard in many laboratories. More recently, web-based frameworks such as jsPsych (de Leeuw,
2015; de Leeuw et al. , 2023) and lab. js (Henninger et al. Goxpyriment: A Go Framework for Behavioral and Cognitive
Experiments
Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade
Cognitive Neuroimaging Unit
CNRS INSERM CEA
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. (2025, February). Bbtkv3 [computer software]. (2025, February). Bbtkv3 [computer software]. (2025, February). Bbtkv3 [computer software]. Goxpyriment: A Go Framework for Behavioral and Cognitive
Experiments
Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade
Cognitive Neuroimaging Unit
CNRS INSERM CEA
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. com/chrplr/bbtkv3
[Accessed: 2026-04-01]. , Simpson, S. com/chrplr/bbtkv3
[Accessed: 2026-04-01]. , Simpson, S. , Pitiot, A. , MacAskill, M. , Pitiot, A. , MacAskill, M. , MacAskill, M. ,
Höchenberger, R. , MacAskill, M. ,
Höchenberger, R. ,
Höchenberger, R. , Kastman, E. ,
Höchenberger, R. , Kastman, E. , Kastman, E. , & Lindeløv, J. , Kastman, E. , & Lindeløv, J. , & Lindeløv, J. PsychoPy2: Experiments in
behavior made easy. , Hammond, N. , & Turner, G. , & Turner, G. Selfvalidating presentation and response timing in cog- , & Turner, G. Selfvalidating presentation and response timing in cog- The
only performance tweak applied was to set the timer pooling
for usb_serial to the minimum possible value. A Black Box
Toolkit version 3 (Plant et al. 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. 3
Single-Binary Deployment (Zero Dependencies)
Go compiles programs into a single statically linked executable with no external runtime dependencies. Crucially,
the go-sdl3 package embeds the pre-built SDL3 runtime libraries (SDL Developers, 2026) directly into the executable
so that the user do not need to install any library by herself. goxpyriment uses this mechanism in its
timing-critical loops, ensuring that stimulus onsets and offsets are not delayed by memory management tasks. Hardware-Synchronized Presentation
Through go-sdl3 (Jung, 2026), goxpyriment relies on
the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and
graphics hardware (SDL Developers, 2026). goxpyriment uses this mechanism in its
timing-critical loops, ensuring that stimulus onsets and offsets are not delayed by memory management tasks. Hardware-Synchronized Presentation
Through go-sdl3 (Jung, 2026), goxpyriment relies on
the Simple DirectMedia Layer (SDL, version 3), a crossplatform development library designed to provide lowlevel access to audio, keyboard, mouse, joystick, and
graphics hardware (SDL Developers, 2026).Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Reference IDs: Krause and Lindemann, 2014
Peirce et al., 2019
Brainard, 1997
de Leeuw et al., 2023
Henninger et al., 2022
Kleiner et al., 2007
Pallier, C. (2025) [computer software]
Peirce J. W., Gray J. R., Simpson S., MacAskill M. R., Höchenberger R., Sogo H., Kastman E., & Lindeløv J. K. (2019) PsychoPy2: Experiments in behavior made easy. p. 5 , & Lindeløv, J. PsychoPy2: Experiments in
behavior made easy.Where the paper says it
Plant, R Hammond, & Turner, G. p. 5 , Hammond, N. , & Turner, G.Where the paper says it
SDL Developers. (2026) Simple DirectMedia Layer, sdl3
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Zero-Dependency Deployment for AI Coding Agents: The framework allows an AI to generate code that
bundles assets directly into the binary
using//go:embed directive, eliminating path errors caused by mismatched directory structures.
This capability drastically reduces deployment friction when generating experiments for various laboratory computers. -
Enhanced Timing Reliability via Garbage Collector Control: Go's runtime API allows the framework to
suspend the garbage collector
in timing-critical loops, ensuring thatstimulus onsets and offsets are not delayed by memory management tasks.
This prevents unpredictable pauses from corrupting stimulus timing, a known issue in Python environments. -
Native High-Precision Timing Architecture: The system achieves high precision through
OS-Level Response Timestamps,
where reaction times are computed bysubtracting two OS-level timestamps rather than relying on continuous polling.
This avoids the practical difficulties of managing external C/C++ helper engines required by some Python tools for high precision. -
Improved AI Coding Workflow via Type Safety: Go's strong typing translates into
less run-time debugging
because the compiler catches errors likemisspelled method names or invalid argument types
during the first build attempt. This reduces erroneous API calls generated by AI assistants.
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 (Krause & Lindemann, 2014), 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 developing 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.
Related papers
- Self-Supervised Learning of Local Predictive Directions as a Neural Computation
- Synchronized Hearts, Desynchronized Brains: A Nonlinear Dynamics Perspective for Function and Failure
- Message interaction dynamics covary with brain volume across mammalian connectomes
- Planning as Dynamics Relaxation: Hippocampal Recurrent Network Realizes Optimal Goal-Directed Navigation
- The Platonic brain bridge hypothesis: brain networks as architectural priors for multimodal large language models
- BrainPFN: Amortized Brain-Behaviour Prediction via Prior-Data Fitted Networks