GitHunt
BP

bpesquet/gym-rdm

A Gymnasium environment for training agents on Random Dot Motion (RDM) tasks

gym-rdm

A Gymnasium environment for training agents on Random Dot Motion (RDM) tasks.

gym-rdm demo

About

This project uses pygame to animate a set of dots in a more or less random fashion, implementing the Random Dot Kinematogram (RDK) psychophysics task. The animation algorithm is inspired by this repository.

The dot motion code is wrapped into a Gymnasium environment. Autonomous agents can be trained to recognize the main dot motion pattern through Reinforcement Learning.

The above demo was generated by the following command.

# Run the task unit tests as a standalone python program
python tests/test_task.py

Development notes

Toolchain

This project is built and tested with the following software:

  • Poetry for dependency management and packaging;
  • Black for code formatting;
  • Pylint and mypy to detect defaults and mistakes in the code;
  • pytest for testing the code.
  • A GitHub Action to check and test the code upon each push.

Useful commands

# Reformat all Python files
black .

# Check the code for mistakes
pylint gym_rdm/* tests/*

# Run static type checking.
# The -strict flag is... stricter. It should pass on the codebase
mypy [--strict] .

# Run all code examples as unit tests
# The -s flag prints code output
pytest [-s]

License

MIT.

Copyright © 2024-present Baptiste Pesquet.

Languages

Python100.0%

Contributors

MIT License
Created November 8, 2024
Updated September 8, 2025