Research & Papers

Goxpyriment: A Go Framework for Behavioral and Cognitive Experiments

Researchers built a Go framework that compiles entire psychology experiments into single executable binaries.

Deep Dive

Researchers Christophe Pallier, Julie Bonnaire, and Marie-France Fourcade have introduced Goxpyriment, a new open-source framework for programming behavioral and cognitive psychology experiments. Built in the Go programming language, it directly addresses a major pain point in scientific research: the complex runtime environments and dependency hell common with Python-based tools like Expyriment. Goxpyriment's killer feature is that it compiles an entire experiment—including all assets like graphics, audio files, and stimulus lists—into a single, self-contained executable binary. This creates zero runtime dependencies, drastically simplifying distribution to collaborators and deployment on testing computers across different laboratories.

Beyond portability, the team focused on achieving millisecond-precise timing, which is critical for measuring reaction times accurately. Goxpyriment timestamps input events at the operating system's hardware-interrupt level and calculates reaction times by subtracting these OS-level timestamps, avoiding less reliable continuous polling. Developers can also disable Go's garbage collector to eliminate unpredictable pauses that could corrupt stimulus presentation. The framework includes a full suite of visual stimuli (text, shapes, Gabor patches) and audio capabilities, and ships with over forty implemented experiments to serve as templates. These templates are designed not only for human learning but also to improve the performance of modern AI-assisted coding tools in generating experiment code. Released under the GNU GPL v3 license, Goxpyriment represents a significant step toward more reproducible and easily shareable experimental psychology.

Key Points
  • Compiles entire experiments into single, self-contained executable binaries with zero runtime dependencies, solving Python deployment issues.
  • Uses OS-level hardware interrupt timestamps for precise reaction time measurement and allows disabling Go's garbage collector to prevent timing jitter.
  • Includes 40+ pre-built psychology experiments as templates designed to improve both human learning and AI-assisted coding tool performance.

Why It Matters

It standardizes and simplifies sharing complex psychology experiments across labs, making scientific research more reproducible and collaborative.