A Python MVP for a Bio-Logic Compiler that models neural circuits as graphs, analyzes neuron firing thresholds, and reverse-engineers Boolean logic gates from biological connectivity.
Project description
Bio-Logic Compiler
This project provides a Python MVP for a Bio-Logic Compiler that models neural circuits as graphs, analyzes neuron firing thresholds, and reverse-engineers Boolean logic gates (AND, OR, NOT, NAND, NOR, etc) from biological connectivity.
Features
- Model neurons as nodes and synapses as weighted edges (networkx)
- Add synapses manually or ingest from JSON/CSV files
- Extract logic gates from neuron thresholds and synaptic weights
- Detects AND, OR, NOT, NAND, NOR, direct pass-through, and complex motifs
- Visualize neural circuits with matplotlib
- Comprehensive unit tests
Usage
-
Install dependencies
pip install -r requirements.txt
-
Run Example
python bio_compiler.pypython -m unittest test_bio_compiler.py
python test_visualization.py
File Structure
bio_compiler.py— Main class and logic extractionapp.py— Dash web app (main UI)sample_circuit.json/sample_circuit.csv— Example datarequirements.txt— Dependenciespyproject.toml,setup.py— Packaging
Logic Extraction Principle
A neuron fires if:
$$ \sum (I_n \cdot w_n) \geq \theta $$
Where $I$ is the input (0 or 1), $w$ is the synaptic weight, and $\theta$ is the threshold.
- AND: All excitatory inputs must be active (threshold = sum of weights)
- OR: Any excitatory input triggers firing (threshold <= min weight)
- NOT: Inhibitory input vetoes firing
- NAND/NOR: Mixed motifs with both excitatory and inhibitory inputs
Extending
- Add support for temporal summation and motif discovery
- Integrate with real connectome data (e.g., FlyWire)
- Enhance visualization and reporting
Advanced Features
- FlyWire connectome data ingestion (JSON/CSV)
- Temporal modeling (simulate time steps)
- Motif discovery (logic motif extraction)
Packaging
pyproject.tomlandsetup.pyfor pip/Poetry installationrequirements.txtfor quick dependency install
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bio_logic_compiler-0.1.0.tar.gz.
File metadata
- Download URL: bio_logic_compiler-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
573f6088f8c37f16231fbf185103819eefa55bd45aec9aab7249c2fd6f0c0871
|
|
| MD5 |
13f5944a0245c99b0eb624b96b0ff9cb
|
|
| BLAKE2b-256 |
1560213d008a3a3a64f30281e202b7ea7c3f70ccd8de7c48a852e66252e3d1c3
|
File details
Details for the file bio_logic_compiler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bio_logic_compiler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62201a491b8a8ff4e90bc384f5325dca2e3e2990f616f7259a6f81a5cf27cdea
|
|
| MD5 |
bddb4c02c0e086367ded51edbcd67e31
|
|
| BLAKE2b-256 |
ca7c88773591436161d03f7fed241fba21cda57f04ce3ec90e31b6a50cc041e5
|