desktop-fly logo

desktop-fly

A 3D fruit fly living on your macOS desktop, driven by a live spiking simulation of the real FlyWire connectome

SwiftSwiftNOASSERTION 609 36
GitHub

What is it?

What it is

DesktopFly is a macOS desktop application that renders a 3D fruit fly on a transparent overlay, driven by a real-time spiking simulation of the FlyWire Drosophila connectome, allowing interactive exploration of neural dynamics and escape behavior.

Why it exists

It exists to visualize and experiment with authentic neural circuitry — using actual FlyWire neuron positions, synaptic connections, and LIF dynamics — to study how real insect behaviors like escape, grooming, and walking emerge from the connectome.

Who should use it

Computational neuroscientists, Drosophila researchers, and developers interested in biologically realistic neural simulations. Also suitable for educators and students in neuroscience or computational biology who want to explore real connectome data in an interactive, visual format. macOS users curious about open-source scientific visualization projects.

Who should avoid it

Users on non-macOS platforms (Windows, Linux), developers seeking production-ready or enterprise-grade software, and individuals without a basic understanding of neuroscience concepts such as neurons, synapses, or connectomes. Also not suitable for users requiring strict licensing clarity, as data licensing is mixed (MIT code with CC BY-NC 4.0 data).

How it works

A quick walkthrough in plain English

How desktop-fly works

Step 1 of 3

You interact with it

Open desktop-fly, send a request, or connect it to your stack.

Features

3D fruit fly living on macOS desktop driven by real FlyWire connectome
Real-time rendering of 23,210 neuron soma positions with color-coded cell types
668-neuron circuit simulation using 1 kHz leaky-integrate-and-fire dynamics
Biological escape mechanism via Giant Fiber (GF) neuron spiking triggered by looming stimuli
Interactive brain window where clicking neurons directly influences body behavior
Permission-free access to macOS sensors (cursor position, window frames, clicks, thermal state)
Body behaviors mapped to specific neural circuits (walking, grooming, escaping, sleeping)
Desktop ecology integration: window terrain, cursor looms, clicks as substrate taps, circadian rhythms
Diagnostic tools (--simtest, --behaviortest, --snapshot, --brainshot) for validation and analysis
MIT licensed code with CC BY-NC 4.0 data files from FlyWire v783

Advantages

  • Uses real biological connectome data (FlyWire v783) instead of abstract simulations
  • Completely permission-free operation on macOS 13+ without special entitlements
  • High-fidelity representation of neural dynamics with ~19,000 synaptic connections
  • Accurate escape response model where the Giant Fiber neuron actually fires to trigger takeoff
  • Interactive brain visualization allowing direct stimulation of specific circuit neurons
  • Rich behavioral repertoire: walking, grooming, backward scooting, wing beats, sleep cycles
  • Integration with macOS desktop elements creates realistic ecological interactions
  • Multiple diagnostic modes for circuit verification and behavioral testing
  • Open-source MIT license enabling community contributions and reuse

Disadvantages

  • Platform-specific: requires macOS 13+ with Xcode Command Line Tools (Swift 5.9+)
  • Limited to single machine usage—no cloud or cross-device support
  • Heavy computational load (23k neurons, 19k synapses) requiring decent hardware
  • External dependency on FlyWire codebase and data generation pipeline
  • No graphical user interface beyond the built-in menu bar—limited interactivity
  • Not suitable for non-macOS environments or web-based deployment
  • Performance may degrade on lower-end devices due to real-time simulation demands

Installation

cloud

Not specified in README

docker

Not specified in README

native

git clone https://github.com/DenisSergeevitch/desktop-fly.git
cd desktop-fly
./build.sh
./DesktopFly

compose

Not specified in README

FAQ

What is DesktopFly and what makes its simulation biologically realistic?

DesktopFly is a macOS app that places a 3D fruit fly on your desktop whose behavior is driven by a live spiking neural simulation of the real FlyWire (FAFB v783) connectome. It uses 23,210 real neuron soma positions for the brain window and runs a 668-neuron circuit with ~19,000 real synaptic connections as a 1 kHz leaky-integrate-and-fire (LIF) simulation. Escape behavior is not scripted — your cursor's approach becomes looming input to real LC4/LPLC2 cells, and the fly takes off only when the Giant Fiber (GF) actually spikes through its real synapses, with ~1,200 synapses of feedforward inhibition causing slow approaches to be tolerated while fast lunges trigger escape in ~4 ms.

What are the system requirements and how do I install DesktopFly?

DesktopFly requires macOS 13+ and Xcode Command Line Tools (Swift 5.9+). No permissions or entitlements are needed. To install: git clone the repository, cd into the directory, run ./build.sh, then run ./DesktopFly. A fly icon appears in the menu bar for controls, and the fly lives on a transparent, click-through overlay that never intercepts your mouse or keyboard.

How do I rebuild the neural data from the raw FlyWire dumps?

The data/ directory ships with compact derived files. To rebuild them from raw FlyWire Codex dumps (~60 MB download), create a temp directory, download the four required CSV files (classification.csv.gz, coordinates.csv.gz, connections.csv.gz, consolidated_cell_types.csv.gz) from the FlyWire storage bucket, then run 'python3 etl.py /tmp/flywire' from the repository root.

What diagnostic and testing options are available?

DesktopFly includes several command-line diagnostics: --simtest runs circuit invariants (e.g., GF silent at rest, 4 ms loom latency); --behaviortest runs 17 end-to-end checks that stimulate neurons and verify body reactions; --snapshot f.png renders an offscreen fly image; and --brainshot b.png renders an offscreen brain image.

How does the fly interact with my desktop environment?

DesktopFly uses permission-free macOS senses: window top edges become ledges the fly lands on and walks along; window appearances near the fly feed the looming pathway; clicks near the fly are treated as substrate taps that startle it through the wind→GF pathway; typing is sensed as vibration via the idle-time API (knows when keys are pressed, never which); and temperature affects fly speed since they are ectotherms.

What is the license and how should I cite this work?

The code is MIT licensed. The data files in data/ are derived from FlyWire (FAFB v783) and are CC BY-NC 4.0 — see data/DATA_LICENSE.md. If you use this work, cite: Dorkenwald et al. Neuronal wiring diagram of an adult brain. Nature 634, 124–138 (2024) and Schlegel et al. Whole-brain annotation and multi-connectome cell typing of Drosophila. Nature 634, 139–152 (2024).

Loading documentation…
View on GitHub

Featured in Videos

YouTube tutorials and walkthroughs for desktop-fly

Alternatives

Similar projects ranked by category, topics, and text overlap.

Compare