MaleCNS Connectome Initialization
Relevant source files
The following files were used as context for generating this wiki page:
MaleCNS Connectome Initialization prepares the neural connectivity and anatomical data required for the Flyhard simulation. This process transforms raw biological data from the MaleCNS v1.0 dataset into engineering-ready matrices and geometric representations. The system processes over 165,000 traced neurons and 25 million connections to enable neural control of the simulated vehicle.
Sources: README.md, reports/2026-09-09/graph-manifest.json
Data Acquisition and Verification
The initialization starts by fetching public MaleCNS v1.0 tables from Google Cloud Storage. The system verifies every downloaded file against pinned SHA-256 hashes to ensure dataset integrity. It stores these files in a local directory along with a sources.json manifest that records file sizes and URLs.
The acquisition process ensures the verified v1.0 pilot data is used for all downstream processing.
Sources: scripts/acquire_connectome.py:8-50
Required Dataset Files
| Role | Filename | Description |
|---|---|---|
| Annotations | body-annotations-male-cns-v1.0-minconf-0.5.feather | Neuron metadata and status labels. |
| Transmitters | body-neurotransmitters-male-cns-v1.0.feather | Predicted neurotransmitters for each neuron. |
| Weights | connectome-weights-male-cns-v1.0-minconf-0.5.feather | Synapse counts between neuron pairs. |
Sources: scripts/acquire_connectome.py:10-14, reports/2026-09-09/graph-manifest.json
Graph Preparation
The system filters the raw dataset to include only neurons with a status of Traced. This step excludes glia, incomplete fragments, anchors, and unclassified segments. The resulting graph contains 165,122 neurons. Connectivity is represented as a Compressed Sparse Row (CSR) matrix where rows correspond to postsynaptic neurons and columns correspond to presynaptic neurons.
Filtering and Aggregation Logic
- Node Selection: Selects neurons where
status == 'Traced'using PyArrow. - Edge Filtering: Retains only edges where both the presynaptic (
body_pre) and postsynaptic (body_post) neuron IDs exist in the traced set. - Aggregation: Sums synapse counts for duplicate neuron-pair entries.
- Matrix Creation: Constructs a CSR matrix for efficient neural state calculations.
Sources: scripts/prepare_graph.py:53-100, reports/2026-09-09/graph-manifest.json
Sources: scripts/prepare_graph.py:53-112
Anatomical Geometry Initialization
Anatomical initialization fetches neuron skeletons and Region of Interest (ROI) meshes for visualization. The system selects a class-stratified subset of 512 neurons to display in the video renderer. It downsamples skeleton coordinates from nanometres to micrometres using a stride of 4 while preserving branch endpoints.
Geometry Components
- Neuron Skeletons: Precomputed skeletons fetched via
CloudVolume. - Neuropil Meshes: 114 measured compartments from the Brain and Ventral Nerve Cord (VNC).
- Downsampling: Vertices are scaled by 1/1000 to convert to micrometres and simplified for display performance.
Sources: scripts/acquire_cns_geometry.py:15-115, reports/2026-09-09-clean-videos/geometry-manifest.json
Selection Allocations
The system seeds the 512-neuron selection across different functional classes:
| Class | Count |
|---|---|
| Optic Lobe (OL) Intrinsic | 112 |
| Central Brain (CB) Intrinsic | 112 |
| VNC Intrinsic | 80 |
| Sensory (VNC/CB) | 64 |
| Motor (VNC) | 48 |
| Projection (Visual/Asc/Desc) | 96 |
Sources: scripts/acquire_cns_geometry.py:50-52, reports/2026-09-09-clean-videos/geometry-manifest.json
Reachability and Graph Metrics
The initialization calculates sensory-to-motor reachability to validate the graph structure. It uses breadth-first traversal on the connectivity matrix to determine if sensory inputs can reach VNC motor neurons. The results include the number of reachable neurons and the minimum steps required to reach the first motor output.
Sources: scripts/prepare_graph.py:27-41, reports/2026-09-09/graph-manifest.json
Sources: scripts/prepare_graph.py:27-41
The initialization process concludes by saving a comprehensive manifest. This manifest includes connection counts, weak component analysis (finding 539 components), and SHA-256 hashes for all generated artifacts like graph.npz and nodes.feather.
Sources: scripts/prepare_graph.py:113-132, reports/2026-09-09/graph-manifest.json