How hotocoo/malecns works
malecns trains a fixed MaleCNS connectome to drive a simulated car around Monaco. The main workflow feeds road sensing into the fly-brain interface, simulates spiking activity, reads descending-neuron activity into controls, and evolves interface parameters with headless training. Separate branches prepare connectome and circuit data, model road law and visual perception, evaluate trained policies, and stream live runs to a browser. Some subsystem links are documented in the README; source excerpts and the index provide only partial implementation evidence, so uncertain wiring is omitted.
Main entry points: train.py ES Trainer · app.js Browser UI · brain.py LIF Brain · agent.py Fly Agent
Components 27
Connectome Data
- Connectome Data
src/download.py - Graph Builder
src/build_graph.py
Circuit World
- Road Law
src/roadlaw.py - Law Reward
src/lawreward.py - Circuit Scene
src/scene.py - Rendered Camera
src/camera.py - Visual Perception
src/perceive.py - Eye Camera
src/eye_camera.py - Perception Dataset
src/dataset.py - Terrain Model
src/terrain.py - Scenery Fetch
src/fetch_scenery.py
Driving Runtime
- LIF Brain
src/brain.py - Metal LIF Kernel
src/metal_lif.py - Fly Agent
src/agent.py - Car Environment
src/car_env.py
Training & Evaluation
- ES Trainer
src/train.py - Policy Evaluation
src/evaluate.py - Reward Exploit Scan
src/exploits.py - Motor Calibration
src/calibrate.py - Driving Teacher
src/teacher.py
Live Viewer
- Viewer Server
src/viewer.py - Browser UI
web/app.js - Brain Visualizer
web/brain.js - Driving View
web/drive.js - Cockpit View
web/firstperson.js - Scenery Renderer
web/scenery.js
Other components
- Operator
Connections 33
- Operator → Connectome Data: downloads
- Connectome Data → Graph Builder: builds graph
- Graph Builder → LIF Brain: supplies connectome
- Fly Agent → LIF Brain: drives
src/agent.py - LIF Brain → Metal LIF Kernel: dispatches on Apple GPU
src/brain.py - ES Trainer → Fly Agent: optimizes interface
src/train.py - ES Trainer → LIF Brain: loads connectome
src/train.py - ES Trainer → Car Environment: runs rollouts
src/train.py - ES Trainer → Reward Exploit Scan: monitors reward
src/train.py - ES Trainer → Policy Evaluation: evaluates policy
src/train.py - Motor Calibration → Fly Agent: fits readout
src/calibrate.py - Motor Calibration → Driving Teacher: uses demonstrations
src/calibrate.py - Motor Calibration → Car Environment: simulates driving
src/calibrate.py - Policy Evaluation → Fly Agent: loads checkpoint
src/evaluate.py - Policy Evaluation → Car Environment: runs scenarios
src/evaluate.py - Policy Evaluation → Reward Exploit Scan: checks exploits
src/evaluate.py - Car Environment → Terrain Model: uses elevation
src/car_env.py - Circuit Scene → Road Law: uses road rules
src/scene.py - Law Reward → Road Law: charges violations
src/lawreward.py - Rendered Camera → Circuit Scene: renders geometry
src/camera.py - Eye Camera → Rendered Camera: captures frames
src/eye_camera.py - Eye Camera → Visual Perception: processes vision
src/eye_camera.py - Perception Dataset → Rendered Camera: renders samples
src/dataset.py - Perception Dataset → Visual Perception: uses detections
src/dataset.py - Operator → Scenery Fetch: fetches optional scenery
- Viewer Server → Fly Agent: runs checkpoint
src/viewer.py - Viewer Server → LIF Brain: loads connectome
src/viewer.py - Viewer Server → Car Environment: simulates live car
src/viewer.py - Viewer Server → Browser UI: streams frames
- Browser UI → Brain Visualizer: shows brain
- Browser UI → Driving View: shows circuit
- Browser UI → Cockpit View: offers cockpit
- Browser UI → Scenery Renderer: renders scenery