How eonsystemspbc/drosophila_brain_model_lif works
This repo is a research-grade computational neuroscience simulation project: a Python + Brian2 leaky integrate-and-fire (LIF) network model built from the adult Drosophila connectome (FlyWire). The primary “product” is not a deployed service but a reproducible simulation pipeline that:
• loads connectome tables (connectivity + neuron completeness lists),
• configures experimental manipulations (activation/silencing by FlyWire IDs),
• runs a Brian2 simulation,
• writes large result artifacts (spike times/rates) to results/,
• and provides notebooks (example.ipynb, figures.ipynb) to reproduce paper figures/analyses.
• data inputs (CSV/Parquet/Pickle),
• core simulation engine (Brian2 model code),
• experiment configuration / manipulation layer,
• outputs (parquet results, derived analyses),
• and execution surfaces (local Jupyter vs Colab, optional C++ codegen performance path).
File tree analysis (map files to architectural components)
Top-level assets imply these components:
Core code (the “engine”)
• model.py — the actual Brian2-based LIF model + simulation orchestration (core component).
• utils.py — helper utilities (likely loading/parsing connectome, ID handling, saving outputs, parallelism helpers).
Primary execution / user interface
• example.ipynb — tutorial “how to run a simulation & manipulate neurons”.
• figures.ipynb — paper reproduction pipeline (reads/writes results, computes metrics, generates figures).
• results/eon_1/demo_notebook.ipynb — example demo tied to a specific result set.
Input datasets (connectome / neuron metadata)
• 2023_03_23_connectivity_630_final.parquet — connectivity edges/weights for FlyWire v630.
• 2023_03_23_completeness_630_final.csv — canonical list of neurons (completeness) for v630.
• Connectivity_783.parquet, Completeness_783.csv — alternative public version 783 inputs.
• sez_neurons.pickle — a precomputed neuron set used in analyses/experiments.
Outputs / artifacts
• results/ — simulation outputs and examples (parquet outputs like sugarR*.parquet).
• The README notes “raw output is several GB” and stored externally; local results are under results/.
Environment / reproducibility
• environment.yml, environment_full.yml — conda env specs (full pinning in environment_full.yml).
• Notes on Brian2 C++ code generation as a performance mode.
README insights that should show up
Key architectural behaviors described explicitly:
• Manipulations
• Activation: Poisson spiking at fixed frequency; supports two neuron sets with distinct frequencies.
• Silencing: zero out synapses to/from neuron set.
• Addressing by FlyWire ID.
• Outputs: spike times and rates of affected neurons (and potentially downstream population effects).
• Two connectome versions (630 default; 783 via config dictionary changes).
• Execution modes: local conda + Jupyter; Colab; performance improvement with Brian2 C++ codegen.
Jupyter Notebook Layer
• example.ipynb (interactive experiments)
• figures.ipynb (reproduction/analysis pipeline)
Configuration & Experiment Definition
• config dict (paths, n_proc, version selection)
• Manipulation definitions (activation sets A/B + silencing set)
Core Simulation Package
• model.py (network construction, LIF equations, Brian2 objects, run loop)
• utils.py (I/O, preprocessing, helpers)
Connectome Data Store (Local Files)
• Connectivity Parquet (v630/v783)
• Completeness CSV (v630/v783)
• sez_neurons.pickle (optional metadata set)
Simulation Runtime
• Brian2 Python runtime
• Optional Brian2 C++ codegen path (performance accelerator)
• Optional multiprocessing (implied by n_proc)
Results Store
• results/.../*.parquet (spike times/rates outputs)
Post-processing / Figure Generation
• analysis steps inside figures.ipynb reading results and producing paper plots
• User → Notebooks
• Notebooks → Config/Experiment Definition
• Config → Data Loader (utils/model) → Connectome Files
• Config/Experiment → model.py (build network + apply activation/silencing rules)
• model.py → Brian2 Runtime (simulate)
• Brian2 Runtime → Results Store (results/)
• figures.ipynb → Results Store (read) → Derived metrics/figures
• Notebooks invoke model.py functions (control flow),
• connectome files feed network construction,
• results files feed analysis.
Architectural patterns
• Data-driven model construction: network topology derived from Parquet/CSV, not hardcoded.
• Experiment-as-configuration: manipulations are parameterized by FlyWire IDs and frequencies.
• Separation of concerns:
• notebooks = orchestration / narrative,
• model.py = simulation logic,
• utils.py = support I/O/preprocessing,
• results/ = artifact boundary.
• Performance “backend swap”: Brian2 interpreted vs C++ codegen.
Technologies explicitly
• Python
• Brian2 (with optional C++ codegen)
• Pandas/Parquet (implied by .parquet)
• Conda environment (environment.yml)
• Jupyter/Colab