Skip to main content

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

  1. Install dependencies

    pip install -r requirements.txt
    
  2. Run Example

    python bio_compiler.py
    
    python -m unittest test_bio_compiler.py
    
    python test_visualization.py
    

File Structure

  • bio_compiler.py — Main class and logic extraction
  • app.py — Dash web app (main UI)
  • sample_circuit.json / sample_circuit.csv — Example data
  • requirements.txt — Dependencies
  • pyproject.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.toml and setup.py for pip/Poetry installation
  • requirements.txt for quick dependency install

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bio_logic_compiler-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bio_logic_compiler-0.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

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

Hashes for bio_logic_compiler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 573f6088f8c37f16231fbf185103819eefa55bd45aec9aab7249c2fd6f0c0871
MD5 13f5944a0245c99b0eb624b96b0ff9cb
BLAKE2b-256 1560213d008a3a3a64f30281e202b7ea7c3f70ccd8de7c48a852e66252e3d1c3

See more details on using hashes here.

File details

Details for the file bio_logic_compiler-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bio_logic_compiler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62201a491b8a8ff4e90bc384f5325dca2e3e2990f616f7259a6f81a5cf27cdea
MD5 bddb4c02c0e086367ded51edbcd67e31
BLAKE2b-256 ca7c88773591436161d03f7fed241fba21cda57f04ce3ec90e31b6a50cc041e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page