CageLab — open in-cage cognitive training kiosk (GitHub organisation)
Repos: github.com/cagelab (org: cogmoteGO, CageLab-Code, cogmote, matmoteGO, pymoteGO, cogmoteHub, CageLab-Kiosk, cogmatrix, Setup) Repo description: “High-throughput, low-cost in-cage cognitive training kiosk — Software” (CageLab-Code; MATLAB).
About CageLab
CageLab is a collaborative project to build a high-throughput and large-scale cognitive training and testing platform for many subjects. Home cage testing and training is a strong 3Rs refinement for cognitive neuroscience research. The problem with existing cognitive testing / training kiosks is they do not scale well as the subject count increases. We solve this by implementing a robust remote control interface for one-to-many or many-to-many communication between control and experiment systems; using asymmetric staircase to adaptively train subjects, and architecting a data pipeline using a neuroscience database ( Alyx, from IBL) and task metadata specifications ( HED Tags, BIDs / EEGLab origin).
🚀 The components
- Hardware - design a low-cost and flexible to adjust cage-attached box, along with reward and input devices. Low-cost is important because as the number of devices increases, price-per-device becomes an issue. Using Aluminium T-slot allows flexible adaptation to different housing configurations compared to perspex or stainless steel enclosures.
- Communication Middleware (cogmoteGO) - a fast and flexible way to distribute neuroscience experiments and collect data from many devices. It uses a HTTP API across devices and talks via local ØMQ messaging to experimental code for robust many-to-many control.
- Software (CageLab-Code) - PsychToolbox-based task manager, enabling existing experiment code designed for the lab to work more quickly in the home environment. PTB, with the largest support of different device hardware and best-in-class timing remains the gold-standard way to run neuroscience tasks.
- Data pipeline - integrating Alyx (International Brain Lab, ONE protocol pipeline) for metadata, S3 servers for file storage, and HED tags for event labelling, to efficiently scale data collection and data analysis to a large number of home environment test devices.
- Task Design - Unified design across different tasks. Automated cognitive training using a tuned asymmetric staircase: more standardised and adaptive training per subject, hopefully resulting is faster training times.
- AI Automation - CogmoteGO and Alyx offer REST APIs, and because our data is labeled with schema-backed event labels: agents can therefore be trained to understand AND use the tooling to parse data, observe devices, and update parameters, reducing the tedious parts of managing many subjects and refining tasks over time.
From the CageLab-Code repository
CageLab Software Frameworks
Permalink: CageLab Software Frameworks
Distributed Architecture
Permalink: Distributed Architecture
CageLab is designed to run in a flexibly distributed architecture, where each CageLab experiment runs on a separate kiosk system with one or more control PCs able to operate any remote system. This allows for higher throughput and flexibility in using of many kiosks to run experiments at scale. CageLab is designed to be controlled remotely1, allowing for easy management and monitoring of experiments. We aim to support > 20 experimental kiosks running simultaneously. A single control GUI can remote control any kiosk and all the camera feeds, subject displays and data streams (even across different remote sites) can be observed in a single control interface.
When running a task, the whole software stack (all communcation, MATLAB task running and display+camera video streaming) consumes around 10% CPU on a 15W TDP R5-4500U based miniPC.
Software Components
Permalink: Software Components
- Kiosk: cogmoteGO: Middleware for communication between control PC and local CageLab instance. HTTP APIs to talk and control remote experients, and broadcast ongoing trial data.
- Kiosk: theConductor: A MATLAB service that orchestrates experiments on the CageLab instance. Listens for commands coming from cogmoteGO and then runs CageLab behavioural tasks from the +cltasks/ folder.
- Control PC: Cogmote: A cross-platform native app for visualising all remote CageLabs: streaming subject computer display & video feed, and plotting broadcast data (data sent from the running task on each trial). Can do an automatic IP scan to find new remote experiment systems.
- Control PC: CageLab.mlapp: A MATLAB GUI for configuring and controlling experiments on any remote CageLab instance. You can even run arbitrary MATLAB commands, or system commands to enable/disable the touch screen, screensaver etc on remote systems for debugging them etc.
- Both: ssh:
sshmakes it easy to remote login and manage remote systems. We also usenomachinefor remote desktop if GUI access is necessary. Bothnomachineandsshcan be configured to run over the VPN. - Both: VPN: we use Netbird, a distributed peer-to-peer wireguard VPN that establishes a private and easily managed hostname+IP for each system and encrypts all data. Can also use Zerotier or other similar tools. So we just
ssh cagelab-005.cloud.labwhich only other netbird peers can access, securing access to experiment systems.
Communication
Each CageLab runs cogmoteGO, which establishes communication APIs ( https://cogmotego.apifox.cn/) to:
- Relay command packets from one/several control PCs machine to a local running MATLAB process (it could be Octave, Python or any other experiment framework; the API is open and easy to read from). The messages are JSON encoded and sent using a HTTP POST request and cogmoteGO forwards them over a local ØMQ REQ channel to the PTB/MATLAB process. This is more robust than using TCP/UDP.
- Data broadacast messages sent from PTB/MATLAB (or other experiment frameworks) are stored in cogmoteGO and can be subscribed to by any number of remote machines.
A cross-platform MATLAB GUI called CageLab-GUI is run on your control machine and will send the experiment settings to the CageLab instance2. The CageLab device runs a MATLAB service (via systemd) called theConductor that receives commands and orchestrates experiments. Each experiment protocol can be run either locally or remotely.
We use another app Cogmore (cross-platform GUI writen in Tauri), to visualise both the subject screen + camera video feed from the CageLab camera3 and to plot the broadcast data.
Viewing the Opticka experiment log remotely
Permalink: Viewing the Opticka experiment log remotely
The task runner, theConductor, is run via systemd and all task logs are therefore readable using journalctl in real time. You can read the log remotely using ssh by running journalctl --user -f -u theConductor. We usually use tmux to present a display combing the conductor log, the cogmoteGO log and a btop resources display.
Data pipeline
[Permalink: Data pipeline](https://github.com/cagelab/CageLab-Code#data
(Truncated: full text at source URL.)



